Are you the publisher? Claim or contact us about this channel

Embed this content in your HTML


Report adult content:

click to rate:

Account: (login)

More Channels


Channel Catalog

Channel Description:

WordPress › Support

(Page 1) | 2 | 3 | .... | 413 | newer

    0 0

    Simple code:

    $starnonce = wp_create_nonce( 'star_nonce');

    I'm passing the nonce from a form, for verification.

    Why would I get the same value over and over again from WP, even after a reboot?



    0 0

    Hey guys, I had read a lot of articles, guides & tips and still cant understand how to rewrite rule.
    Here is what i got:
    my url:


    my code in functions.php:

     * Add rewrite tags
    function add_new_rewrite_tags() {
                '([^/]*)' ) ;
    add_action( 'register_special_query_vars', 'add_new_rewrite_tags' ); /*hooked to a previous function which gets vars from the url.*/
     * Rewriting rules
    function query_rewrite_new_rules() {
                'top' );
    add_action( 'add_new_rewrite_tags', 'query_rewrite_new_rules');

    0 0

    Hi all,

    I am trying to set up my WP install with the custom post type 'dm_tool' and hierarchical custom taxonomy 'tool_type'.

    What I am trying to achieve is the following: showing the custom post type archive page showing a books archive page showing the single for a book

    I have been searching Google for three days now but I can't find a way to make it work. I have the following in my

    $args = array(
    			'hierarchical' => true,
    			'labels' => $labels,
    			'query_var' => true,
    			'rewrite' => array('slug' => 'tools', 'hierarchical' => true)
    	/* Register the Custom taxonomy */
    	register_taxonomy('tool_type',	array('dm_tool'), $args);
    	/* Custom Post Type */
        $labels = array(
            'name' => _x('Tools', 'post type general name'),
            'singular_name' => _x('Tool', 'post type singular name')
        $args = array(
            'labels' => $labels,
            'public' => true,
            'publicly_queryable' => true,
            'show_ui' => true,
            'query_var' => true,
            'capability_type' => 'post',
            'hierarchical' => false,
        	'taxonomies' => array('tool_type'),
            'menu_position' => null,
            'supports' => array('title','editor','thumbnail', 'excerpt'),
            'rewrite' => array(
                'slug' => 'tools/%tool_type%',
                'with_front' => false,
            'has_archive' => 'tools'
        register_post_type( 'dm_tool' , $args ); shows archive-dm_tool.php and shows single-dm_tool. shows a default page template. Why is this?

    Any help/suggestion is greatly appreciated..

    0 0

    I would like to modify my search results on my blog.

    In pages section I have templates like: smaller, fullwidth and show.
    In side them I have some content. In smaller and fullwidth templates I have casual text, but the SHOW templates including my tags like:
    [readthis]blablabla[/readthis] or others - inside the templates file, I'm using some php code to show it specialy. It's required to use this code.

    But when I'm serching something my results looks horrible.
    smaller and fullwidth are ok, but show template is displaing my tags ;)

    I would like to hide content when in search results is page with show template, or show just the [show] tag.

    I do not know how to check if the query in my while loop is using SHOW template.

    Thanks in advance,
    I'm waiting forward for your reply.

    0 0

    I have a function that manipulates images and I would like to incorporate it into my Wordpress sites such that every image that is uploaded is first processed by this .php function. Where is the best place to insert this code?

    0 0
  • 06/04/13--08:30: Luismin on "Posts Checklist"
  • Hi!

    I am working in a WordPress backend design and I would like to know if is there any function like wp_categories_checklist for posts.

    I have an issue here in order to find a multiple selection of my dropdown. So if is there any way to put my posts array in a meta box like the custom categories from WordPress that would be great.


    0 0

    In previous versions of WordPress, I could remove the media upload button with something like:

    function z_remove_media_controls($context) {
    add_action('media_buttons_context', 'z_remove_media_controls');

    However, this does not seem to work in WordPress 3.5. How can I remove or hide the button now?

    0 0

    Hi I would like to post some data to a db when certain categories are selected in a WP post. I would like this to action when the post is made.

    This is the query I wan to run:

    mysqli_query($con,"UPDATE persons SET Age=Age+1
    WHERE FirstName='Peter' AND LastName='Griffin'");

    and I want it to happen upon the publishing of the post and only when categories with id's 2 and 3 are both selected.

    I've been trying for days now to get this right it's a little over my head. Any help would be greatly appreciated. Thankyou

    0 0


    We want to change permalinks for all site. But we want to do it progressively.

    How can i change permalink only for one category?

    Now our permalinks are

    and the new one it's

    Thank you so much

    0 0

    I have a plugin that creates a widget and widget area.
    Currently when the plugin is activated it adds the widget area as the first widget area and it adds the widgets in with the rest of the available widget.
    To add the widget a user must drag the widget to the widget area.

    How to I make the widget show up in the admin widget area by default?

    Also how to I make the widget area the last widget area instead of the first (so it shows up at the bottom of the list of widget areas in the admin view instead of at the top)?

    0 0

    Is it possible to make URL address a shortcode parameter?

    let's say I have a shortcode [shops city="<--here goes parameter from URL"]


    0 0

    Hi Friends..,

    Here i paste my simple contact form code with form validation function... now i just add file uploading option in my form... but i don't know ... how to write the function for that option in this form.. Please guide me.... I am new for php.. Thank you to all

    Template Name: Contact
    //If the form is submitted
    $subject = trim($_POST['subject']);
    $comments = trim($_POST['message']);
    	//Check to make sure that the name field is not empty
    	if(trim($_POST['contactname']) == '') {
    		$hasError = true;
    	} else {
    		$name = trim($_POST['contactname']);
    	//Check to make sure sure that a valid email address is submitted
    	if(trim($_POST['email']) == '')  {
    		$hasError = true;
    	} else if (!preg_match("/^<a href="">:alnum:</a>[a-z0-9_.-]*@[a-z0-9.-]+\.[a-z]{2,4}$/i", trim($_POST['email']))) {
    		$hasError = true;
    	} else {
    		$email = trim($_POST['email']);
    	//If there is no error, send the email
    	if(!isset($hasError)) {
            $emailTo =  '';//Put your own email address here
            $body = "Name: $name \n\nEmail: $email \n\nSubject: $subject \n\nComments:$comments";
            $headers = 'From: Neugen Site <'.$emailTo.'>' . "\r\n" . 'Reply-To: ' . $email;  
            mail($emailTo, $subject, $body, $headers);
            $emailSent = true;
    <?php get_header(); ?>
     <div id="banner">
     <div id="mast">
    <ul class="images">
    <li><img src="" alt="Aria MindShare1"></img></li>
    <div class="headertext">
    <pre>    YOUR GROWTH
        IS OUR PROMISE.</pre>
    <pre class="p1" >      As discussed the whole idea of Neugen is to
          trade the products from manufacturers and
          be a commission agent or a facilitator. We
          have made tie-ups with many multiple
          companies from various backgrounds.
    	  <a href=""> Read More</a></div>
    <div id="center">
    <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
    <div id="contactform">
    <p> Please enter your comments here </p>
    <form method="post" action="<?php the_permalink(); ?>" id="form">
    	<input type="text" name="contactname" value=""  placeholder="Name"  pattern="[-A-Z-a-z]+" required/>
    	<input type="email" name="email" value="" placeholder="Email" required/>
    	<input type="text" name="subject" value="" placeholder="Subject" />
            <input type="file" name="file" id="file" Value="" placeholder="File Upload"/></br>
    	<textarea rows="8" name="message" placeholder="Message"></textarea>
    	<input type="submit" value="Send" name="submit" id="button1" title="Click here" />
    		<?php if(isset($hasError)) { //If errors are found ?>
    			<p class="error">Please check if you've filled all the fields with valid information and try again. Thank you.</p>
    		<?php } ?>
    		<?php if(isset($emailSent) && $emailSent == true) { //If email is sent ?>
    			<div class="success">
    				<p></strong><strong>Email Successfully Sent!</strong></p>
    		<?php } ?>
    <?php endwhile; ?>
    <?php endif; ?>
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>

    0 0

    Hello, I am new to wordpress and find a problem when trying to display some part of a post/ page to non registered users only and hide it for all registered/ logged in users.

    I get a fatal error message like this:

    Fatal error: Call to undefined function is_user_logged_out() in /home4/username/public_html/

    My question is what is the opposite of is_user_logged_in() ?


    0 0

    I'm looking to create a plugin that when a link is clicked (with a PostID), it will open the screen ala Ajax style to create ( or edit an existing ) post.

    And upon clicking publish / schedule, it will return to the previous screen.

    I don't recall any plugins that do this for an example... my Ajax skills are mediocre at best, so any pointers in that direction would be greatly appreciated.

    0 0

    Hello everyone,

    Instead of doing something like this...

    function remove_taxonomy_boxes() {
                remove_meta_box('categorydiv', 'post', 'side');
        add_action( 'admin_menu' , 'remove_taxonomy_boxes' );

    Is it possible to do something more like this?

    function remove_taxonomy_boxes($box_id, $page, $context) {
                remove_meta_box($box_id, $page, $context);
        add_action( 'admin_menu' , 'remove_taxonomy_boxes', 10, 3 );
        do_action( 'admin_menu', 'categorydiv', 'post', 'side');

    I understand the second code example is incorrect, but the idea is what I'm trying to do. I want to try and make my code a little more reusable instead of having to write the first code example's custom function with hard coded values for every case I want. Maybe there is an entirely different approach?

    I found this thread, it's closed though and not quite what I'm looking for.

    Many thanks!

    0 0

    I'm having what I believe to be a redirect issue.

    On our site, I've used the Types plugin to create a custom post type called "Conversations" connected with a custom taxonomy: "Topics."

    I want to allow users to post to the "Conversations" post-type through a front-end post-box, and I'm using the code from this site to make that work.

    I also have this plugin activated, allowing me to make the landing page for this post-type, and the taxonomy landing page for each term in the custom taxonomy.

    The post box for my front end posting shows in the appropriate places, and when I attempt to post here are the results:

    1. The post is successfully entered into the system, using the appropriate taxonomy.
    2. I am redirected to what seems to be the same page I was already on (the taxonomy term landing page), but the post is not listed in the loop (although it is in the system).
    3. The admin bar disappears.

    According to the script I'm using, it should redirect to the new post that was created.

    Do I have conflicting redirects or rewrites?
    Any ideas about what might be sending me in the wrong direction?

    0 0

    Hi all,

    I'm currently building a custom widget similar to the WP_Recent_Posts and I'm wondering if there's a way to return the content of a post in the widget area?

    I can figure out how to get the title, date, category, ID, pretty much everything but the content.

    The idea here is that I have a category of posts that are simply images that I would like to display in my sidebar, but will be accessible by the editors of my site.
    A simple way of doing this seems to be making a widget that will return the most recent post in a certain category, but for this to work properly, I need it to display the image attached to the post

    I would be very grateful for any help y'all can give :)

    0 0


    I am looking to create an image hover that displays information that is stored from WooCommerce (like price and product name). Here is an example of exactly what I am looking for: (When you roll over the images the price and

    Is there a bit of javascript that could retrieve that information and display when the image is hovered? I know how to change opacity in CSS, but I am lost as how to retrieve that information that I enter for each product in WooCommerce. Any help is greatly appreciated!



    0 0

    Hi commnunity!

    In my WordPress backend I have some custom posts and, in one of them, I want to display in a dropdown field some posts related with but ordered by post type. I want to display something like this.

    <select multiple="multiple" style="height:200px; width:300px"> <optgroup label="Productos"> <option>Producto 1</option> <option>Producto 2</option> <option>Producto 3</option> <option>Producto 4</option> <option>Producto 5</option> <option>Producto 6</option> </optgroup> <optgroup label="Paso 1"> <option>Subpagina 1</option> <option>Subpagina 2</option> <option>Subpagina 3</option> </optgroup> </optgroup> <optgroup label="Paso 2"> <option>Subpagina 1</option> <option>Subpagina 2</option> <option>Subpagina 3</option> </optgroup> </optgroup> <optgroup label="Paso 3"> <option>Subpagina 1</option> <option>Subpagina 2</option> <option>Subpagina 3</option> </optgroup> </select>

    Here is the code that displays all of posts that I want but without order. I figure out that I have to use the id of the custom post type but I do not how to, any idea?

    Note: I`ll like to save more than one post at the same time.

    // Add the Meta Box  
    function add_custom_meta_box_related() {
            'custom_meta_box_related', // $id
            'Related Information', // $title
            'show_custom_meta_box_related', // $callback
            'related', // $page
            'normal', // $context
            'high'); // $priority
    add_action('add_meta_boxes', 'add_custom_meta_box_related');
        // Field Array
        $prefix_related = 'custom_';
        $custom_meta_fields_related = array(  
    			'label' => 'Related Items',
    			'desc' => 'Select a related item(s)',
    			'id'    =>  $prefix_materiales.'post_id',
    			'type' => 'post_list',
    			'post_type' => array('products','paso1','paso2','paso3','paso4','compra'),
    	// The Callback
    function show_custom_meta_box_related() {
    global $custom_meta_fields_related, $post;
    // Use nonce for verification
    echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';  
        // Begin the field table and loop
        echo '<table class="form-table">';
        foreach ($custom_meta_fields_related as $field_related) {
            // get value of this field if it exists for this post
            $meta_related = get_post_meta($post->ID, $field_related['id'], true);
            // begin a table row with
            echo '<tr>
                    <th><label for="'.$field_related['id'].'">'.$field_related['label'].'</label></th>
                    switch($field_related['type']) {
                        // case items will go here 
    					// post_list
    					case 'post_list':
    					$items = get_posts( array (
    						'post_type' => $field_related['post_type'],
    						'posts_per_page' => -1
    					echo '<select multiple name="'.$field_related['id'].'" id="'.$field_related['id'].'">
    					<option value="">Select One or more</option>'; // Select One
    					foreach($items as $item) {
    						echo '<option value="'.$item->ID.'"',$meta_related == $item->ID ? ' selected="selected"' : '','> '.$item->post_title.'</option>';
    					} // end foreach
    					echo '</select><br /><span class="description">'.$field_related['desc'].'</span>';
                    } //end switch
            echo '</td></tr>';
        } // end foreach
        echo '</table>'; // end table
    // Save the Data
    function save_custom_meta_related($post_id) {
        global $custom_meta_fields_related;  
        // verify nonce
        if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))
            return $post_id;
        // check autosave
        if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
            return $post_id;
        // check permissions
        if ('page' == $_POST['post_type']) {
            if (!current_user_can('edit_page', $post_id))
                return $post_id;
            } elseif (!current_user_can('edit_post', $post_id)) {
                return $post_id;
        // loop through fields and save the data
        foreach ($custom_meta_fields_related as $field_related) {
            $old = get_post_meta($post_id, $field_related['id'], true);
            $new = $_POST[$field_related['id']];
            if ($new && $new != $old) {
                update_post_meta($post_id, $field_related['id'], $new);
            } elseif ('' == $new && $old) {
                delete_post_meta($post_id, $field_related['id'], $old);
        } // end foreach
    add_action('save_post', 'save_custom_meta_related');

    Thanks in advance

    0 0


    I'm using social sharing toolkit inside my loop like this:

    $social_sharing_toolkit = new MR_Social_Sharing_Toolkit();
    echo $social_sharing_toolkit->create_bookmarks(get_permalink( $post->ID ), get_the_title( $post->ID ), '');

    The problem Is that when I'm trying to share the post, preview for sharing shows only the title and the link of the post (which is good because I'm passing that arguments to the function), but not the excerpt from the post.

    The texts is taken from meta description of the site. Do you know how to alter the social sharing toolkit, or what argument to pass to the function so the text that shares is related to the post?

(Page 1) | 2 | 3 | .... | 413 | newer