How to manually add an item to a submenu in a menu generated by wp_nav_menu?

Hey. I've been trying to figure this out for a long time but can't seem to crack it. I have created a menu using Wordpress 3 menu editor and it's all fine and working. But I want to manually add an item (or few) to a submenu so that the item will only show up in the submenu if logged in user is admin (can add_users). How can I achieve this? I already came up with a solution of having two separate menus for another purpose. But that is not what I want in this case. Say I have a menu called "Archives" It has a submenu with items "One" "Two" "Three". This I have built using the Wordpress menu system. Now I want to manually add a new item to the Archives menu, let's call it "Four" but I only want this to appear in the menu when a user is logged in and is admin. @MikeSchinkel - still haven't figured this one out... if you know, could you help me out? Thanks!


Loading Scripts on Specific Pages

In child theme I created a functions.php file that loads scripts and style files, the code is below. The section that loads libraries and scripts to all pages other than admin, in other words the first two functions, works as expected. However, the third function, which is designed to load a script for a specific page does not load. It appears that my problem has to do with specifying the page condition. The rest of the code for register and enqueue works if it is placed in the general function that loads scripts for any page other than admin pages. I've researched this can can't find any examples showing why the approach I've used is not working. I've swapped the page id with the name of the page but to no avail. Any suggestion on the source of the problem would be much appreciated. Thanks.                   <?php          function scripts () {         if ( !is_admin() ) {              wp_enqueue_script('jquery');             wp_register_script('jqueryUI', "path", array('jquery')); //register custom UI library             wp_enqueue_script('jqueryUI');             wp_register_script('popUp1', ("path"), array('jquery', 'jqueryUI'));             wp_enqueue_script('popUp1');             wp_register_script('popUpText', 'path', array('jquery', 'jqueryUI'));             wp_enqueue_script('popUpText');         }     }          add_action('init', 'scripts');          //INSERT CSS    files into the header     function styles () {         if ( !is_admin() ) {             wp_register_style('jqueryUIcss', "path");             wp_enqueue_style('jqueryUIcss');             wp_register_style('valuecss', "path");             wp_enqueue_style('valuecss');         }     }            add_action('init', 'styles');          //Add scripts for pop ups on "how to estimate value" page     function pagePopUps1 () {         if ( is_page(16)) {              wp_register_script('popUpVideo1', "path", array('jquery', 'jqueryUI'));             wp_enqueue_script('popUpVideo1');              }     }          add_action('init', 'pagePopUps1');                      //End of file     ?>      Note for the sake of brevity I removed the src's but these have been validated and are not the source of the problem.


wp_insert_post - duration

i try to import a custom DB to the WP DB with about 2000 rows (custom post type). the problem is that the insert by `wp_insert_post` takes about a second per insert. Is this normal ? Is there a fast/alternative solution... I think that a insert query should not take over some milliseconds. **Edit** its a remote server and both databases are on it. the queries are in quite normal speed (already tested), just the inserting is the problem. Need some code ? Ask in comments.. thanks guys.


Rename image uploads replacing "width" and "height" in filename with "medium", "large", "small"

Good morning, I am trying to change name format that Wordpress uses to rename uploaded files. As I upload an image whose filename is "desert-landscape.jpg", Wordpress will set up scaled versions and rename filenames to different combinations of "desert-landscape-{WIDTHxHEIGHT}.jpg" (dipending on thumbnail sizes). Is there a way to remove width & height attribute from filename and replace them by "{medium}-desert-landscape.jpg", "{large}-desert-landscape.jpg" and "{small}-desert-landscape.jpg"? Have been looking at this post Rename image uploads with width in filename me not able to fix it right way. Thank you               // The filter runs when resizing an image to make a thumbnail or intermediate size.     add_filter( 'image_make_intermediate_size', 'rename_intermediates_wpse_82193' );          function rename_intermediates_wpse_82193( $image )      {         // Split the $image path into directory/extension/name         $info = pathinfo($image);         $dir = $info['dirname'] . '/';         $ext = '.' . $info['extension'];         $name = wp_basename( $image, "$ext" );              // Build our new image name         $name_prefix = substr( $name, 0, strrpos( $name, '-' ) );         $size_extension = substr( $name, strrpos( $name, '-' ) + 1 );         $new_name = $dir . $size_extension . '-' . $name_prefix . $ext;              // Rename the intermediate size         $did_it = rename( $image, $new_name );              // Renaming successful, return new name         if( $did_it )             return $new_name;              return $image;     }


Next Post Link in format

I'm after a wordpress function that can give me the link to the next post with the same format as the current post. I've been looking and struggling to find one. I expected to find an option similar to the `in_same_cat` option from the `next/prev_post_link` function. Anyone know of one I don't or have other options on how to achieve this? Thanks.


add comments custom fields after user is logged in

I want to add two custom fields inside comments on a CPT after the user is logged in on. This is the code for creating the custom fields:               function debate_comment_fields( $fields ) {          if( is_singluar('debate') ) {                   /* Add our custom fields */         $fields['first'] = '
' .                           __( 'Age' ) .                           '' .                           '<input id="first" name="category" type="radio" value="'.get_post_meta($post->ID, 'agree', true).'" />
';                   $fields['second'] = '
' .                             __( 'Town' ) .                             '' .                           '<input id="second" name="category" type="radio" value="'.get_post_meta($post->ID, 'disagree', true).'" />
';              return $fields;          }          }          add_filter('comment_form_default_fields','debate_comment_fields');      LATER EDIT: some relevant code from my theme comments.php file:               // Don't output the comment form if CPT and user isn't logged in     if ( 'debate' != get_post_type() || is_user_logged_in() ) {     comment_form( $args );     }     ?>      The current code adds the fields when the user is not logged in, and I want to add them after the user is logged in. How can I do this ?


Custom template pagination

I have a custom post type "news". I created the page "News" with the id 55 and a custom template file. I want to implement pagination. The problem is when I access the news with a page number set I get an error "404 not found". URL looks like this "/news/page/2/". I use `paginate_links` function to display pagination. How to display the correct page?


how to show single post in a custom template

hi i used the below code to list out the posts in a particular category.
                         <?php if ( have_posts() ) :                                   ?>                         <?php query_posts('category_name=services&showposts=5'); ?>             <?php while ( have_posts() ) : the_post(); ?>                        <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>

<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_post_thumbnail(); ?><?php echo '  '; the_title(); ?>

            <?php the_excerpt();?>

             <?php endwhile; ?>                     <?php endif; ?>      it works fine. but now when i click on the excerpt read more link the post shows in a unordered template. i need to show them as like the subpages are showing. i have a subpage template file. how can i use that file for displaying single posts??


How to change to local video player on shortcode ultimate to video.js?

I have Shortcodes Ultimate plugin, and I would like to change this plugin video player to Video.js player.   That's becouse, the original player is very afful, and instabil, and you can't control volume, can't replay the video,so this player very insufficient.   I can't use the original wordpress player,becouse the plugin use the same short code as the wordpress short code and this do a little conflict.   Example for the plugin shortcode:               [video url="http://www.neocsatblog.mblx.hu/wp-content/uploads/2013/10/Cas-és-a-sex.mp4" poster="http://www.neocsatblog.mblx.hu/wp-content/uploads/2013/10/not-bad.png" title="Castiel találkozása a szex-el"]      I can't delete this plugin,becouse I use some usefull function in here.   So the bestway be if I can change the video player to Video.js player.


How to hook in to the "output buffer" and add html content

I want to be able to hook into the output buffer flow and add some conditional content to my WP pages. What I want to do is test cookies and display a semi-transparent screen with a content box based on a cookies' condition. I know how to construct the html and css to make this happen. I know how write the php to test cookies. What I don't know is what `add_filter()` or what `add_action()` to use to make this hook in my `functions.php` file. Can anyone provide direction or point me to the codex? I am just not sure what search arguments to use when I look at the codex. Thanks **AMENDED** Here is what I want to accomplish: I want the following to be added to each and every page on my site, regardless whether the page exists today. If I add a new page in the future, I want this to appear as well. (I wil handle all styling and positioning, etc. myself).
something to display


js Conflict in admin panel - I guess it's from the core WP installation

A client's site: causing serious js conflict or js loading disabilities, is under custody. Activating DEBUG, Deactivating all Plugins, and Activating Default theme "T13" found that, still the problem resides. The DEBUG is totally fine - no disabilities or mis-functionalities. It was in an Old WP version, I updated everything - so now it's all UPDATED. (WP version 3.6.1 as on today) **Symptoms**     * Can't add/edit any post/page content -- isn't loading the default editor, can't even switch to the HTML mode, because tab's not working   * The sub menus are not opening on hover, suppose I want to go to the Widgets page, then I need to click on the Appearance link then to the Widgets link. Hover is not working there.   * Tabs are not working - tried Skitter slide show in an instant, can't configure it from back-end because it's not functioning with its tabs. The client's site is an Online Newspaper site and have many news - the database size is huge. If I take the theme and install a new fresh WordPress then:   * What would I do with the old database? How can I import all the posts etc. into the new installation of WordPress so that I get them nicely work with the new WP installation? -- is simply a WordPress Import (Tools » Import) can solve the problem or can it cause much greater problems? Otherwise,   * How can I resolve the js conflict or js loading disabilities in wp-admin?


Add term for custom taxonomy from front end

I'm having problems trying to create a custom type post with taxonomies using a form at the Front End. I have tried to add several lines of code and use 'tax_input' but I always get errors. The custom post type is: `pet` and the taxonomies are `pet-category` and `pet- city`. This code is working fine but is only posting the title, and the content. Please if somebody could tell me what I need to add in order to also post this two taxonomies wold be appreciated. but I have tried and tried without success,               <?php /* Template Name: Insert Posts */          $postTitleError = '';          if(isset($_POST['submitted']) && isset($_POST['post_nonce_field']) && wp_verify_nonce($_POST['post_nonce_field'], 'post_nonce')) {          $postTitle = trim($_POST['postTitle']);          $new_post = array(     'post_title' => wp_strip_all_tags( $_POST['postTitle'] ),     'post_content' => $_POST['postContent'],     'post_type' => 'pet',     'post_status' => 'publish'          );          $post_id = wp_insert_post($new_post,$wperror);          if($post_id)     {          // Update Custom Meta     update_post_meta($post_id, 'vsip_custom_one', esc_attr(strip_tags($_POST['customMetaOne'])));     update_post_meta($post_id, 'vsip_custom_two', esc_attr(strip_tags($_POST['customMetaTwo'])));          // Redirect     wp_redirect( home_url() ); exit;     }          } ?>          <?php get_header(); ?>
     <form action="" id="primaryPostForm" method="POST">          <fieldset>     <?php _e('Post\'s Title:', 'framework') ?>     <input type="text" name="postTitle" id="postTitle" value="<?php if(isset($_POST['postTitle'])) echo $_POST['postTitle'];?>" class="required" />     </fieldset>          <?php if($postTitleError != '') { ?>     <?php echo $postTitleError; ?>

     <?php } ?>               <fieldset>     <?php _e('Post\'s Content:', 'framework') ?>     <textarea name="postContent" id="postContent" rows="8" cols="30"><?php if(isset($_POST['description'])) { if(function_exists('stripslashes')) { echo stripslashes($_POST['description']); } else { echo $_POST['description']; } } ?></textarea>     </fieldset>
     Categoria: *     <select name="pet_category" id="pet_category" tabindex="9" class="required">     <option value=""></option>     <?php     $categories = get_terms('pet-category', array('hide_empty' => 0));     foreach ($categories as $category) {     echo "<option id='pet_category' value='$category->slug'>$category->name</option>";     }     ?>     </select>

     City: *     <select name="pet_city" id="pet_city" tabindex="9" class="required">     <option value=""></option>     <?php     $cities = get_terms('pet-city', array('hide_empty' => 0));     foreach ($cities as $city) {     echo "<option id='pet_city' value='$city->slug'>$city->name</option>";     }     ?>     </select>
               <fieldset name="site-image" class="site-image">     <input type="file" name="image" class="file_input_hidden site-image file_upload" onchange="javascript: document.getElementById('fileName').value = this.value;" />
Al menos de 200 de ancho x 200 de alto     </fieldset>                <fieldset>     <?php wp_nonce_field('post_nonce', 'post_nonce_field'); ?>     <input type="hidden" name="submitted" id="submitted" value="true" />     <button type="submit"><?php _e('Add Post', 'framework') ?></button>     </fieldset>     </form>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>


Make theme translatable for WPML

I have been really hard time to get my site translated.   I have MO and PO files, but my theme is not compatible with WPML and the developer team doesn't to change it. Therefore I may have to build a plugin or compatibility coding by myself. But I can't really find how to do and what I need to do. Does anybody know how to do? Or any tutorial for it? I can't really find WMPL site as well.


Sessions in plugin development?

I'm developing a plugin. At present I have two files. **dotmailer.php** and **dotmailer-add.php**. I'm creating a newsletter widget. My `dotmailer.php` plugin adds an admin menu, with options. It allows the admin to store an email address which is used as authentication for the API I'm using. This is taken from the options page form and stored as such:               $apiemail = get_option('apiemail');      I've also created a widget, this is the front-facing bit. The user inputs their email in the form and the form POSTs to a new file called **dotmailer- add.php**. So this file has the variable `$useremail` taken from the form. Now I'm stuck, because I need the var `$useremail` to be useable witin dotmailer-add.php. There is no way to send this through a form or anything because the form already posts through to the wordpress **options.php** file. I know when working with PHP sessions are often used to store variables that are needed across multiple files. My issue is that the admin will not be submitting the API emal to the Wordpress options page every time they log in, so they won't be starting a new session each time. I need the var `$useremail` to be available across all my plugin files at all times. I tried using `include` but unfortunately I get whitescreened with no errors (error messages are on). **How can I set a global variable through Wordpress options and have it available across multiple files within a plugin?**


Category Ajax Chain Selects - search results

Hello, I have a problem with my custom taxonomy and plugin Category Ajax Chain Selects... When I select a region, country, appeals etc. and push the submit button I got "page not found" and that takes me to the main page - `index.php`. PS: I set my permalink to `/%category%/%postname%/`   My site is here


How to modify an add_action() inside a loop of core function

Ok I want to edit bp_core_screen_signup() is which is a function of buddypress that used to process the registration form. Basically this funtion checks for any errors produced and then loops through them using add_action() to inject them into register.php. Well I need to change the html tags it's using and I don't understand how. So first here is this big nasty function.               function bp_core_screen_signup() {     global $bp;          if ( !bp_is_current_component( 'register' ) )         return;          // Not a directory     bp_update_is_directory( false, 'register' );          // If the user is logged in, redirect away from here     if ( is_user_logged_in() ) {         if ( bp_is_component_front_page( 'register' ) )             $redirect_to = trailingslashit( bp_get_root_domain() . '/' . bp_get_members_root_slug() );         else             $redirect_to = bp_get_root_domain();              bp_core_redirect( apply_filters( 'bp_loggedin_register_page_redirect_to', $redirect_to ) );              return;     }          $bp->signup->step = 'request-details';          if ( !bp_get_signup_allowed() ) {         $bp->signup->step = 'registration-disabled';          // If the signup page is submitted, validate and save     } elseif ( isset( $_POST['signup_submit'] ) && bp_verify_nonce_request( 'bp_new_signup' ) ) {              do_action( 'bp_signup_pre_validate' );              // Check the base account details for problems         $account_details = bp_core_validate_user_signup( $_POST['signup_username'], $_POST['signup_email'] );              // If there are errors with account details, set them for display         if ( !empty( $account_details['errors']->errors['user_name'] ) )             $bp->signup->errors['signup_username'] = $account_details['errors']->errors['user_name'][0];              if ( !empty( $account_details['errors']->errors['user_email'] ) )             $bp->signup->errors['signup_email'] = $account_details['errors']->errors['user_email'][0];              // Check that both password fields are filled in         if ( empty( $_POST['signup_password'] ) || empty( $_POST['signup_password_confirm'] ) )             $bp->signup->errors['signup_password'] = __( 'Please make sure you enter your password twice', 'buddypress' );              // Check that the passwords match         if ( ( !empty( $_POST['signup_password'] ) && !empty( $_POST['signup_password_confirm'] ) ) && $_POST['signup_password'] != $_POST['signup_password_confirm'] )             $bp->signup->errors['signup_password'] = __( 'The passwords you entered do not match.', 'buddypress' );              $bp->signup->username = $_POST['signup_username'];         $bp->signup->email = $_POST['signup_email'];              // Now we've checked account details, we can check profile information         if ( bp_is_active( 'xprofile' ) ) {                  // Make sure hidden field is passed and populated             if ( isset( $_POST['signup_profile_field_ids'] ) && !empty( $_POST['signup_profile_field_ids'] ) ) {                      // Let's compact any profile field info into an array                 $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );                      // Loop through the posted fields formatting any datebox values then validate the field                 foreach ( (array) $profile_field_ids as $field_id ) {                     if ( !isset( $_POST['field_' . $field_id] ) ) {                         if ( !empty( $_POST['field_' . $field_id . '_day'] ) && !empty( $_POST['field_' . $field_id . '_month'] ) && !empty( $_POST['field_' . $field_id . '_year'] ) )                             $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $_POST['field_' . $field_id . '_day'] . $_POST['field_' . $field_id . '_month'] . $_POST['field_' . $field_id . '_year'] ) );                     }                          // Create errors for required fields without values                     if ( xprofile_check_is_required_field( $field_id ) && empty( $_POST['field_' . $field_id] ) )                         $bp->signup->errors['field_' . $field_id] = __( 'This is a required field', 'buddypress' );                 }                  // This situation doesn't naturally occur so bounce to website root             } else {                 bp_core_redirect( bp_get_root_domain() );             }         }              // Finally, let's check the blog details, if the user wants a blog and blog creation is enabled         if ( isset( $_POST['signup_with_blog'] ) ) {             $active_signup = $bp->site_options['registration'];                  if ( 'blog' == $active_signup || 'all' == $active_signup ) {                 $blog_details = bp_core_validate_blog_signup( $_POST['signup_blog_url'], $_POST['signup_blog_title'] );                      // If there are errors with blog details, set them for display                 if ( !empty( $blog_details['errors']->errors['blogname'] ) )                     $bp->signup->errors['signup_blog_url'] = $blog_details['errors']->errors['blogname'][0];                      if ( !empty( $blog_details['errors']->errors['blog_title'] ) )                     $bp->signup->errors['signup_blog_title'] = $blog_details['errors']->errors['blog_title'][0];             }         }              do_action( 'bp_signup_validate' );              // Add any errors to the action for the field in the template for display.         if ( !empty( $bp->signup->errors ) ) {             foreach ( (array) $bp->signup->errors as $fieldname => $error_message ) {                 // addslashes() and stripslashes() to avoid create_function()                 // syntax errors when the $error_message contains quotes                 add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "
" . stripslashes( \'' . addslashes( $error_message ) . '\' ) . "
" );' ) );             }         } else {             $bp->signup->step = 'save-details';                  // No errors! Let's register those deets.             $active_signup = !empty( $bp->site_options['registration'] ) ? $bp->site_options['registration'] : '';                  if ( 'none' != $active_signup ) {                      // Make sure the extended profiles module is enabled                 if ( bp_is_active( 'xprofile' ) ) {                     // Let's compact any profile field info into usermeta                     $profile_field_ids = explode( ',', $_POST['signup_profile_field_ids'] );                          // Loop through the posted fields formatting any datebox values then add to usermeta - @todo This logic should be shared with the same in xprofile_screen_edit_profile()                     foreach ( (array) $profile_field_ids as $field_id ) {                         if ( ! isset( $_POST['field_' . $field_id] ) ) {                                  if ( ! empty( $_POST['field_' . $field_id . '_day'] ) && ! empty( $_POST['field_' . $field_id . '_month'] ) && ! empty( $_POST['field_' . $field_id . '_year'] ) ) {                                 // Concatenate the values                                 $date_value = $_POST['field_' . $field_id . '_day'] . ' ' . $_POST['field_' . $field_id . '_month'] . ' ' . $_POST['field_' . $field_id . '_year'];                                      // Turn the concatenated value into a timestamp                                 $_POST['field_' . $field_id] = date( 'Y-m-d H:i:s', strtotime( $date_value ) );                             }                         }                              if ( !empty( $_POST['field_' . $field_id] ) )                             $usermeta['field_' . $field_id] = $_POST['field_' . $field_id];                              if ( !empty( $_POST['field_' . $field_id . '_visibility'] ) )                             $usermeta['field_' . $field_id . '_visibility'] = $_POST['field_' . $field_id . '_visibility'];                     }                          // Store the profile field ID's in usermeta                     $usermeta['profile_field_ids'] = $_POST['signup_profile_field_ids'];                 }                      // Hash and store the password                 $usermeta['password'] = wp_hash_password( $_POST['signup_password'] );                      // If the user decided to create a blog, save those details to usermeta                 if ( 'blog' == $active_signup || 'all' == $active_signup )                     $usermeta['public'] = ( isset( $_POST['signup_blog_privacy'] ) && 'public' == $_POST['signup_blog_privacy'] ) ? true : false;                      $usermeta = apply_filters( 'bp_signup_usermeta', $usermeta );                      // Finally, sign up the user and/or blog                 if ( isset( $_POST['signup_with_blog'] ) && is_multisite() )                     $wp_user_id = bp_core_signup_blog( $blog_details['domain'], $blog_details['path'], $blog_details['blog_title'], $_POST['signup_username'], $_POST['signup_email'], $usermeta );                 else                     $wp_user_id = bp_core_signup_user( $_POST['signup_username'], $_POST['signup_password'], $_POST['signup_email'], $usermeta );                      if ( is_wp_error( $wp_user_id ) ) {                     $bp->signup->step = 'request-details';                     bp_core_add_message( $wp_user_id->get_error_message(), 'error' );                 } else {                     $bp->signup->step = 'completed-confirmation';                 }             }                  do_action( 'bp_complete_signup' );         }          }          do_action( 'bp_core_screen_signup' );     bp_core_load_template( apply_filters( 'bp_core_template_register', array( 'register', 'registration/register' ) ) );     }     add_action( 'bp_screens', 'bp_core_screen_signup' );      Now on line 98 you'll see.. // Add any errors to the action for the field in the template for display. Then it loops through the errors and you come to..               add_action( 'bp_' . $fieldname . '_errors', create_function( '', 'echo apply_filters(\'bp_members_signup_error_message\', "
" . stripslashes( \'' . addslashes( $error_message ) . '\' ) . "
" );' ) );      I need to edit those html tags in my bp-custom.php file without reproducing the entire function. How do I hook in correctly to do this?


How to get author ID when an author page is being viewed?

I'm having problems getting the author ID in my plugin's `init()` method. I've hooked `init()` to `wp`:               public function __construct() {         add_action( 'wp', array( $this, 'init' ) );     }      My `init()` method:               public function init() {         // Get the author ID if the author page is being viewed.         if ( is_author() ) {             $author = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );         }         // I want to be able to do $author->ID here but I get a debug notice.     }      I'm getting the debug notice "Trying to get property of non-object". I suspect this is because the following statement hasn't worked:               $author = ( get_query_var( 'author_name' ) ) ? get_user_by( 'slug', get_query_var( 'author_name' ) ) : get_userdata( get_query_var( 'author' ) );      Inside `init()`, how can I get the author ID when an author page is being viewed? **Update:** As pointed out by TheDeadMedic, I should be hooking to `wp` instead of `plugins_loaded`. That doesn't solve the problem though. `$author` remains a 'non-object'


Updated/Tagged/Stable-Tag'ed plugin does not up in wordpress plugin repository

I have a plugin (http://wordpress.org/plugins/scoutnet-kalender) and I update it quite a few times from 0.2.0 (0.2.1, 0.2.2, 0.2.3 ...) to the new major release 1.0.1. I previously did this like decribed in http://wordpress.org/plugins/about/svn/#task-3; updating the "Stable tag:" in readme.txt (locally in my TRUNK folder), commited that and tagged a new release to the TAGS folder (tortoiseSVN makes this very easy). As soon as I update my local plugin folder, the new release is downloaded and shows up as expected. Now the strange part: The plugin directory (as you can check on the plugins' website) still shows 0.2.1 as the newest release (from a long time ago). If I use WP to install the plugin, I get the code of 0.2.2 (?) and the readme file with the changes of 0.2.5 (?!?). Interestingly the 'Compatibility' dropdown on the plugin page (bottom right) show _all_ tagged releases correctly (as "other versions"), but the old 0.2.1 as "current". What did I do wrong? And more important: How do I clean up this mess? :-)


how to reorder the content of the single post?

actually i install "related post" plugin. and i use               <?php the_content(''); ?>      to show up my single post in single.php file . so when i want to add the writer name after the post i write this               <?php the_content(''); ?>     <?php the_author(); ?>      but the writer name or the author is showing after the related posts ... i don't want that !! i want to put the author name after the last word in this post. so is there a way to do this ,or to have an array of "the_content" to reorder the inter content. here is my code                       <?php while ( have_posts() ) : the_post(); ?>

                  <a href="<?php the_permalink(); ?>" title="<?php the_title();?>">  <?php the_post_thumbnail(); ?>
             <?php the_content(); ?>
بقلم :  <?php the_author(); ?>

             <?php endwhile; ?><?php comments_template('',true); ?>      even if i use the add_filter in the functions.php or try to combine them by `echo` is do the same thing ... any help ?


Add a custom left and right eyes filter in woocommerce?

I using wordpress 3.9.2 and woocomerce 2.11. I need at achieve something like this http://www.specsavers.com.au/contact-lenses/monthly-disposables/air-optix-aqua Here user can purchase either left eyes lenses or right eye or both based on the choice he selects. How can i do this in woocommerce? Any suggestions would be appeciated!!!!


How to hide 'Home' button from appearing on supages - twenty eleven theme

How could I make it so the ' _Home_ ' button / text link doesn't appear in the top menu as the user navigates to a subpage?? _(So the menu stays the same accross)_


How to notify users of blog updates a la Admin Plugin Update notifications?

What I would like to do is mimic how Wordpress shows an administrator how many new updates there are for installed plugins (a tiny number displayed next to a link). The main difference is that I want to serve this info to a logged-in user on the front end (since they last visited):   * new messages they've received (Buddypress)    * new forum posts (Buddypress)    * new posts for "favorited" categories Not sure where to find the code that provides plugin update notices but that would be a start...


Client system for media review?

I'm looking for a plugin, or a system, for wordpress, that would allow a client to login and see the graphic designs, video, documents, etc... that i'm currently producing for them, and allow them to leave comments. Is there anything like this out there?


add_rewrite_rule and custom variable

I have been wanting to do something similar like this for a long time. I have a url http://studionumberone.com/portfolio/obey-clothing/ which just shows the jquery gallery of images, I then have studionumberone.com/portfolio/obey- clothing/?view=all. Which shows all of the images in the gallery one above each other. I would like the url to be studionumberone.com/portfolio/obey-clothing/all The custom post type just does a basic:               <?php get_header();      $view = $_GET['view'];     ?>     <?php if ($view == "all") { ?>     show all images     <?php } else { ?>     show gallery shortcode      <?php } ?>     <?php get_footer(); ?>      I have tried (no luck):               add_action( 'init', 'ss_permalinks' );     function ss_permalinks() {         add_rewrite_rule(             '([^/]+)/all/?',             'index.php?view=all&service=$matches[1]',             'top'     );     }     add_filter( 'query_vars', 'ss_query_vars' );     function ss_query_vars( $query_vars ) {         $query_vars[] = 'view';         return $query_vars;     }


Unable to use custom taxonomy with front end post form

I have a front-end posting form configured for a custom post type. By using the form I am able to send the title, content, and image attachments without a hitch, but my custom taxonomy selection doesn't register. I've patched this functionality using various bits of code I have found and I'm not sure exactly what I screwed up. add-new-listing.php               if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_post") {              // Do some minor form validation to make sure there is content         if (isset ($_POST['title'])) {             $title =  $_POST['title'];         } else {             echo 'Please enter the listing name';         }         if (isset ($_POST['description'])) {             $description = $_POST['description'];         } else {             echo 'Please enter a description';         }              $tags = $_POST['post_tags'];              // ADD THE FORM INPUT TO $new_post ARRAY         $new_post = array(         'post_title'    =>  $title,         'post_content'  =>  $description,         'post_category' =>  array($_POST['booru_locations']),  // Usable for custom taxonomies too         'post_image'    => $newupload,         'post_status'   =>  'publish',           // Choose: publish, preview, future, draft, etc.         'post_type' =>  'booru_directory'  //'post',page' or use a custom post type if you want to         );              //SAVE THE POST         $pid = wp_insert_post($new_post);                   //REDIRECT TO THE NEW POST ON SAVE         $link = get_permalink( $pid );         wp_redirect( $link );          //INSERT OUR MEDIA ATTACHMENTS     if ($_FILES) {     foreach ($_FILES as $file => $array) {     $newupload = insert_attachment($file,$pid);     // $newupload returns the attachment id of the file that     // was just uploaded. Do whatever you want with that now.     }          } // END THE IF STATEMENT FOR FILES          } // END THE IF STATEMENT THAT STARTED THE WHOLE FORM          //POST THE POST YO     do_action('wp_insert_post', 'wp_insert_post');      functions.php               $labels = array(         'name'                          => 'Locations',         'singular_name'                 => 'Location',         'search_items'                  => 'Search Locations',         'popular_items'                 => 'Popular Locations',         'all_items'                     => 'All Locations',         'parent_item'                   => 'Parent Location',         'edit_item'                     => 'Edit Location',         'update_item'                   => 'Update Location',         'add_new_item'                  => 'Add New Location',         'new_item_name'                 => 'New Location',         'separate_items_with_commas'    => 'Separate Locations with commas',         'add_or_remove_items'           => 'Add or remove Location',         'choose_from_most_used'         => 'Choose from most used Locations'         );          $args = array(         'label'                         => 'Locations',         'labels'                        => $labels,         'public'                        => true,         'hierarchical'                  => true,         'show_ui'                       => true,         'show_in_nav_menus'             => true,         'args'                          => array( 'orderby' => 'term_order' ),         'rewrite'                       => array( 'slug' => 'place', 'with_front' => false ),         'query_var'                     => true     );          register_taxonomy( 'booru_locations', 'booru_directory', $args );               // Add new taxonomy, NOT hierarchical (like tags)         $labels = array(             'name' => _x( 'Services', 'Service Type' ),             'singular_name' => _x( 'Service', 'Service' ),             'search_items' =>  __( 'Search Services' ),             'popular_items' => __( 'Popular Services' ),             'all_items' => __( 'All Services' ),             'parent_item' => null,             'parent_item_colon' => null,             'edit_item' => __( 'Edit Services' ),             'update_item' => __( 'Update Service' ),             'add_new_item' => __( 'Add New Service' ),             'new_item_name' => __( 'New Service' ),             'separate_items_with_commas' => __( 'Separate Services With Commas' ),             'add_or_remove_items' => __( 'Add or Remove Services' ),             'choose_from_most_used' => __( 'Choose From Most Used Services' )         );          register_taxonomy( 'services', 'booru_directory', array(             'hierarchical' => false,             'labels' => $labels, /* NOTICE: the $labels variable here */             'show_ui' => true,             'query_var' => true,             'rewrite' => array( 'slug' => 'services' ),         ));                         register_post_type( 'booru_directory',         array(             'labels'                => array(                 'name'              => __( 'Directory' ),                 'singular_name'     => __( 'Listing' )                 ),             'public'                => true,             'show_ui'               => true,             'show_in_menu'          => true,             'supports'              => array( 'title', 'editor', 'thumbnail' ),             'rewrite'               => array( 'slug' => 'directory', 'with_front' => false ),             'has_archive'           => true         )     );


individual images as navigation design TwentyTen

I can't figure out a solution for changing the black bar in Twenty Ten to individual background images behind each link. Using an image I created in Photoshop I have tried changing a few things in the CSS file but probably not the right changes. Do I need to edit the functions file too?


Nivo Slider Pulling In Wrong Size Image

I have tried changing the CSS, although I'm fairly sure the problem is not with the CSS. The theme has the slider at 940px by default, but I want to change this to be full width (or at least wider). Why is Wordpress setting the images to 940px? It puts -940xheight at the end of every slide. I have checked all the image sizes in wordpress and even used the Simple Image Sizes plugin and regenerated thumbnails which hasn't helped.


Show field if it has contents on Advanced Custom Fields

I have a custom field set that is look to display like so:
Lease Rate:             <?php the_field('lease_rate'); ?>

 NNN Expenses:             <?php the_field('nnn'); ?>

 Monthly Rent:             <?php the_field('rent'); ?>

 Site Area:             <?php the_field('site_area'); ?>

Sale Price:           <?php the_field('building_size'); ?>

Building Size:           <?php the_field('Address'); ?>

Contact Name:           <?php the_field('contact_name'); ?>

Phone Number:           <?php the_field('phone_number'); ?>
      I need to change it so that:   IF the field is filled in, THEN the title shows up. For example, if `the_field lease_rate` has a value then the paragraph "Lease Rate" shows up. I was thinking some kind of if statement then echoing the p?


How to set Active plugins as the default screen?

In my testing environment, I've got one hundred plugins. I'm more interested in seeing first the **Active** plugins than the complete list (`All`). How can I change the default screen for the `Plugins` menu item? ![enter image description here](http://i.stack.imgur.com/TPpqo.png)


Edit custom taxonomy description programatically

I've added a custom taxonomy and I wanted to know if there is a way to edit a custom taxonomy's description. Here's the description field. ![image of custom taxonomy](http://i.stack.imgur.com/whql5.png) IS there a function that provides access to this field? And if so, would I be able to use it in the New Posts page?


Change /search to /somethingelse

How do I change the search url? I already have something like: /search/keyword But I want to change /search to something else. How can I do it? Thank you!


Impossible to get Attachments Outside Wordpress?

My page (outside the wordpress install) begins something like this:               global $wpdb, $wp_query;      define('WP_USE_THEMES', false);     include_once 'word/wp-blog-header.php';          $args = array(       'posts_per_page'  => 10,       'post_type'       => 'post'     );     $queryObject = new WP_Query($args);      I start the loop like so:               <?php while (have_posts()): the_post(); ?>      In the loop I call this:               <?php the_post_thumbnail();?>      But nothing is returned.               print_r(get_post(4));      (Where 4 is the id of an attachment) also returns nothing. Calling               <?php the_content(); ?>      echoes the post content, minus the gallery - which also doesn't get rendered, but the shortcode is removed. Inside wordpress everything works fine, outside it seems that attachments are simply ignored. Why does this happen? Is there a workaround? Is there something wrong with my query? . . . **I found an alternative solution to my original problem - using a subdirectory, but I still feel this is a valid question. The original is here:** I'm using the wordpress engine as a CMS for a website that can't be integrated into wordpress right now because of time constraints (but will be eventually), so I need to get hold of things like post thumbnails outside of the wordpress directory. I'm using the following to set up my loop:               global $wpdb, $wp_query;      define('WP_USE_THEMES', false);     include_once 'word/wp-blog-header.php';     $args = array(       'posts_per_page'  => 10,       'post_type'       => 'leather_swatch'     );     $loop = new WP_Query($args);          if ($loop->have_posts()) : while ($loop->have_posts()) : $loop->the_post();      However, in index.php this works, but returns nothing in my external loop:               $thumb = get_post_thumbnail_id($post->ID);     echo '<img src="'.wp_get_attachment_url($thumb).'" />';      What I find really odd is that               print_r(get_post($thumb));       returns a post object inside the wordpress directory, but nothing in my custom loop - it doesn't recognise attachments. However I can still print out the content of my post type in the custom loop using the standard the_content() function. Can anyone illuminate what's going on/how I might fix this? I don't really want to use custom meta data to replicate standard functionality.


I keep getting Javascript error messages

I think something in my code must be utterly wrong because as soon as I manage to fix one error that I found, the next one pops up. I just managed to solve this problem. Now this error message keeps popping up: ![enter image description here](http://i.stack.imgur.com/5pwiF.jpg) Here's my blog. I might have some jquery conflict somewhere, but I implemented everything correctly and I just can't see what is causing the issue. Could somebody with more experience have a look and tell me what might be causing the Javascript error messages that I keep getting?


Related posts popup

I want to retain visitors on my blog by showing them other posts related to the post they are reading. But it seems they don't see this widget at all. So I have an idea to show this list in a popup (DIV) which appears in the bottom (or any side) of the page after the user scrolls the post for some extent. Does anybody know the best way to do this?


Create a post with user_register doesn't create title

I've got my user registration to automatically create a post with the user_register hook however the title shows up as (no title) can someone help me with what I'm doing wrong here?               add_action('user_register','create_new_user_post');          $userinfo = get_userdata($user_id);     $disname = $userinfo->display_name;          function create_new_user_post($user_id){             if (!$user_id>0)return;                  // Create post object             $my_bio_post = array(                // 'post_type' => 'ggs_user_post_type',                  'post_title' => $disname,                  'post_content' => 'Put cool content here!',                  'post_status' => 'publish',                  'post_author' => $user_id             );                  // Insert the post into the database             $bio = wp_insert_post( $my_bio_post );                  //and if you want to store the post ids in              //the user meta then simply use update_user_meta             update_user_meta($user_id,'_bio_post',$bio);     }


disable trashability for certain pages

Im building a wp site, that has some pages that only shows when a form has been completed. (think of "thank you for gettin in touch, we'll get back to you as soon as possible" - type pages). I have created this as a page, and then i use wp_redirect after the form has been submitted to get to it. But now the client will be able to delete this page, and it will then go 404 on the redirect. So the question: Is there a way that i can lock certain pages in the wp-admin? Im interested in both a solution where the certain page will disappear from a specific role, and/or a way where specific roles can't trash specific pages - but still edit it. Thank you so much.


How to hide the year in archive link

I am using the following code to show the archive link by month.               <?php wp_get_archives('type=monthly&limit='.date('m').'&show_post_count=1'); ?>      but it shows as   * december 2013 (3)   * november 2013 (2) but i need to just months only as..   * december (3)   * november (2) how can I do that in some easy steps?


TGM plugin error in Theme Check Plugin

Errors generated by theme-check plugin and with the code REQUIRED: plugin-activation.php. Themes should use add_theme_page() for adding admin pages. Line 335: add_submenu_page(               add_submenu_page(         $this->parent_menu_slug,                // Parent menu slug         $this->strings['page_title'],           // Page title         $this->strings['menu_title'],           // Menu title         'edit_theme_options',                   // Capability         $this->menu,                            // Menu slug         array( &$this, 'install_plugins_page' ) // Callback     );      REQUIRED: innovative_panel_functions.php. Themes should use add_theme_page() for adding admin pages. Line 143: add_menu_page(theme_name.' Settings', theme_name ,'install_themes', 'panel' updated the list.               $icon = get_template_directory_uri().'/innovative_panel/images/ipanel-settings.png';         add_menu_page(theme_name.' Settings', theme_name ,'install_themes', 'panel' , 'panel_options', $icon  );         $theme_page = add_submenu_page('panel','Settings', theme_name.' Settings','install_themes', 'panel' , 'panel_options');         add_submenu_page('panel',theme_name.' Documentation', 'Documentation','install_themes', 'docs' , 'redirect_docs');         add_submenu_page('panel','Support', 'Support','install_themes', 'support' , 'innovative_get_support');      I get this error. Please help me to sort out this issue. Can my theme be submitted for approval with these errors?


Put a link to a category round a hard coded A HREF

In my footer I have hard coded the links and would like to link some to there category, I could just copy the full URL to it and paste in the href="" but I would rather call it using php. My knowledge of WordPress and PHP is little and I have tried searching for something that will do this but none work, my last go used this:               <a href="<?php echo get_permalink( get_page_by_path( 'cooking-sauces' ) ); ?>">Cooking Sauces      and I tried this:               <a href="<?php echo get_permalink( get_page_by_path( 'cooking-sauces')->ID); ?>">Cooking Sauces      but did not work. So the full URL would be http://woloped.co.uk/blog/products/cooking-sauces/ Please can some one help, many thanks Dave UPDATE: Could it be called using the SLUG and if yes have is this done please.


Categories and page filtering with pre_get_posts

I have 3 pages, "Page 1" shows custom post-type "articles", "Page 2" shows custom post-type "tips", and "Page 3" shows both custom post-types. This is done conditionally with a custom loop in `page.php`. Both post-types have the default "category" taxonomy as well as an extra custom taxonomy for each type. When you're on a page and click on the category link associated to a post you go to `/category/cat/`. My current `category.php` template pulls in both "articles" and "tips" that match that category. What I want to do is if you click on the category when you're on 'Page 1" then only show "articles" in the category template, if you're on "Page 2" then only show "tips". And on "Page 3" show both. I've been trying to do this with `pre_get_posts` but I'm not sure how to implement it. Should I create different templates for each page? Should I just POST an extra variable and modify the query in `category.php`? Any ideas are welcomed.


I am generating the following notice in the options-framework.php. Notice: Undefined index: in options-framework.php I believe it is something to do with sanitization, but do not know how to resolve this issue. I have the following arrays defined in options.php               // Pull all the custom taxonomies into an array     $options_password_taxonomies = array();     $taxonomies_password_terms_obj = get_terms('password_gallery_category');     foreach ( $taxonomies_password_terms_obj as $taxonomy) {         if( isset( $taxonomy->term_id ) ){             $options_password_taxonomies[$taxonomy->term_id] = $taxonomy->name;         }     }           // Select a Category for your Client Area     $options[] = array(         'name' => __('Password Protected Galleries', 'shutter'),         'desc' => __('Choose a category for password protected client galleries.', 'shutter'),         'id' => 'client_area',         'type' => 'select',         'options' => $options_password_taxonomies);      options-framework.php               // For a value to be submitted to database it must pass through a sanitization filter         if ( has_filter( 'of_sanitize_' . $option['type'] ) ) {             $clean[$id] = apply_filters( 'of_sanitize_' . $option['type'],   $input[$id], $option );         }     }


Getting wp.me shortlink for wordpress custom post type

There is a button called "get shortlink" for wordpress builtin post type & pages. If we click on it we can get wp.me shortend url for that particular post This can also be got using the function wp_get_short_link() in the template file. However this doesn't seems to work for the custom post type. I used the following code to get shortlink to work on custom post type, but it outputs the default shortlink which is www.mysitename.com/?p=234, but i require wp.me shortlink for my custom post type.               if( !function_exists( 'my_theme_cpt_shortlinks' ) ) {     /**      * Allow shortlinks to be retrieved for pages and custom post types      */     function my_theme_cpt_shortlinks( $shortlink, $id, $context, $allow_slugs=true ) {     /**      * If query is the context, we probably shouldn't do anything      */     if( 'query' == $context )         return $shortlink;          $post = get_post( $id );     $post_id = $post->ID;          /**      * If this is a standard post, return the shortlink that was already built      */     if( 'post' == $post->post_type )         return $shortlink;          /**      * Retrieve the array of publicly_queryable, non-built-in post types      */     $post_types = get_post_types( array( '_builtin' => false, 'publicly_queryable' => true ) );     if( in_array( $post->post_type, $post_types ) || 'page' == $post->post_type )         $shortlink = home_url('?p=' . $post->ID);         //$shortlink =  wp_get_shortlink($post->ID);          return $shortlink;     }     }          add_filter( 'get_shortlink', 'my_theme_cpt_shortlinks', 10, 4 );      Is there any way to modify the above function to get wp.me shortlink for the custom post type instead of default shortlink?


Count number of posts of current month

I am trying to echo the number of posts for the current month from all categories but it isnt working.               <?php     $month = date('m');     $year = date('Y');     $countposts = get_posts('post_type=post&year=' . $year . '&monthnum=' . $month . '&cat=3');     echo 'New posts '  . count($countposts);     ?>      category 3 is a parent category and has many sub categories. No matter what I do, it returns the value 5. I have published 30 posts for this month to test it but it doesnt count them. :( What Im I doing wrong? **Update** I have tried the following query and returns the same outpout                   <?php     wp_reset_postdata();     $current_year = date('Y');     $current_month = date('m');     $args = array(         'cat'      => 3,         'year'     => $current_year,         'monthnum' => $current_month,         'post_status'     => 'publish',         'post_type'       => 'post'     );     $number_posts = get_posts( $args );     echo 'New posts '  . count($number_posts);     ?>


Wordpress plugin creating sidebar on the theme/page

I am creating a plugin and I need it to create a sidebar on the page, but I have no idea what to do or what to search. So once my plugin is activated, the sidebar needs to appear. The color and text are set by the user in plugin settings. I have already done that and now I need that sidebar to appear once I activate it. Any suggestions?


Custom order categories in admin dashboard

everyone, is there way to order categories in add/edit post in admin dashboard. The problem is my order must be custom, not by Name or ID. For example:   * Rumors (id 5)   * News (id 1)   * Features (id 7)   * etc. The ideal solution will be to order categories by description. That way in category description field I will put number or letter and categories will order right. Thank you in advance!


This webpage has a redirect loop issue

I want to redirect non logged in users to page id = 2 which have registration form.                   function checkLogged()     {         $pg = get_permalink();         if (!is_user_logged_in() && !is_front_page() && $pg != home_url('/?page_id=2'))         {             wp_redirect(home_url('/?page_id=2'));             exit;         }     }     add_action('wp_head', 'checkLogged');      Is this code correct ? I am getting > This webpage has a redirect loop The webpage at > http://abc.com/dsdd_wordpress/?page_id=2 has resulted in too many redirects. > Clearing your cookies for this site or allowing third-party cookies may fix > the problem. If not, it is possibly a server configuration issue and not a > problem with your computer.


Theme specific plugin, how?

Can someone tell me whether it is possible to create a plugin that is only available to a specific theme and how do I override certain settings in that theme? **The problem** This is basically the story. We've had a third party design and create a wordpress theme for us. Now it's up to us to expand the functionality of the theme by creating a plugin that will only be valid when someone has our theme installed. Are there specific functions available to achieve this? Thanks in advance.


How to turn system default url into friendly urls?

We have been using wordpress for everything and we are really happy with it! While we can customize the way our friendly urls look though, there does not seem to be a way to do the same for the system default urls? For example, if a user tries to post a comment with a required field left blank, they will land in /wp-comment-post.php with a message that they forgot a required field. Isn't this a bit odd and ugly looking? Why would anyone choose to direct to straight files? Is there a way to customize all these system urls to more friendly versions? I had a good look around the web but the choice of keywords as well as not much interest from people to change this didn't give me any good results! Please keep in mind we are using IIS so an .htaccess solution would not work here, but we could try using the iis rewrite engine? Thanks


Retrieve posts by term id custom query

i want to retrieve custom posts using using custom query . my taxonomy is recipe_tx and terms (Beef) , (Chicken) etc in it . i have tried using               SELECT p.* FROM wp_posts p, wp_term_taxonomy tt, wp_term_relationships tr      WHERE p.ID=tr.`object_id`      AND tt.`term_id`=tr.`term_taxonomy_id`      AND (p.post_type = 'recipe_cpt')     AND p.post_status = 'publish'     AND tt.`term_taxonomy_id` = 37      but no luck . can someone help me how to get wp posts by their term_id . if beefs id is 37 then i want to retrieve all the posts with `term_id = 37` Thank's


Exclude post ID from wp_query

How can I exclude one specific post from a WP_Query query? (For example, show all posts apart from a post with the ID 278) I've tried the post__not_in argument but it just removes all posts.. Any help would be great. Here is my current query               <?php         $temp = $wp_query;         $wp_query= null;         $wp_query = new WP_Query(array(             'post_type' => 'case-study',             'paged' => $paged,         ));         while ($wp_query->have_posts()) : $wp_query->the_post();     ?>      Thanks


Adding custom URL rewrite rules

I want to use 2 custom post queries on the author profile page, both of the queries uses pagination. With the following pagination function, I get this URLs structure:               http://localhost/author/admin/?xpage=2     http://localhost/author/admin/?ypage=2      Is it possible to re-write the above URLs to make them like:               http://localhost/author/admin/x/2     http://localhost/author/admin/y/2      I'm using following function for each of it to create the pagination:               echo paginate_links( array(             'base' => add_query_arg( 'xpage', '%#%' ),             'format' => '',             'prev_text' => __('«'),             'next_text' => __('»'),             'total' => ceil($total / $per_page),             'current' => $page         ));      I have been trying the WordPress function `wp_rewrite` and `generate_rewrite_rule` but could not make it work.


Where do I add html code to the menu div?

When looking at header.php, I see the following line:               <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>      That function is defined in nav-menu-template.php and generates the 'menu- custom-menu-container' div. Let's I want to add a div after the navigation list inside the 'menu-custom-menu-contaner' div. Where would I do that?


Can a Child Category Have More than One Parent?

I'm looking at the `get_categories()` function in the WordPress codex to see how I can return all of the children of each "root parent" ( categories that have no parents ). For example, if I am interested in the children for multiple "root parents", I'd like to know if there will be more than one instance of the same child under a different "root parent". So, this leads me to ask: **Can child categories in WordPress have multiple, different parents?**


Show post title words one by one

How to show post title words one by one, but to exclude words with 3 or less characters. Also it would be nice to be able to exclude some words, for example to make some list of words to exclude from showing. Point is to show post title words one one but to exclude common words with 3 or less characters such as: the, is, at, and, on, it... And also to have option to make list of any unwanted words. This is what I have so far, it gets title words, one by one, but without excluding any word.               <?php     $title = get_the_title();     $parts = explode( ' ', $title );     echo $parts[0];     echo $parts[1];     echo $parts[2];     //...     ?>


Posts only displaying on tax archive of first selected tax

So I have a c.taxonomy 'Types' under which are 'Type-Term 1' and 'Type-Term 2'. If 'Post A' is tagged as "'Type-Term 1', 'Type-Term 2'" it will only show on the 'Type 2' term archive. How can I have a post that is tagged with both terms show up on both archives? Thanks!


Create custom permalinks to show Custom Post Type's relationship?

I'm creating a WordPress site that has 3 custom post types registered: `course`, `chapter`, and `lesson`. All of these post types are inter-connected and share a relationship using custom fields. For example, the `chapter` has a custom field that stores the `course` post object in which it belongs to. Same goes for the `lesson` and the `chapter` it belongs to. My permalink settings are using the: `%category%/%postname%/` structure, in which display the post's URL like so: `www.domainname.com/custom-post-type-name/post-name` What i'm trying to accomplish is to create a custom permalink structure that shows the relationship between these 3 post types in the URL. Example below: When user is on course: `www.domainname.com/course` When user is on a chapter: `www.domainname.com/course/chapter` When a user is on a lesson: `www.domainname.com/course/chapter/lesson` While looking in the WordPress Codex, I found the the Rewrite API and WP_Rewrite(), I'm a little lost and i do not know where to begin. Any help on this would be greatly appreciated.


I am in need to do some operation if user clicks on **Network Activate** button on my WP Plugin (in WP Multisite). But I noticed that Wordpress's is_plugin_active_for_network function not working for multisites when I press the Network Activate button from the Main Administrator Panel. It returns nothing, and hence the               if(is_plugin_active_for_network('abc/abc.php'))      is not fulfilled. However when the Network is already Network Activated then the function - **is_plugin_active_for_network** is working fine (It returns **1** \- i.e. **true** ). Can anyone please tell me how can I check whether the **Network Activate** button is clicked by the main administrator?


Add the results of a custom query into a do_shortcode

I'm trying to add the post list from a custom query               while ( $the_query->have_posts()) : $the_query->the_post();       into the content of a `do_shortcode`. How can I do this?


wp_sanitize_redirect strips out @ signs (even from parameters) -- why?

In my wordpress site I have a hack that looks at the uri and does a redirect to a subdomain. The problem is wp_redirect calls wp_sanitize_redirect which will strip out @ signs, so when a user tries to load something like oursite.com?email=foo@bar.com The page that gets loaded should be prefix.oursite.com?email=foo@bar.com but instead it's prefix.oursite.com?email=foobar.com (i.e. - no @ sign) The problem is easy to work around - I just manually encode @ signs as %40 before calling wp_redirect. Question: why does wp_sanitize_redirect strip out @ signs, exactly? Anybody could anyway try to load a url with an @ sign in it - is there some security issue I'm not thinking about? EDIT: The function I'm talking about is wp_sanitize_redirect


**How would go about if I just want a temporary function?** (It's a converter just for converting Access to Wordpress tables). I want to execute several times so therefore I want it automated, but I don't know how to execute the function after adding the filter in add_action(). After I'm done converting, I will delete the function. I want to do something like `http://url/index.php?convert`               function addcoursecategoriesfromaccess() {         //code for converting the table     }     add_action('convert','addcoursecategoriesfromaccess');          //If I type http://url/index.php?convert then I want the addcoursecategoriesfromaccess()  to execute     if ($_REQUEST['GET'] == 'convert') {         do_action('convert');     }      I guess I'm missing something very simple, but as a newbie in WP-programming I hope you can help me out :-) I've the code inside functions.php in the theme.


get_the_terms return only last term

In my custom post type (portfolio_pt) I have some hierarchical category structure something like that:               ParentCat     |-child         |-someItem     ParentCat2     |-cild     ...      When I try to get list of all terms by get_the_terms function for "someItem" post this function return only last category ("Child Cat" without "Parent Cat") example:               global $post;     $terms = get_the_terms( $post->ID, 'portfolio_pt_category' );      I try to use get_the_term_list function but effect is the same, it returns only last category. Thanks for help!


How To Include JavaScript Files Only In Single Posts?

I know that `wp_enqueue_script()` inserts Javascript files into the WordPress header in the appropriate place. However, I want to include my Javascript in all single posts, ignoring the WordPress home or blog page.   Is that possible at all? I tried this:               <?php     function my_scripts_method() {         if ( is_single() ) {             wp_deregister_script( 'jquery' );             wp_register_script( 'jquery', 'http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js');             wp_enqueue_script( 'jquery' );         }     }     add_action('wp_enqueue_scripts', 'my_scripts_method');     ?>      But it's not working...


Can't change a label in woocommerce with the normal filter

// Hook in       add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );          // Our hooked in function - $fields is passed via the filter!     function custom_override_checkout_fields( $fields ) {      $fields['order']['order_comments']['placeholder'] = 'Special delivery requirements';      $fields['billing']['billing_company']['label'] = 'Company name if applicable';      $fields['shipping']['shipping_company']['label'] = 'Company name if applicable';      $fields['billing']['billing_address_2']['placeholder'] = 'House number / name';      $fields['shipping']['shipping_address_2']['placeholder'] = 'House number / name';      $fields['billing']['billing_state']['required'] = true;      $fields['billing']['billing_state']['label'] = 'County <abbr class="required" title="required">*</abbr>';      return $fields;     }      I've used thIs code to change some fields for the woocommerce checkout form. For some inexplicable reason, the label for the billing state refuses to change. Even though the label for billing company had changed the successfully, the label for the billing state refuses to. It has successfully become required but I can't change the label. Does anyone know what I am doing wrong or if this is a bug.


Custom query from plugin table

I have a problem, I use booking system pro plugin can I make a query to loop post filtered by availability on booking system pro plugin table?


Return all users with a specific meta key

I'd like to use `get_users()` to return all users that have a particular meta_key, but I don't want to specify what the value has to be because it will change for every user. The value is a json string. Is this possible?


Order the users by the date of their latest post

I use the following code for getting the authors of in my multi-author blog and order them by their post count. I want to order them by the date of their last post               $authors = get_users('role=author&orderby=post_count&order=DESC');


YOAST extend sitemap

I've written a Wordpress plugin that retrieves a json list from a server. This list is used to dynamically display content based based on various url paramters. I want that content to be included in my sitemap without having the need to programatically create "static" wordpress pages for every item since this content is growing on a daily basis. Now i'm looking for a way to add this list to a custom yoast sitemap. Is it possible, whenever yoast updates its sitemap, to include my custom sitemap? And is there a way to force yoast to recreate the sitemap? thanks for your help. cheers.


Changing Theme and affecting the SEO

I have a WP theme based on the Genesis Framework and I am considering, (I would stress the word considering, because I know what sort of problems it can cause) changing my website theme. Not that there is anything wrong with it, just thinking about a change…if it’s not too stressful… Does anyone know if this can cause any change in SEO rankings please? Thanks in advance.


Custom options in plugin, register_settings not working as no options.php?

I'm having trouble getting a custom plugin to save options, as it cannot find options.php (and I don't know where it's supposed to be) The full code for the plugin:               add_action( 'admin_menu', 'dotmailer_menu' );               function dotmailer_menu() {         add_options_page( 'Dotmailer Options', 'Dotmailer Details', 'manage_options', 'dotmailer', 'dotmailer_options' );     }               function dotmailer_options() {     ?>
         <form method="post" action="options.php">         <?php settings_fields( 'settings-group' ); ?>         <?php do_settings_sections( 'settings-group' ); ?>                  API key
             <input type="email" name="apiemail" value="<?php echo get_option('apiemail'); ?>">
             Password
             <input type="password" name="apipassword" value="<?php echo get_option('apipassword'); ?>">

<input type="submit" value="Save" class="button-primary" />
         </form>
     <?php      }          function register_settings() {               register_setting('settings-group','apiemail');             register_setting('settings-group','apipassword');         }      When I submit the form, it simply returns an error saying that it cannot find options.php. Am I supposed to create options.php myself? I have used similar code before without creating options.php myself and not had a problem.


Codex: Database Description: meaning of Cardinality

The following post outlines how to word cardinality is commonly used when dealing with databases: http://stackoverflow.com/questions/10621077/what-is- cardinality-in-databases. However I have not been able to comprehend how this term is used on the database desciptions page on the codex: Database_Description - Table:_wp_postmeta > Keyname Type Cardinality Field > > PRIMARY PRIMARY 13 meta_ID > > post_id INDEX 15 post_id > > meta_key INDEX 7 meta_key What do 13, 15, and 7 mean here. I have no clue as to what the numbers in the cardinality field refer to on this page. Thanks.


Excerpt vs content formatting woes

One of my posts has the following content:               This is a test post. Nothing more,     nothing less.     Three lines before the jump          And a couple of more lines     after the jump.      _Note_ : these were written as you see them, in the WP editor, using the HTML tab - so we have no hidden `<br>` or anything else going on in the post content. _Also_ : No Manual Excerpt was defined for this post. If I use `the_content()`, I get this:
This is a test post. Nothing more,
      nothing less.
      Three lines before the jump

»
       If, however, I use `echo get_the_excerpt();` I get this:               This is a test post. Nothing more, nothing less. Three lines before the jump      No `<p>`s, nor `<br />`s ( _heck_ , not even the `[...]` I was half- expecting!) What I'd really like to achieve in my theme is (within The Loop, of course):   1. If a manual excerpt exists: display that (and I know I'll have to tweak the `[...]`)   2. Else, display the content, respecting any `<!--more-->` you may find. So, I was starting with this               $excerpt = get_the_excerpt();     if($excerpt=='') { //right, isset or empty may be better         the_content();     } else {         echo $excerpt;     }      But I'm getting the feeling there's a better way? Or is there a quick fix for the formatting issue mentioned above?


Get the Term List - Ordering

I have a country taxonomy with children taxonomies > state & city. For a given entry for a restaurant in Nantucket, I want it to say "Nantucket, Massachusetts, United States (each linked to those taxonomy pages)", but the code I have gotten to work (I'm new to PHP) outputs: Massachusetts, Nantucket, United States               $terms_as_text = get_the_term_list( $post->ID, 'country', '', ', ', '' ) ;      echo strip_tags($terms_as_text);      How to I get this to order by the reverse hierarchical order of the taxonomy > City, State, Country? Thanks, in advance, for any help!


wp_list_categories and custom post types

I'm confused.   * I have a custom post type "asset".   * I created posts, and they are all at `/asset/post-title`   * I assigned categories to the custom post type, e.g. "patterns"   * The categories page shows the number of posts in each category   * If you look at the post meta for any of these posts in single view, it displays the category(ies) assigned to it. HOWEVER, it you click the category link in the post meta ("patterns"), I get a page "nothing found". If I assign the category to a **normal** post type, those will show of the category page. What did I forget? EDIT: I should also add that the LINK for "patterns" is `/category/patterns`


Exporting and importing my Wordpress database, but none of the plugin settings are importing

I'm dumping my entire WordPress database, changing all necessary references, and then importing it into another domain. Everything works fine, except my plugin settings are not being set in the new domain. Does anyone know if Wordpress saves plugin settings locally somewhere? Or a reason why it would activate all the plugins, but not set the settings? The plugins I am specifically having trouble with are Adminimize, Admin Menu Editor, and User Roles. This is the closest plugin I could find to solving the issue, but it doesn't work for Wordpress 3.1 - http://wordpress.org/extend/plugins/sk-wp-settings- backup/ Thanks in advance for any help you can give me.


Custom Post Type URL Change - (portfolio using portfolio categories)

I wonder if you could help me. I'm using a theme which has 'portfolio' as a custom post type. The portfolio items can be categorised in a similar way to standard posts. Currently, theme outputs portfolio URLs in the following format: mysite.com/portfolio/portfolio-post ...where 'portfolio-name' is simply the post title. the middle section of the URL remains static. What I would like to achieve is something like this: mysite.com/portfolio-category/portfolio-post ...where the 'portfolio-category' proportion of the URL is taken from the portfolio category. Each portfolio post will only be assigned to a single portfolio category at any one time. I can send code examples across if this makes it easier for you to understand what i'm trying to achieve. Thanks in advance H


using Ajax: call to undefined function get_option

I am using ajax on my template to load a file called counter.php. When I click a button, it is supposed to increase the counter. But when I click the button I get this error "Fatal error: Call to undefined function get_option()". This is what I have on counter.php               $post_ID = $_POST['ID'];     $opn_name = 'fb_counter'.$post_ID;     $counter_value = get_option($opn_name);     if($counter_value==NULL){     $counter_value = 0;     }     update_option($opn_name, $counter_value+1);          echo get_option($opn_name);      I am not sure what is wrong. Do I have to include any wordpress files on this php file ?


need help with existing code showing subpages

I am helping a friend make some changes to a wordpress theme. At the moment displaying subpages works only for one parent and its subpages (the one with id 31), but we want it to work for all pages (and their children). I want to more or less keep the code as is, just make the necessary changes to apply to all. Although I am pretty good with css and html, php is not really my strong suit, so I would appreciate your help figuring this out. This is the existing code:               $currentPageId = get_the_ID();          $pages = get_pages('child_of=31');     $i=0;     foreach($pages as $child) {     $childrenPageID[$i] = $child->ID;     $i++;     }          if ( (get_the_ID() == 31) || ( in_array($currentPageId, $childrenPageID)) ) {                $taxonomy     = 'portfoliocat';         $orderby      = 'name';          $show_count   = 0;      // 1 for yes, 0 for no         $pad_counts   = 0;      // 1 for yes, 0 for no         $child_of     = 5;         $show_count   = 1;         $title_li     = null;                   $args = array(           'taxonomy'     => $taxonomy,           'orderby'      => $orderby,           'show_count'   => $show_count,           'pad_counts'   => $pad_counts,           'child_of'     => $child_of,           'show_count'   => $show_count,           'title_li' => $title_li          );              ?>

             <?php             $cat = get_query_var('cat');                  // count all categories             $totalCount = count(get_categories($args));             $currentCount = 0;                  foreach(get_categories($args) as $category) {                      // get current number of stack             $currentCount = $currentCount + 1;                  global $wpdb;             $lookForValue = $category->slug;                  $querystr = "SELECT post_id                          FROM $wpdb->postmeta                          WHERE meta_key = 'category-include' AND meta_value = '".$lookForValue."';             ";             $postid = $wpdb->get_var($wpdb->prepare($querystr));                      // logic to remove last trunk                 if ($totalCount != $currentCount  ) {                 echo '
' . $category->name.'   |
';                 }                 else {                 echo '
' . $category->name.'
';                    }             }?>

           }      I know I need to change the if, but no clue what to replace it with. Any suggestions? Thanks in advance! Joanna


Categorize wordpress tags

I have problem about categorizing wordpress TAG, in my case for language. for example: **postA** : englishtag1,englishtag2,englishtag3, chinesetag1,chinesetag2, **postB** : englishtag2,englishtag5,englishtag4, chinesetag1,chinesetag3, i want to show tag cloud based on the "language": **english tag cloud** : englishtag1,englishtag2,englishtag4,englishtag5 **Chinese tag cloud** : chinesetag1,chinesetag3,chinesetag2,chinesetag4 etc.. is it possible? how to achieve this? Thank you


What content should go in index.php?

I'm developing my own theme and came up with an issue that' I am confused with. I have two files that I'm trying to figure out. `page.php` and `index.php`. I know that page.php is used for pages, of course, but when trying to set up a 404 page, for example:               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

<?php wp_title(''); ?>
                     <?php the_content(); ?>
             <?php get_sidebar(); ?>

          <?php endwhile; else : ?>     404 not found     <?php endif; ?>      Nothing will be displayed. Now, if I copy this content and stick it in index.php, I will have a 404 page. I have no idea what to do because index.php is required for a theme but I don't know what to do with it. Can someone explain the differences and what kind of content actually goes in it?


Wordpress Database Duplicate Entry Error (Cron specific)

This is one error that my website is continuously generating in the error log file.               WordPress database error Duplicate entry '59199038' for key 'PRIMARY' for query INSERT INTO `admission_options` (`option_name`, `option_value`, `autoload`) VALUES ('cron', 'a:2:{i:1406114668;a:1:{s:16:\"wp_version_check\";a:1:{s:32:\"40cd750bba9870f18aada2478b24840a\";a:3:{s:8:\"schedule\";s:10:\"twicedaily\";s:4:\"args\";a:0:{}s:8:\"interval\";i:43200;}}}s:7:\"version\";i:2;}', 'yes') ON DUPLICATE KEY UPDATE `option_name` = VALUES(`option_name`), `option_value` = VALUES(`option_value`), `autoload` = VALUES(`autoload`) made by require('wp-blog-header.php'), require_once('wp-load.php'), require_once('wp-config.php'), require_once('wp-settings.php'), do_action('init'), call_user_func_array, wp_schedule_update_checks, wp_schedule_event, _set_cron_array, update_option, add_option      Any help on how to correct this will be great!


Custom post type - order field

In a custom post type, is there a way to include the "order" field that is available for pages? Is there any built-in logic that prevents duplicate values in the "order" field? The idea is to be able to sort a custom post type by a user-specified order, then alphabetically by a string-based custom field.


Custom Plugin inlcude wp-load.php in my new.php file

I have created a custom plugin in WordPress and uploaded to the WordPress.org But the plugin is rejected due to I was including require_once("../../../../wp-load.php"); In one of my php file which collects the POST response. So how can I include this wp-load.php in right way, to get the approval from WordPress. Please help me on this. Regards Krijesh PV.


Changing post category from dropdown

I am showing a list of posts on the front of my wordpress site which each have a dropdown next to them with a list of category's, which are pulled in as follows. As you can see the form submit button is wrapped in `<noscript>` tags so that when an option is choosen from the dropdown at the moment it will redirect to the category that was chosen. I am wanting to change this functionality so that when an option is chosen from the dropdown it will then add the relevant post to the category that was selected from the dropdown but also keep it in all other category's that it was previously in. I am sending the form to `addcat.php` which is where I am thinking I need to add a script to do as I need somehow?               <form action="<?php bloginfo('url'); ?>/addcat.php" method="get">
      <?php       $select = wp_dropdown_categories('show_option_none=Select category&show_count=0&orderby=name&echo=0&child_of=28&hide_empty=0');       $select = preg_replace("#<select([^>]*)>#", "<select$1 onchange='return this.form.submit()'>", $select);       echo $select;      ?>
<input type="submit" value="View" />

     </form>       At the moment I have in my functions:               function addPostToCategoryLauncher()     {     $newCatId = 28;     $newCatId = get_cat_ID( 'my-category' );     $categories = wp_get_object_terms( $post->ID, 'category', array( 'fields' => 'ids' ) );     array_push( $categories, $newCatId );     $categories = array_unique( array_map( 'intval', $categories ) );     wp_set_object_terms( $post->ID, $categories, 'category' );     }     add_action( 'init', 'addPostToCategoryLauncher' );      And in my addcat.php               if( !empty( $_POST['cat'] ) ) { add_action( 'init', 'addPostToCategoryLauncher' ); }     header('Location: ' . $_SERVER['HTTP_REFERER']);      But this is just saying add to catId=28 but I need it to be the category that was chosen from the dropdown not Id 28, the function also doesn't seem to working so It may need a few tweaks.


Can I create front-end editable user profile pages with Wordpress? How do I do it?

I'm trying to build a WP site where _using the front-end_ , each user can:   1. Register through the front end using basic fields   2. Log in   3. Create their own profile page using multiple forms   4. Upload text, image and video data using profile forms   5. Create work related information (portfolios made up of images and video) that are separate from profile forms   6. be able to edit both profile and portfolio related information unique to their own profile only So to summarise, we are talking about _2 separate types of information_ : A) user profile information that can be updated anytime after registration B) Portfolio information that uses various media to create a front end profile for the user. This should be editable and updatable **via the front-end** after registration too. So Is this possible to do with Wordperss? What tools and approaches would you recommend?


PHP conditional script issue

I'm have the 2 seperate block of codes as shown below and the one below doesn't work except if I cut off the first one. Any ideas what the problem could be? **Conditinal script**               <?php { ?>              <?php                  if ( is_front_page() ) {                  get_template_part('home-page-content');                              } elseif ( is_page('archives')) {                          get_template_part('archives');              }         else                  get_template_part('secondary-page-content');                    ?>              <?php } ?>      **Second block of script**                <div id="footer">          <?php echo get_post_meta($post->ID, "biz_code", true); ?>              </div>


Can't work out why widget contents disappear from admin

everytime I make a change to any widgets in admin they disappear - sometime just from admin, sometimes from the frontend and sometimes both. I get them back by adding `update_option( 'sidebars_widgets', $null );` to the bottom of functions.php - then I can see them in admin as 'inactive widgets'. Then I manually re-add them all in admin - it's very frustrating! I'm using Canvas with a custom child theme. I added a new widget area by adding               // Underhome widget area     if ( function_exists('register_sidebar') ){       register_sidebar(array(         'name' => 'Underhome widget',         'id' => 'underhome_widget',         'description' => "A widget area underneath the home page content",         'before_widget' => '
',         'after_widget' => '

',         'before_title' => '
',         'after_title' => '
',       ));     }      to functions.php Then I created a page template and added                    <?php if ( dynamic_sidebar('underhome_widget') ) : endif; ?>      I can't see anything wrong with this? maybe it is unrelated? Anyway I'm totally stuck does anyone has any suggestions apart from changing career?


Splitting up a submenu into columns, or putting existing menus in another menu as submenu item

I have a menu with a long list of submenu items. I'd like to split that up into columns and the easiest way in my mind would be to have them split up into multiple . Is there a way to do this? Alternatively, I've currently have the submenu items in four different menus (so that I can display them in four columns in the footer). Is it possible to put those menus in my main menu as submenu items?


How to format shortcode's HTML in external file

I need to add a shortcode in my theme and I would like to put the HTML code not in the function which creates the shortcode but in a template file in my theme directory. Now I have               function wpse450_show_video( $atts ) {         extract(shortcode_atts(array(             'id'        => 0         ), $atts ));              if( is_numeric($id) ) {             $ngvideo_title = get_the_title($id);         }         return '<div>'.$ngvideo_title.'</div>';     }     add_shortcode( 'ngvideo', 'wpse450_show_video' );      I would like to put the `<div>'.$ngvideo_title.'</div>` stuff in an external file. How to do this?


Is there a better way to do headings for (all) archives?

I've been writing wordpress themes for years now and am kind of getting bored of copy-pasting the same bunch of code for archive titles. Let's say I have 1 template for yearly and monthly archives, categories, tag archives, etc. I have a copypasta that spans like 40 lines and is basically a huge if/else thing which generates the relevant heading. Is there something more sane/quick to build the heading text?


Listing all sub-pages?

I'm wondering how to write a list of sub-pages of actually visited page. So I have 2 pages and 3 sub-pages for each:               Colors [page]     - Red [child of Colors - subpage]     - Blue [child of Colors - subpage]     - Green [child of Colors - subpage]          Numbers [page]     - One [child of Numbers - subpage]     - Two [child of Numbers - subpage]     - Three [child of Numbers - subpage]      And when user visits "Colors" page then my code outputs Red/Blue/Green and if he does vist Numbers it shows One/Two/Three. I'm sure wp_list_pages will do the thing easy, but I'm not sure about parameters.


Get url.com/post_type/taxonomy/term work!

I'm having trouble get what I want by mixing custom post types and taxonomy. **I want to run this:** > www.url.com/post_type/taxonomy/term **In my case this:** > www.url.com/dossier/theme/sante _(sante is a term of "thermatiques" taxonomy)_ When I enter this url, I do not have a 404 but it shows me all the items post- type regardless of the taxonomy. Taxonomy's code:               register_taxonomy(         'thematiques',         array( 'post', 'dossiers','videos' ),         array(         'rewrite' => array( 'slug' => 'theme'),         'label' => 'Thématiques',         'query_var' => true,         )     );      CPT's code:               function register_cpt_dossiers() {         $labels = array(             'name' => _x( 'Dossiers', 'dossiers' ),             'singular_name' => _x( 'Dossier', 'dossiers' ),             'all_items' => _x( 'Tous les dossiers', 'dossiers' ),             'add_new' => _x( 'Ajouter', 'dossiers' ),             'add_new_item' => _x( 'Ajouter un nouveau dossier', 'dossiers' ),             'edit_item' => _x( 'Modifier le dossier', 'dossiers' ),             'new_item' => _x( 'Nouveau dossier', 'dossiers' ),             'view_item' => _x( 'Afficher le dossier', 'dossiers' ),             'search_items' => _x( 'Chercher dans les dossiers', 'dossiers' ),             'not_found' => _x( 'Aucun dossier trouvé.', 'dossiers' ),             'not_found_in_trash' => _x( 'Aucun dossier trouvé dans la corbeille.', 'dossiers' ),             'parent_item_colon' => _x( 'Magazine parent :', 'dossiers' ),             'menu_name' => _x( 'Dossiers', 'dossiers' ),         );         $args = array(             'labels' => $labels,             'hierarchical' => true,             'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields', 'revisions' ),             'taxonomies' => array( 'thematiques'),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'menu_position' => 5,             'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => false,             'has_archive' => 'dossier',             'query_var' => true,             'can_export' => true,             'rewrite' => array( 'slug' => 'dossier/%thematiques%'),             'capability_type' => 'post'         );         register_post_type( 'dossiers', $args );     }      And here is the code that redirects links posts correctly:               function wpa_show_permalinks( $post_link, $id = 0 ) {         $post = get_post($id);         if ( is_object( $post ) && $post->post_type == 'dossiers' ){             $terms = wp_get_object_terms( $post->ID, 'thematiques' );             if( $terms ){                 return str_replace( '%thematiques%' , $terms[0]->slug , $post_link );             }         }         return $post_link;     }     add_filter( 'post_type_link', 'wpa_show_permalinks', 1, 2 );      Thank you for your help!


Is there something like theme test drive for plugins?

Basically, I'm wondering if there is something like theme test drive (which lets you use and presumably tweak on theme while non admins see another) but for plugins. My goal is to be able to tweak/test a plugin while site visitors see the older stable version.


pre_get_posts causes Custom Posts appear under 'Pages' menu

In order to enable pagination on for custom post archive I've added pre_get_posts function. But, funnily it caused my custom posts be duplicated under 'Pages' menu. Here is the code that causes the problem. Please, advise.                  function truck_pre_pagination( $qry ) {             if ( $qry->is_main_query() ) {                 $qry->set('orderby','date');                 $qry->set('order','ASC');                 $qry->set('posts_per_page',12);                 $qry->set('post_type','trucks');             }         }         add_action('pre_get_posts','truck_pre_pagination');


What is difference between get_bloginfo('url') and get_site_url()?

I am developing a plugin. I want to know difference between               get_bloginfo('url');        and               get_site_url();      I got same output, then what's the difference?


Recent comments on author page?

I'm creating an author.php page and I'd like to show comments as well as posts from a custom post type. I already have the list of posts but I'm looking into an efficient way of displaying the most recent comments from that author as well. So far I haven't found anything except widget and bloated plugins. I'd like to do that particularly in one stream (posts/comments) but I can understand if this is too challenging :) Thanks! Dennis


The delete_posts capability?

Shouldn't this remove the capability to delete a post? Even if I remove the delete_posts capability for an editor, he still can trash a post and then delete i permanently. That can't be right. How do you remove the capability to trash/delete a post?


How to Call a static page in WordPress

Hi I created a template within my theme files, just for displaying a map in a lightbox. I need to call this template page from a normal wordpress post, how can I do it? Say in my theme files I have a file called map-template.php From within my post I would like to call that map-template.php file and also pass the ID of the current post as a parameter. Thanks


Why was my blog post inserted lot's of ad links by others?

I found that my blog posts are inserted lot's of ad links, I'm using WordPress 2.9.2, is there a known security vulnerability in it?   A screenshot : I post some codes on my blog, the ad links are inserted into them. ![enter image description here](http://i.stack.imgur.com/JWTQ8.png) I delete them by hand several days ago, and I found that they're back again!


How to change the post form from plugin?

I am starting making some wordpress plugin, so I am a beginer. I just wonder how can I change the post form of the pages. For example for adding some other input (of type file or text)? I am trying to use               add_filter('comments_template', 'add_new_fields');      but nothings happens.


Can I hook into wp_update_core outside of the admin?

I'm trying to bring some of the admin functionality to a custom front end in WordPress. Questions of security and pragmatism of this aside, is there an available hook to trigger wp_update_core outside of the admin?


how to hide home nav link in wordpress

I'm trying to hide the home navigation link from the theme boilerplate that I downloaded from underscores.me. Wordpress codex says that its not shown by default, but whether I do this:               <?php wp_page_menu( array( 'show_home' => true ) ); ?>      Or this:                <?php wp_page_menu( array( 'show_home' => false ) ); ?>      It still shows the home page nav link. When I don't call the `wp_page_menu` function it doesn't display the menus so I know its the one that's outputting it. Any ideas what's wrong and what else could I try? Thanks in advance!


wp_nav_menu log in/out link?

I have a wp_nav_menu showing pages, but I'd also like to include a log in/out link, based on the current state of the user, which will redirect them to the home page. I've looked far and wide, but how can I implement this in a wp_nav_menu? Thanks, Dennis


Why is $_POST Empty in Profile Edit Admin?

This is a very odd problem - post data seems to be empty in the profile editing page of admin. Here is my code: http://pastebin.com/3ejg8P99 What causes this? Is there some "safety" step I've missed or something?


Custom Permalinks Break Search Pagination

So I'm having a weird issue that I've never seen. I have a search.php set up like this:                     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      query_posts($query_string . '&paged;=' . $paged);           if ( have_posts() ) : while ( have_posts() ) : the_post();         // post stuff     endwhile; else:          endif;          pagination();                If I use anything but the default permalink structure, it breaks the pagination and returns a 404 and the second page. Ant ideas?


How to remove username field from the registration page?

I know about http://wordpress.org/extend/plugins/wp-email-login/, but it only takes care of login - not registration. I don't want any javascript-based solution. (I'm aware of Register Plus Redux, but it uses Javascript to take care of this.) I just want to use email-address as username, and I want to see if there's an easy (but non-javascript) way to take care of this.