title: Pagination with custom query (not using posts)

text:
I've been looking at this problem for a few weeks now, constantly running into the same problem. It's a bit of a complicated setup: I've got a **category** called "dossiers". I've also got a **custom taxonomy** "dossiers" which is used to group posts that are about the same news event or story. When someone creates a post, they can assign the post to certain dossier and then put it in the category for "dossiers". That way, all dossier- posts are filed under the same category while still having a way to separate stories from each other. I need the **category page** for the category "dossiers" to display all the **custom taxonomy terms** in the taxonomy "dossiers". These, in turn, link to their own listing of that particular dossier. I created the category- dossiers.php file which replaces the default category page, so that's not a problem anymore. Using other forum posts, particular this one, I have gotten the bulk of the problem figured out. The category-page shows all taxonomy terms, with links and everything, and can split them up into pages. (This is a bit hacky because WordPress normally doesn't use terms as the main content blocks, but posts). My only problem right now is to get the second, third, etc. page working. Beyond the first page it just displays the default index.php file of my theme. Here is the full template page. Can anyone figure out what's wrong with it? I've tried and tried but just can't seem to find the problem.               <?php get_header(); ?>          <?php get_sidebar (); ?>

<?php single_cat_title();?>
                      <?php                      if ( get_query_var( 'paged' ) ) {                     $paged = get_query_var('paged');                     }                 else if ( get_query_var( 'page' ) ) {                     $paged = get_query_var( 'page' );                     }                 else {                     $paged = 1;                     }                      $per_page    = 9;                 $number_of_terms = count( get_terms( "dossiers") );                 $offset      = $per_page * ( $paged - 1) ;                      // Setup the arguments to pass in                 $args = array(                     'order'     => 'ASC',                     'orderby'      => 'menu_order',                     'offset'    => $offset,                     'paged'    => $per_page                 );                      // Gather the terms                 $terms = get_terms("dossiers", $args);                      $count = count($terms);                 if ( $count > 0 ){                     echo "
";                     foreach ( $terms as $term ) {?>
                             <a href="<?php echo get_term_link( $term ); ?>">                                 <?                                     if ( get_field('banner', $term->taxonomy._.$term->term_id) ) { // check if the post has a Banner Image assigned to it.                                         $image = get_field('banner', $term->taxonomy._.$term->term_id);                                         echo '';                                     }                                     else {                                         echo '';                                     }                                 ?>
                                     <div class="caption" data-category="<?php $category = get_the_category(); echo $category[0]->slug; ?>"><?php echo $term->name; ?>

                      <?}                      echo "
";                  }             ?>
                        <?php                       if($terms) {                              $big = 999999999; // need an unlikely integer                         echo paginate_links( array(                             'base'    => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),                             'format'  => '/page/%#%',                             'current' => $paged,                             'total'   => ceil( $number_of_terms / $per_page ), // 9 items per page                             'type' => 'list',                             'mid_size' => 5                         ) );                      }     ?>                   <?php get_footer(); ?>


title: How to change the menu like this?

text: Here is my `wp_nav_menu`:               wp_nav_menu( array(                 'link_before' => '',                 'link_after'  => ''             ) );      I got `a` tag like this:               LINK      But I actually need this:               LINKTITLE      Is it possible to write a filter?


title: Hook for post permalink update

text: I would like to know what hook should I used when the permalink/url of a post is modified. My goal is to get the old permalink and new permalink so I can used it for my plugin. Thanks. [EDIT] Just want to clarify the question. I would like to get the old and new url in a scenario for example, when a user select one its post in the admin area, and edit the current permalink/url(/helloworld) into a new permalink/url(/helloworld_new) of the selected post. I would like to get the complete url the post being edited.


title: How to find the number of Tags a post has?

text:
Is is possible to find how how many tags (and categories) a post has and to display it? something like this: when a post has three Tags and two categories, at the end of the post show that number inside brackets, like so: TAGS (3) | CATEGORIES (2) I would like to have it so, because i would like that the tag/category list is hidden until the user clicks or hovers it. Right now i am making the Tags into an unordered list like this:               the_tags('

','

','

');      thanks!


title: Hiding taxonomies with no children WP_Query & tax_query

text:
I have this code which has taken over 7 hours to put together through research but the last hours or so I have hit a brick wall! I require the taxonomy title to be hidden if there are no posts associated with it. Here is the page: http://cb.dannycheeseman.me/wine-menu/usa/california/ Here is my code:               /**********************************************/     //  CUSTOM WINE MENU SHORTCODE     /**********************************************/               add_shortcode( 'wine_list_per_cat', 'wine_list_per_cat' );          function wine_list_per_cat($atts){              global $woocommerce_loop;              extract(shortcode_atts(array(             'cat' => '',    // list of categories in the format 0,1,2,3,4             'tax' => 'product_cat', // taxonomy use             'per_cat' => '3',   // max featured items to display per category             'columns' => '3',   // columns size         ), $atts));     ?>
              <?php                    $wine_type_terms = get_terms( 'wine-type' );                  foreach ( $wine_type_terms as $wine_type_term ) {                      $args = array(                     'post_type' => 'product',                     'showposts' => -1,                     'tax_query' => array(                         'relation' => 'IN',                         array(                             'taxonomy' => 'wine-type',                                 'field' => 'slug',                                 'terms' => array( $wine_type_term->slug ),                             ),                             array(                                 'taxonomy' => 'product_cat',                                 'field' => 'slug',                                 'terms' => $cat                             )                         ));                      $wine_type_query = new WP_Query($args);?>

<?php echo $wine_type_term->name; ?>

                     <?php  while ( $wine_type_query->have_posts() ) : $wine_type_query->the_post();global $product ?>

<?php the_title(); ?>
                             Size: <?php echo get_post_meta( get_the_ID(),'wine_bottle_size', true );?>
                             Percentage: <?php echo get_post_meta( get_the_ID(), 'wine_percentage', true );?>
                             Year: <?php echo get_post_meta( get_the_ID(), 'wine_year', true );?>
                             Price: <?php echo $product->get_price_html(); ?>

<?php echo get_post_meta( get_the_ID(), 'wine_menu_content', true );?>
                             <?php woocommerce_template_loop_add_to_cart( $wine_type_query->post, $product ); ?>
                               <?php endwhile;?>                     <?php wp_reset_postdata(); ?>

                            <?php } ?>                  <?php wp_reset_query(); ?>
     <?php }       **UPDATE! OK!!! Woooohooo! Found out what it was.. I should have been calling if have posts before the call for $tax->name; Here is my final, and working code! :)**               /**********************************************/     //  CUSTOM WINE MENU SHORTCODE     /**********************************************/               add_shortcode( 'wine_list_per_cat', 'wine_list_per_cat' );          function wine_list_per_cat($atts){              global $woocommerce_loop;              extract(shortcode_atts(array(             'cat' => '',    // list of categories in the format 0,1,2,3,4             'tax' => 'product_cat', // taxonomy use             'per_cat' => '3',   // max featured items to display per category             'columns' => '3',   // columns size         ), $atts));     ?>
              <?php                    $taxonomy = get_terms( 'wine-type', array('hide_empty' => true, 'pad_counts' => true));                  foreach ( $taxonomy as $tax ) {                      $args = array(                     'post_type' => 'product',                     'orderby' => 'title',                     'showposts' => -1,                     'tax_query' => array(                         'relation' => 'AND',                         array(                             'taxonomy' => 'product_cat',                             'field' => 'slug',                             'terms' => $cat,                             'operator' => 'IN'                         ),                         array(                             'taxonomy' => 'wine-type',                             'field' => 'slug',                             'terms' => array( $tax->slug ),                             'operator' => 'IN'                         ),                          ));                      $wine_type_query = null;                      $wine_type_query = new WP_Query($args);                      if( $wine_type_query->have_posts() ) : ?>

<?php echo $tax->name; ?>

                             <?php while ( $wine_type_query->have_posts() ) : $wine_type_query->the_post();global $product ?>

<?php the_title(); ?>
                                 Size: <?php echo get_post_meta( get_the_ID(),'wine_bottle_size', true );?>
                                 Percentage: <?php echo get_post_meta( get_the_ID(), 'wine_percentage', true );?>
                                 Year: <?php echo get_post_meta( get_the_ID(), 'wine_year', true );?>
                                 Price: <?php echo $product->get_price_html(); ?>

<?php echo get_post_meta( get_the_ID(), 'wine_menu_content', true );?>
                                 <?php woocommerce_template_loop_add_to_cart( $wine_type_query->post, $product ); ?>
                             <?php endwhile;?>

                  <?php endif; wp_reset_query(); ?>              <?php } ?>
     <?php }


title: Allow multiple selection of user roles

text: By deafult we are only allowed to select one roles per user. Due to my website requirement, I have to enable multiple selection of user roles. I have searched but cannot find any answers on this. I also have tried plugins for creating custom fields but no luck at all. Does anyone ever tried this or have any plugin suggestion or code.


title: Get a list of posts by specific category

text: I'm trying to build a search query in PHP in WordPress and I need to get all posts by a specific author in a specific category including drafts. For example, is it possible to do something like, "status=draft and author=12 and category=7"? Also, I haven't been able to find the page that shows how to build WordPress query. Note: I'm using the JSON-API plug-in and using it's get_search_results method. It's not clear if it's a full WP_Query like search since "cat=1" and "author=1" does not return results but "demo" and other common keywords return posts.


title: Change get_post_thumb responsively?

text:
How can I responsively change the get_post_thumb when reaching a certain breakpoint with PHP code? I use the following code to print my posts thumb at the moment:               <?php      echo '
';      the_post_thumbnail('featured-cat',array('title' => ''));      echo '
';     ?>      Which are specified in my `functions.php` file:               add_image_size( 'featured-cat', 248, 110, true ); //featured-cat      What I then want to do is to instead use the following code when reaching 320px in screen size. I want to use               add_image_size( '**featured-cat-mobile**', 200, 80, true ); //featured-cat mobile


title: Exclude Categories from wp_list_categories()

text: in before: I already searched for this answer her but couldn't find a thing that worked for me. I have a Lot of Categories and Child Categories. I use them to give a Location, Country, Type of Employment, etc to different posts and to later sort them in my sidebar. My code looks like this.                       $country_filter = array(                         "show_count" => 0, // no count behind each Category                         "hide_empty" => 1, // no empty categories                         "exclude" => "24", // THE ONE to exclude                         "child_of" => 55, // category ID                         "title_li" => "");  // leaves the title empty so we can use the headline above                  wp_list_categories($country_filter);      The Thing is: Every post has a Category 55 (it's the Country Category) but can also have 24 - which is a category that should never show up on search, sidebar, etc. this one is only displayed on a specific page. My question is: How can I remove posts in category 24 from the list? The above snippet doesn't work. Thanks!


title: Wp set post terms not work

text: My code is not working, it does not add the taxonomy               add_action('init', 'post_test', 10);     function post_test() {         $empty = get_page_by_title('Produto teste', OBJECT, 'produtos');         if(empty($empty)) {             $insert_post = array(                 'post_status' => 'publish',                 'post_type' => 'produtos',                 'post_title' => 'Produto teste',             );             $post_id = wp_insert_post($insert_post);             if ($post_id) {                 wp_set_post_terms($post_id, array('metais'), 'categoria-produtos'); // tag metais id is 108             }             add_post_meta($post_id, 'fornecedores', '5948'); // id do fornecedor             add_post_meta($post_id, '_fornecedores', 'field_52377232eb265');         }     }      why not work?


title: Remove settings if theme is deleted?

text: Is it possible to perform an action only if the theme is deleted (not deactivated) from the theme directory ? For example, I want to remove the theme settings from database after the theme is removed. So I want to run this when the theme is deleted:               delete_option( 'mysettings' );


title: how to remove the default title of Categories widget

text: hi i'm using the Categories widget show hierarchy. I leave the space for title because I don't need to show any title. but it then displays on the website as "Categories". how can I remove that?


title: How to enable/disable a hook with theme options

text: I am trying to use this function to add maintenance mode feature by adding this in my theme's functions.php and I am trying to use my theme options to enable/disable it. I realized when i check/uncheck this via theme options page, it doesnt work. My guess is, once the action is added, it cannot be disabled. I tried to add elseif condition with remove_action for the same hook, but that didn't work either..                       function mytheme_under_construction(){                      // if user is logged in, don't show the construction page                 if ( is_user_logged_in() ) {                     return;                 }                 $protocol = $_SERVER["SERVER_PROTOCOL"];                 if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )                     $protocol = 'HTTP/1.0';                 // 503 is recommended :  http://bit.ly/YdGkXl                 header( "$protocol 503 Service Unavailable", true, 503 );                 // or header( "$protocol 200 Ok", true, 200 );                 header( 'Content-Type: text/html; charset=utf-8' );                 // adjust the Retry-After value (in seconds)                 header( 'Retry-After: 3600' );                  ?>             <?php get_template_part('maintanance'); ?>             <?php                      die();                   }          global $mytheme;     if(!empty($mytheme['offline_id'])){     add_action( 'template_redirect', 'amytheme_under_construction' );     }      The onyl way it works is when I direclty add/remove the ! from this line:               if(!empty($mytheme['offline_id'])){      Can anyone help me with the issue? Thanks


title: Metabox nonce not allowing update

text:
I'm having a problem correcting saving metabox data on a custom post type. I thought I fixed it by applying the advice on this post: Metabox nonce PHP notice which does get rid of the warning but leaves me unable to update the metaboxes. Here is the code in question :               function save_goal_info_meta( $post_id ) {         global $goal_info_meta_fields;              // verify nonce         if ( ! isset( $_POST['product_noncename'] ) || ! wp_verify_nonce( $_POST['goal_info_meta_box_nonce'], basename( __file__ ) ) ) {             return $post_id;         }              // check autosave         if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {             return $post_id;         }              // check permissions         if ( 'page' == $_POST['post_type'] ) {             if ( ! current_user_can( 'edit_page', $post_id ) )                 return $post_id;         } elseif ( ! current_user_can( 'edit_post', $post_id ) ) {             return $post_id;         }              // loop through fields and save the data         foreach ( $goal_info_meta_fields as $field ) {             if ( $field['type'] == 'tax_select' )                 continue;                  $old = get_post_meta( $post_id, $field['id'], true );             $new = $_POST[$field['id']];                  if ( isset( $new ) && ! empty( $new ) && ( $new != $old ) ) {                 update_post_meta( $post_id, $field['id'], $new );             } elseif ( '' == $new && $old ) {                 delete_post_meta( $post_id, $field['id'], $old );             }         }     }          add_action( 'save_post', 'save_goal_info_meta' );      I understand more or less why it isn't updating but I can't seem to fix it without having an "Undefined Index".               $goal_info_meta_fields = array(             array(         'label' => 'Home Goals by:',         'desc' => 'Add and select home scorers',         'id' => $prefix.'home-scorers',         'type' => 'home_player_list'        ),        array(         'label' => 'Away Goals by:',         'desc' => 'Add and select away scorers',         'id' => $prefix.'away-scorers',         'type' => 'away_player_list'        )     );      Here is the output :               function show_goal_info_meta_box($field, $meta, $items = null) {         global $goal_info_meta_fields, $post;     // Use nonce for verification          echo '<input type="hidden" name="goal_info_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';          // Begin the field table and loop     echo '
';     foreach ($goal_info_meta_fields as $field) {         // get value of this field if it exists for this post         $meta = get_post_meta($post->ID, $field['id'], true);         // begin a table row with         echo '
                 '.$field['label'].'	                 ';         switch($field['type']) {                       // home_player_list         case 'home_player_list':             echo '+ '.$field['desc'].'
';             $post_id = get_the_ID();             $team_id = get_post_meta( $post_id, 'report_home-select');                  $items = get_users( array (                     'meta_key' => 'team-meta',                     'meta_value' => $team_id                 ));             $i = 0;                  if ($meta) {                 foreach($meta as $row) {                          echo '
|||';                     echo '<select name="'.$field['id'].'['.$i.']" style="width:200px;" id="report_home-scorers">                     <option value="">Select One</option>'; // Select One                     foreach($items as $item) {                         echo '<option value="'.$item->ID.'"',$row == $item->ID ? ' selected="selected"' : '','>'.$item->display_name.'</option>';                     }                     echo '</select>-
';                          $i++;                 }             } else {                 echo '
|||';                 echo '<select name="report_home-scorers[0]" style="width:200px;" id="'.$field['id'].'">                 <option value="NULL">Select One</option>'; // Select One                      foreach ($items as $item) {                     echo '<option value="" selected="selected">'.$item->display_name.'</option>';                 }                      echo '</select>-
';                  }             echo '
';             break;                  // away_player_list         case 'away_player_list':             echo '+ '.$field['desc'].'
';             $postid = get_the_ID();             $team_id = get_post_meta( $postid, 'report_away-select');                  $items = get_users( array (                     'meta_key' => 'team-meta',                     'meta_value' => $team_id                 ));                       $i = 0;             if ($meta) {                 foreach($meta as $row) {                     echo '
|||';                     echo '<select name="'.$field['id'].'['.$i.']" class="chzn-select" style="width:200px;" id="'.$field['id'].'" value="'.$row.'">                     <option value="">Select One</option>'; // Select One                     foreach($items as $item) {                         echo '<option value="'.$item->ID.'"',$row == $item->ID ? ' selected="selected"' : '','>'.$item->display_name.'</option>';                     }                     echo '</select>-
';                          $i++;                 }             } else {                 echo '
|||';                 echo '<select name="'.$field['id'].'['.$i.']" class="chzn-select" style="width:200px;" id="'.$field['id'].'">                 <option value="">Select One</option>'; // Select One                      foreach ($items as $item) {                     echo '<option value="" selected="selected">'.$item->display_name.'</option>';                 }                      echo '</select>-
';                  }             echo '
';             break;              } //end switch         echo '
';     } // end foreach     echo '
'; // end table     }


title: different image size in home

text: I have the home page in two columns and images of 312×100. The problem is that, when you go the category page, you see the list of posts but the images appear with sizes like the home, with 312×100. I need the images in home with 312×100 and in category with 980×200. This is how I have configured each column in the home:               <div class="left">          <?php if ( have_posts() ) : ?>          <?php while ( have_posts() ) : the_post(); ?>          <?php get_template_part( 'content', get_post_format() );?>          <?php endwhile; ?>          <?php endif; ?>          </div>      I don´t find anything to solve my problem, I put your code but the image is doubled.


title: Using Advanced Custom Fields with Associative Arrays

text: So, I've got this conversion chart I'm working with, and have stored its values in a simple array, wherein it lists both UK and US sizes:                $conversion = array(         "2.5" => "1",         "2.75" => "2",         "3.25" => "3",         "3.5" => "4",         "3.75" => "5",         "4" => "6"     );      I'm using Advanced Custom Fields on my WordPress site and am successfully retrieving the UK size via a Select Field. Now that's exactly what I want, except I also want to retrieve its US value from the `$conversion` array, so both values are displayed. I'm using a Repeater field with two child Select Fields (`min` and `max`) and a True/False Field (`to`). My code currently looks something like this:               <?php if( have_rows('repeater') ): ?>     <?php while( have_rows('repeater') ): the_row();          $min = get_sub_field('min');     $max = get_sub_field('max');          foreach($conversion as $uk => $us) {         if( get_sub_field('to') == true ) { // if ticked             if( $min == $uk ) {                 echo $uk . ' ' . $us;             }         }              else {             if( $min == $uk ) {                 echo $uk . ' ' . $us;             }         }     }          ?>     <?php endwhile; ?>     <?php endif; ?>      Now I need a way when checking my True/False Field for the page to echo both the UK values (`$min` and `$max`) and the US values (`$min` and `$max`). Right now it's only echoing the `$min` value for the UK and the US. I'd appreciate any help on how to achieve this. Thanks in advance!


title: How to change a post or page being edited to a file on the server

text: I am trying to change the post I am editing to a files file_get_contents() at the time of edit_form_after_title being called. I have tried using               function edit( $post_id ) {                $post_id = get_the_ID();                           $file = file.txt                 if (file_exists($file)) {                     $saved_edited_content = file_get_contents($file);                     ?>                     <script>                         window.onload = function() {                                  var content = document.getElementById("content");                             content.innerHTML = "<?php echo $saved_edited_content; ?>";                             var doc = document.getElementById('content_ifr').contentWindow.document;                             var body = doc.getElementsByTagName("body");                             body[0].innerHTML = "<?php echo $saved_edited_content; ?>";                         }                     </script>                     <?php                 }                  }     add_action( 'edit_form_after_title', 'edit' );      but this does not work if the file is long. So I am also trying               function edit( $post_id ) {                 $this->convert();             }             function convert() {                      $post_id = get_the_ID();                 $content =  get_the_content($post_id);                                if ($_SERVER['REQUEST_URI'] == '/wp-admin/post.php?post='.$post_id.'&action=edit') {                     $file = file.txt;                     if (file_exists($file)) {                              $saved_unedited_content = file_get_contents($file);                             $my_post = array(                                 'ID'           => $post_id,                                 'post_content' => $saved_unedited_content                             );                                  wp_update_post( $my_post );                     }                 }                 else {                     $file = editedfile.txt;                     if (file_exists($file)) {                         $saved_edited_content = file_get_contents($file);                             $my_post = array(                                 'ID'           => $post_id,                                 'post_content' => $saved_edited_content                             );                                  wp_update_post( $my_post );                     }                 }             }     add_action( 'edit_form_after_title', 'edit') );     add_action( 'the_post',  'convert') );      this way does not update the post when the edit page is used with the unedited content. I would like to be able to edit the post without changing what is shown to the website users until the edit is finished and then build the edited page and update the post. I would use shortcode but I am using slow apis and the load time with shortcodes is 60+ seconds. How can I update the post with the unedited content from the file when I am using the editor from wordpress. How do I make the post update when I go to edit the post?


title: How to get the parameters on page and avoid 404?

text: I have a page like http://mydomain.com/mypage and I want to set some $_GET parameter like that: http://mydomain.com/mypage/firstparameter/firstvalue I need "firstparameter" value but I always end in the 404 page. I've spent some hours with get_query_var(), add_query_vars_filter() and add_rewrite_rule() but no way... Thank you


title: How to make this menu drop down or like accordion

text: I am using sitesmile auction theme. Here is my working site. In home page there is a sidebar saying "Browse by Categories". I want to make this menu as drop down or like accordion. Whenever the user hover on the parent category, the sub category will appear. As it is the category of Custom Post Type, I can't figure that out. Here is an example, how I want mine:   ![Menu image](http://i.stack.imgur.com/TWli9.jpg)


title: Different plugins activated online and offline

text: I develop / add to / etc. my site offline, then transfer the updated database (in toto) to the live site. Some of the plugins I need / use offline, I don't need online, and vice versa. Is there a way to have one set of plugins active if the database is 'online' and a different set for 'offline'? Or do I just need to accept that whenever I upload a new version of the database I need to activate / deactivate as appropriate?


title: My WordPress menu based on Twitter bootstrap creates menu-item and not page-item

text: I've got a dynamic menu being generated, but instead of generating a **page- item** it generates a **menu-item**. What I would like it to do is generate page-items and all the rest of it so that I can show or highlight the current page a user is visiting. my code is :               // header.php          <?php // Loading WordPress Custom Menu         wp_nav_menu( array(             'container_class' => 'collapse navbar-collapse navbar-ex1-collapse',             'menu_class'      => 'nav navbar-nav',             'menu_id'         => 'main-menu',             'walker'          => new Cwd_wp_bootstrapwp_Walker_Nav_Menu()     ) ); ?>      And then in the functions.php I have               add_action( 'after_setup_theme', 'cwd_wp_bootstrapwp_theme_setup' );     if ( ! function_exists( 'cwd_wp_bootstrapwp_theme_setup' ) ):     function cwd_wp_bootstrapwp_theme_setup() {         // Adds the main menu         register_nav_menus( array(             'main-menu' => __( 'Main Menu', 'cwd_wp_bootstrapwp' ),         ) );     }     endif;


title: Incorporating Biology Database with Thousands of Records

text: I'm a WordPress newbie working on a Mac with MAMP. I have a series of database-driven websites that I'd like to incorporate into WordPress. My biggest website focuses on biology, especially animals. The main database table has over 50,000 records for vertebrates alone. I have it set up so that pages that don't have matching content in the database still display some kind of text through PHP includes (e.g. "Canis lupus (common name wolf) is a species in the family Canidae.") If I convert to WordPress, I obviously won't have time to create 50,000 blog pages, one at a time. Is there a way to import my database tables, or incorporate them into WordPress database tables, so that all 50,000 pages instantly display? And will I then be able to use a combination of PHP includes and database tables to insert text where no articles exist? If the answer's yes, I imagine the explanation is long and complex, but you don't need to go into the gory details. For now, I'd just like to know if it can be done, and it would help if you could offer a brief explanation or offer some key words I can use to Google for more information.


title: No option to add a 'featured image' in my wordpress installation

text: Hay, I've installed WordPress 3 on my server, and duplicated the stock theme and made some amends to it. However, when i add a post, i don't see an option to add a 'featured image'. Has this featured been removed? How do i reactivate it? Thanks


title: Meta box on options page save form problem

text: I have follow code from this link, https://gist.github.com/757903 and I have manage to create several metaboxes on my custom options page under Settings section. Stuff that doesn't work for me are :   1. I can't make it work, so save form work, I think that this hook doesn't exists "add_action('admin_post_save_howto_metaboxes_general', array(&$this, 'on_save_changes'));"   2. When I move boxes around, next time when I come back to that page, order of meta boxes is not saved, same thing for columns layout. Can someone help me with this please. Thank you in advance.


title: How can I customize "Pages" admin (edit.php) and "Edit Page" admin (post.php) for bulk edit of custom content type?

text: I think its probably easier than I think to do this, but currently its beyond me. If there are any plugins out there I'd prefer to start there rather than develop from scratch, but I'll do what I have to do. I have already created a custom content type called "biblio" that I will use to hold and display Bibliography info. Each entry will contain: **Title** : Will re-use page title field   **Abstract** : Will re-use content field   **Tags** : Will re-use Tags field   **Authors** : Custom field (with ability to add multiple)   **Date** : Custom field   **Publication** : Custom field   **Doc ID** : Custom field   **Link to external article** : Custom field   **Keywords** : Custom field (with ability to add multiple) **What I need**   1. A way to customize the edit post page for my custom content type to show only specified default and custom fields (may not be needed if I can get #2 below)    2. A way to be able to bulk edit these in a user friendly way (not using my PHPMyAdmin). I have tried a number of plugins. One really useful one is Custom Content Type Manager (thanks fireproofsocks, whoever you are). But I still need to be able to do the 2 things I mentioned above. By way of example there is a great set of plugins next gen gallery plus custom fields for next gen gallery that works how I would like the admin side of my custom content type. Any info leading to a way to do #1 #2 above would be greatly appreciated.


title: Get a button for <hr> in the Editor

text: Somehow the WordPress editor doesn't have a button to insert a horizontal line (`<hr />` in html). Is there a plugin that adds this button? Or an easy way to add such a button myself?


title: Row actions is removed

text: I want to show only edit, trash, view and clone as row actions. I add this code:               /** delete row actions quick edit and new draft**/           function remove_quick_edit( $actions ) {          unset($actions['inline hide-if-no-js']);          unset($actions['edit_as_new_draft']);          return $actions; } add_filter('page_row_actions','remove_quick_edit',99,1);      add_filter('post_row_actions','remove_quick_edit',99,1);                /** change name row action edit**/ function      rename_edit_action($actions) {          if (isset($actions['edit']))              $actions['edit'] = preg_replace('@>(.*)<@', '><b>bewerk</b><', $actions['edit']);          return $actions; }            if ('edit.php' === $GLOBALS['pagenow']) {          add_filter('post_row_actions', 'rename_edit_action');          add_filter('page_row_actions', 'rename_edit_action'); }           /** change name row action trash**/ function      rename_row_action($actions) {          if (isset($actions['trash']))              $actions['trash'] = preg_replace('@>(.*)<@', '>verwijder<', $actions['trash']);          return $actions; }            if ('edit.php' === $GLOBALS['pagenow']) {          add_filter('post_row_actions', 'rename_row_action');          add_filter('page_row_actions', 'rename_row_action'); }           /** change name row action view**/ function      rename_bekijken_action($actions) {          if (isset($actions['view']))              $actions['view'] = preg_replace('@>(.*)<@', '>bekijk<', $actions['view']);          return $actions; }            if ('edit.php' === $GLOBALS['pagenow']) {          add_filter('post_row_actions', 'rename_bekijken_action');          add_filter('page_row_actions', 'rename_bekijken_action'); }           /** change name row action clone**/ function      rename_kopieer_action($actions) {          if (isset($actions['clone']))              $actions['clone'] = preg_replace('@>(.*)<@', '>dupliceer<', $actions['clone']);          return $actions; }           if ('edit.php' === $GLOBALS['pagenow']) {          add_filter('post_row_actions', 'rename_kopieer_action');          add_filter('page_row_actions', 'rename_kopieer_action'); }      First it works, but now it doesn't show the row action 'clone' how can I add clone again as a row action Solved! the plugin duplicate-post must be activated.


title: Using WordPress publicize with main account and editor user accounts

text: I have a y.wordpress.com blog and I contribute to another x.wordpress.com under the role editor adding post contributions.The owner's account is set to publicize to Twitter any updates he/she makes. I do not have the credentials of the owner for x.wordpress.com. How can I publish a post so that it publicizes to their Twitter account and not mine ?


title: Widget Update Code Not Working

text: From what I can tell the widget API is pretty straight forward and simple, yet for some reason my update code isn't taking effect properly. When I press [save] from the backend all fields are blanked, and nothing is actually saved. When I drag my widget onto the sidebar region, an entry is created in the database for the widget.               1846, 0, 'widget_email-signup', 'a:2:{i:2;a:0:{}s:12:"_multiwidget";i:1;}', 'yes'      When I input values and save, none are saved. I've intercepted both `$new_instance` and `$old_instance` during the call to my update method and wrote their outputs to a file, but found nothing in them. Full Code: http://pastebin.com/gtrfuciZ **Update Method**               function update( $new_instance, $old_instance ) {       $instance = $old_instance;            $instance['title'] = $new_instance['title'];       $instance['script'] = $new_instance['script'];            file_put_contents( '/wp_results.txt', print_r( $old_instance, true ) );       file_put_contents( '/wp_results.txt', print_r( $new_instance, true ), FILE_APPEND );            return $instance;      }      **wp_results.txt** (data found within update method)               Array     (         [title] =>          [script] =>      )     Array     ( )


title: How can I add/append content to the_content on the home page via a plugin?

text: As a proof of concept, I'd like to create a simple plugin that loads some content, say "hello world" just after the_content on the home page only. How can I do this from a plugin?


title: Is Dreamweaver CS5 a serious choice for theme/plugin development?

text: I've heard that Dreamweaver has been improved significantly in latest versions. Does anyone have experience in developing a theme or plugin using Dreamweaver? What are the pros/cons? Thanks in advance


title: looking for navigation plugin (accordion)

text: does anyone know if there's a jQuery-navigation plugin with accordion animation which can be auto-applied to the wordpress default navigation? it should also support marking the current item (+ also its parent) - any ideas? thanks


title: What is best practice for writing/using custom PHP classes in a theme?

text: I want to use a custom PHP class in my theme, however I am not sure where to add it. Is there best practice used by the community for including PHP classes with a theme or is that an individual developer's decision? The first class I want to add is a custom menu Walker, however there will be more, and they will be tied to my theme. I am split between creating them in separate PHP files versus adding them to functions.php - or maybe there is any other ways please? Many thanks in advance for your input. Katrina


title: Exclude Sticky posts from Main Query break Pagination

text: I have a small problem with this function ! I would like to exclude all sticky post from my query but when I do it, it breaks my pagination. In the following code, when I remove the " **'post__not_in' => $sticky** " my pagination works like a charm... Any advice would be much appreciated ! Cheers.               /* Exculde STICKY from the main QUERY */     function exclude_cat(){         if (is_home()) {             $paged = (get_query_var('page')) ? get_query_var('page') : 1;             $sticky = get_option( 'sticky_posts' );             $args = array(             'category__not_in' => array( 71 ),             'ignore_sticky_posts' => 1,             'post__not_in' => $sticky,             'paged' => $paged             );             query_posts($args);         }     }


title: conditionally load javascript & CSS for do_action() calls from plugin

text: I am developing a plugin and using `do_action()` instead of shortcodes to display plugin content on the site. The plugin will only be used by me, but I am making the plugin to separate components of the site from the theme itself. How would I go about conditionally displaying javascript and css on a page, IF a specific do_action is called in a theme, from the plugin? I have found a ton on shortcodes but I wanted to avoid using shortcodes, as I will be calling the actions directly in the theme. I tried something like this               add_action('wp_footer', 'print_my_script');     function print_my_script() {         if(did_action('my_custom_action')) {             wp_enqueue_scripts('listings');             wp_enqueue_scripts('isotope');         }     }      **edit: its wp_enqueue_script() not scripts and changing that solved my problem** but it did not work. I also looked at Scribu's article on the subject for shortcodes and use globals, but that still did not work. I suspect that I might be able to rearrange priorities and make this work, but I am not sure.


title: Detecting post type within init action

text: I have an front-end ajax login on my site. I want to set the redirect url to `'/services/clientarea';` for every page that is not part of the blog. For blog pages i want the login redirect to be `$_SERVER['REQUEST_URI'];` Here is the code that I'm using which isn't working for me:               function ajax_login_init(){          wp_register_script('ajax-login-script', get_template_directory_uri() . '/library/js/ajax-login-script.js', array('jquery') );      wp_enqueue_script('ajax-login-script');          global  $post;     $posttype = get_post_type($post);          if ($posttype == 'post') {         $loginredirect = $_SERVER['REQUEST_URI'];     } else {         $loginredirect = '/services/clientarea';     }          wp_localize_script( 'ajax-login-script', 'ajax_login_object', array(          'ajaxurl' => admin_url( 'admin-ajax.php' ),         'redirecturl' => $loginredirect,         'loadingmessage' => __('Signing in, please wait...')     ));          // Enable the user with no privileges to run ajax_login() in AJAX     add_action( 'wp_ajax_nopriv_ajaxlogin', 'ajax_login' );     }          // Execute the action only if the user isn't logged in         if (!is_user_logged_in()) {             add_action('init', 'ajax_login_init');     }      It seems that the post type isn't loaded in the init hook. Is there any way to identify it?


title: Custom Taxonomy Term in Custom Permalink Gives 404

text: I developed a small plugin to be able to add a custom taxonomy as a string to a post. I've included the variable in a custom permalink string. This string is used by Apache to determine if external login is required. This part is working fine -- the permalink is being changed correctly, redirecting to Apache, and then causing the login to be prompted (it's our institution's flavor of PubCookie). I've looked at the database, and the custom permalink structure is correctly recorded in the wp_options table. I've tested other custom permalink structures, without variables, just to see that I had Permalinks set up correctly (mod_rewrite, etc.). So, in general, custom permalinks are functioning without 404 errors. However, once I put this particular variable string (the taxonomy term), whatever its value, into the permalink, I am getting a 404. Here is an example of a link that goes to a 404 with the proper taxonomy term in the the string (the variable, "unrestricted," indicates that it is public so does not prompt for a login): http://news.med.virginia.edu/deansoffice/latest/unrestricted/deans-welcome/ I have done the usual: gone to the Twenty-Thirteen theme, disabled plugins (except for the one I'm testing), and still nothing is working. I am now at a loss for what to do. Debug shows nothing. Does ANYONE have a clue? Here is the code:               //REGISTER THE TAXONOMY     add_action('init','uvasom_restriction_init');     function uvasom_restriction_init() {         if (!taxonomy_exists('uvasomrestriction')) {             register_taxonomy( 'uvasomrestriction', 'post',                array(   'hierarchical' => TRUE, 'label' => __('UVA SOM Restriction'),                     'public' => TRUE, 'show_ui' => TRUE,                     'query_var' => 'uvasomrestriction',                     'rewrite' => true,                     'capabilities'=>array(                     'manage_terms' => 'manage_options',//or some other capability your clients don't have                     'edit_terms' => 'manage_options',                     'delete_terms' => 'manage_options',                     'assign_terms' =>'edit_posts')                 )                 );          }          //ADD DEFAULT TERMS IF THEY ARE NOT THERE     $parent_term = term_exists( 'uvasomrestriction', 'uvasomrestriction' ); // array is returned if taxonomy is given     $parent_term_id = $parent_term['term_id']; // get numeric term id     wp_insert_term(       'UVA Only', // the term       'uvasomrestriction', // the taxonomy       array(         'description'=> 'Require UVA Netbadge credentials to read.',         'slug' => 'privatenbauth-uva-only',         'parent'=> $parent_term_id       )     );     }          //INSERT THE PROPER TERM INTO THE CUSTOM PERMALINK     add_filter('post_link', 'uvasom_restriction_permalink', 10, 3);     add_filter('post_type_link', 'uvasom_restriction_permalink', 10, 3);          function uvasom_restriction_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%uvasomrestriction%') === FALSE) return $permalink;              // Get post         $post = get_post($post_id);         if (!$post) return $permalink;              // Get taxonomy terms         $terms = wp_get_object_terms($post->ID, 'uvasomrestriction');         if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0])) $taxonomy_slug = $terms[0]->slug;         else $taxonomy_slug = 'unrestricted';            return str_replace('%uvasomrestriction%', $taxonomy_slug, $permalink);     }      Thank you for any clues you may have.


title: How to add nav menu items to a specific position within a menu

text:
I'm adding login/logout links to a nav menu using the following code:               function rp_add_login_logout_links( $items, $args ) {              $link = wp_loginout( get_permalink( get_option( 'woocommerce_myaccount_page_id' ) ), false );              if ( 'Shop Menu' == $args->menu ) {             $items .= '
' . $link . '
';         }              return $items;     }     add_filter( 'wp_nav_menu_items', 'rp_add_login_logout_links', 10, 2 );      Since `$items` is a string, I can really only easily prepend or append the links to the list. I need this link to appear before a certain menu item in the list, it would end up being the third item from the end. Is there another filter or method I could use to accomplish this? I tried using `strpos` to find the nav item I was looking for and manipulate the `$items` string but couldn't get it to match the menu item HTML.


title: How to add a "last" class to the last post in loop.php?

text: I need to add a "last" class to the last post that appears in loop.php. Can someone tell me how to accomplish this?


title: add if statement to the featured image

text: I have a featured image. I want to add an if statement to the size. For example, if the featured image height exceeds 500px I want to add something. Is that possible ?


title: Wordpress count child posts of each parent custom post type and use in json array for google maps jquery plugin

text: So i have been looking for a couple of days now and cant find a solution to this anywhere. It is a fairly bespoke request from a client... I am using a jQuery google maps plugin to add markers for each post (area) that the admin creates using a custom meta box with lat and long coordinates. Each of these markers has a tooltip associated with it. In the tool tip i have got some text, the title of each post used to create the marker itself and a permalink to the post (area). But i would like to display a count of all children posts (deals) of each of the posts (areas). I have this working on the (area) posts themselves but cannot get them to display in my map tooltips. This is the code i have so far i dont think i am far away from a solution but my php skills are still at a novice level so any help would be much appreciated.


title: How to retrieve "sticky" post outside the "loop"?

text: I need to display the "sticky" post in a section that is outside the "loop". Can someone tell me how to do this?


title: When to use _e and __ for the translation?

text: What is difference between `_e()` and `__()` functions for the translation? In what cases `e()` and `__ ()`should be used?


title: How to create my own sidebar in Twenty Eleven child theme?

text: When I go to configure widgets in Twenty Eleven theme, there are 5 "sidebars" available:   * Main sidebar   * Showcase sidebar   * 1st col of footer   * 2nd col of footer   * 3rd col of footer In a child theme, I'd like to support sidebar on posts which is quite easy using these instructions but at the same time, main sidebar on the homepage should be different from the sidebar on the single pages. Can I create a new "sidebar area" so that widgets can be dragged and dropped to it in the admin section? Or should I maybe use something like the 3rd column of a footer area (which I don't use in my blog) to support this? Would I them replace `get_sidebar()` with something different in the modified `single.php` file?


title: Image uploader with "Set Featured Image" link on front end

text: I am loading `upload-media.php` file using `thickbox` on front end where user can upload images to the post. **Question:** How to I trigger the `upload-media.php` so the link "set featured image" shows up on image manager, just like we see when we click on "set featured image" link on backend. ![Featured image](http://i.stack.imgur.com/0pAq6.jpg) **Here is the code for the thickbox:**               jQuery('.upload_media_button').live('click', function() {                 current_item = jQuery(this);                  container = "."+current_item.attr('rel');                  var request = url.media_upload+'?type=image&TB_iframe=true';                  //alert(request);                  tb_show('Image Manager', request);                  return false;             });                  window.send_to_editor = function(html) {                  var img_tag = jQuery('img',html);                  //var attachment_id = jQuery('img',html).attr('class').replace(/[^0-9]/g, '');                  current_item.siblings(container).prepend(img_tag).css("height: auto");                  tb_remove();             }      I know I can take the attachment ID and set the featured image after form submission but that's the **Plan B** ;)


title: conditional statement for profile pages

text: I'm using different headers for in my wordpress/buddypress setup and I need a conditional statement for member pages. So everything that comes after mysite.com/members/. How do I do that with something like is_page()?


title: Contact Form Security

text: Building my own contact form in Wordpress. Any there any security steps I need to consider other than the typical email etc validation and maybe a captcha. I am not sending any data to the database.


title: Engadget Like Featured Breaking Plugin

text: I am looking for a Engadget like **featured breaking** plugin. I have searched myself but did not found any relevant results. I would be very thankful for the help. ## EDIT: Here is a visual image of how it should look like. ![enter image description here](http://i.stack.imgur.com/sbmu6.png) Thanks in advance.


title: How can I create an upload page for (and only visible to) specific users?

text: I'm working on a WordPress site we have for some software my lab is developing. What I'd like to do is add a page that would allow collaborating groups to upload their data to us for testing, but that would be hidden from anyone else visiting the site (i.e. the collaborators would have to be logged in to see the page). Ideally they wouldn't see the dashboard when logged in, but that's not too much of an issue at the moment. Are there any plugins that would make this easy?


title: Have save_post write to database image meta

text: Programming rookie back again. I have been studying the `add_action('save_post','')` but I am having difficulty getting it to work for my needs. The concept is simple - update the database information for an attachment's meta info. Here's where I'm at. I have my `add_meta_box` working great with an input box that is pre-populated with the Camera information from image meta. If I make an edit in this Camera field and update the post, no matter what variation of `update_post_meta` I try, it's failing. For example:               $camera = $imgmeta['image_meta']['camera'];     $update = $_POST['exif_field_camera'];     update_post_meta($post_id, $camera, $update);      I am fearing a horrible rookie mistake here, since it's not working. The code I am using to retrieve the information and using it as part of my `add_meta_box` is:               $args = get_posts( array(     'post_type' => 'attachment',     'numberposts' => null,     'post_status' => null,     'post_parent' => $post->ID     ) );     foreach ($args as $attachment) {          $imgID = $attachment->ID;     $imgmeta = wp_get_attachment_metadata($imgID);     $camera = $imgmeta['image_meta']['camera'];     }      What would the code be to write the new Camera input box information?


title: Using new WP_Query in shortcode in a custom field causes the main post content to not display

text:
I've got a custom post type of files I'm trying to list using a new WP_Query. It works fine when I add the shortcode within the main post content. However, when I add the shortcode to a custom field (which I have set to display on the page along with the main content as a secondary "column"), the main content disappears! If I comment out the "while...have_posts()" and "endwhile" lines, the main content displays; however, even after commenting out every other line, the main content disappears unless I also remove the "while". I am pretty certain it has to do with using WP_Query (somehow it hijacks the loop), even though it shouldn't. Is there something I'm missing? Here's the shortcode:                  function ia_news_display_test($atts){ // [ia_news cat='category' num='numbertodisplay']          extract(shortcode_atts(array(             'cat' => 'any',             'num' => '2',             ), $atts));          $dirloop = new wp_query( array(          'post_type' => 'ia_news',          'category_name' => $cat,         'posts_per_page' => $num,         'orderby' => 'menu_order',         'order' => 'ASC'     ));          if ($dirloop->have_posts()){         $content = "
\n";         while ( $dirloop->have_posts() ) : $dirloop->the_post();             $custom = get_post_custom($post->ID);             $file_id = $custom["upload_file"][0];             $file_begin = $custom["begin_date"][0];             $file_end = $custom["end_date"][0];             if ('' != $file_end){$file_end = " to ".$file_end;}             $file_url = wp_get_attachment_url($file_id);                      if ('' != $file_url) { //CHECK FOR EXISTENCE OF FILE URL                    $content .= "
".$cat." ".$file_begin.$file_end."
\n";                 }         endwhile;         $content .= "
\n";     } else { $content = "nothing"; }          return $content;      }


title: My post repeats itself on the second page

text:
Hey the way i have my index coded is that it shows one full post and the rest of the post are excerpts, but when i click previous the 2nd page shows the same post from the first page, what can i do to change this. Here is my index.php file                                                                   <?php get_header() ?>
                <?php if (have_posts()) : ?>      <?php $count = 0; ?>           <?php       query_posts('cat=0'); while(have_posts()) : the_post();       ?>      <?php $count++; ?>           <?php if ($count <= 1) : ?>

<a href="<?php the_permalink() ?>" title="<?php printf( __('Permalink to %s', 'wpbx'), the_title_attribute('echo=0') ) ?>" rel="bookmark"><?php the_title() ?>

                         <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>                         |                         Published in <?php the_category(','); ?>

      <span class='st_facebook_hcount' st_title='<?php the_title(); ?>' st_url='<?php          the_permalink(); ?>' displayText='share'><span class='st_twitter_hcount'     st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'><span class='st_plusone_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'>

                     <?php the_content('
Read More     »
') ?>                     <?php wp_link_pages('before=
' . __( 'Pages:', 'wpbx' ) . '&after=
') ?>

       <?php the_tags( __( 'More On: ', 'wpbx' ), ", ", "\n" ) ?>
<span class='st_facebook_hcount' st_title='<?php      the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'><span class='st_twitter_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'><span class='st_plusone_hcount' st_title='<?php the_title(); ?>' st_url='<?php the_permalink(); ?>' displayText='share'>

<?php comments_popup_link( __( 'Leave A Comment', 'wpbx' ), __( '1 Reaction', 'wpbx' ), __( '% Reactions', 'wpbx' ) ) ?>

           <?php else : ?>

                         <a href="<?php the_permalink(); ?>" title="    <?php printf(__( 'Read %s', 'wpbx' ), wp_specialchars(get_the_title(), 1)) ?>">                         <?php the_post_thumbnail(); ?>

<a href="<?php the_permalink() ?>" title="<?php printf( __('Permalink to %s', 'wpbx'), the_title_attribute('echo=0') ) ?>" rel="bookmark"><?php the_title() ?>

                          <?php echo human_time_diff( get_the_time('U'), current_time('timestamp') ) . ' ago'; ?>                     |                     Published in <?php the_category(', '); ?>
                  <?php the_excerpt(); ?>

<a href="http://twitter.com/home?status=<?php the_title(); ?> http://celebloid.com/?p=<?php the_ID(); ?>" title="Share This Article On Twitter!" target="_blank"> <a href="http://www.facebook.com/sharer.php?u=<?php the_permalink() ?>" title="Share this on Facebook" target="_blank">

<?php the_tags( __( 'More On: ', 'wpbx' ), ", ", "\n" ) ?>

<a href="<?php the_permalink() ?>" title="<?php printf(__('Continue reading %s'), wp_specialchars(get_the_title(), 1)) ?>"><?php _e( '', 'wpbx' ) ?>

                <?php endif; ?>
          <?php endwhile; ?>            <?php else : ?>      <?php endif; ?>

<?php next_posts_link(__( 'Previous Articles', 'wpbx' )) ?>

<?php previous_posts_link(__( 'Next Articles', 'wpbx' )) ?>

           <?php get_sidebar() ?>
      <?php get_footer() ?>      The reason i query my post is because i made a custom featured content slide that only gets post from a certain category. Without the post being query it only pulls post from the category on the content slide.


title: How can I force the Wordpress visual editor to preserve the line breaks after paragraphs?

text: If I write and put a line break, it make the paragraph tags appropriately, but on this one page the line breaks aren't there: http://jacksongariety.com/gundoglabs/jobs


title: Display custom widget value in header.php

text:
I am using the code below for a custom widget. I have added some fields in the widget like: `Title`, `Name` and a checkbox. Now everything is fine but I want to show those values in header.php. Any idea or suggestions?               add_action( 'widgets_init', 'my_widget' );               function my_widget() {         register_widget( 'MY_Widget' );     }          class MY_Widget extends WP_Widget {              function MY_Widget() {             $widget_ops = array( 'classname' => 'example', 'description' => __('A widget that displays the authors name ', 'example') );                  $control_ops = array( 'width' => 300, 'height' => 350, 'id_base' => 'example-widget' );                  $this->WP_Widget( 'example-widget', __('Example Widget', 'example'), $widget_ops, $control_ops );         }              function widget( $args, $instance ) {             extract( $args );                  //Our variables from the widget settings.             $title = apply_filters('widget_title', $instance['title'] );             $name = $instance['name'];             $show_info = isset( $instance['show_info'] ) ? $instance['show_info'] : false;                  echo $before_widget;                  // Display the widget title              if ( $title )                 echo $before_title . $title . $after_title;                  //Display the name              if ( $name )                 printf( '
' . __('Hey their Sailor! My name is %1$s.', 'example') . '
', $name );                       if ( $show_info )                 printf( $name );                       echo $after_widget;         }              //Update the widget               function update( $new_instance, $old_instance ) {             $instance = $old_instance;                  //Strip tags from title and name to remove HTML              $instance['title'] = strip_tags( $new_instance['title'] );             $instance['name'] = strip_tags( $new_instance['name'] );             $instance['show_info'] = $new_instance['show_info'];                  return $instance;         }                   function form( $instance ) {                  //Set up some default widget settings.             $defaults = array( 'title' => __('Example', 'example'), 'name' => __('Bilal Shaheen', 'example'), 'show_info' => true );             $instance = wp_parse_args( (array) $instance, $defaults ); ?>                  //Widget Title: Text Input.
                 <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e('Title:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'title' ); ?>" name="<?php echo $this->get_field_name( 'title' ); ?>" value="<?php echo $instance['title']; ?>" style="width:100%;" />
                  //Text Input.
                 <label for="<?php echo $this->get_field_id( 'name' ); ?>"><?php _e('Your Name:', 'example'); ?>                 <input id="<?php echo $this->get_field_id( 'name' ); ?>" name="<?php echo $this->get_field_name( 'name' ); ?>" value="<?php echo $instance['name']; ?>" style="width:100%;" />
                       //Checkbox.
                 <input class="checkbox" type="checkbox" <?php checked( $instance['show_info'], true ); ?> id="<?php echo $this->get_field_id( 'show_info' ); ?>" name="<?php echo $this->get_field_name( 'show_info' ); ?>" />                  <label for="<?php echo $this->get_field_id( 'show_info' ); ?>"><?php _e('Display info publicly?', 'example'); ?>
              <?php         }     }     ?>


title: Non-Recursive get_term_children()

text: I have a custom taxonomy called `product_category`. There are child terms 3 levels down. They look like this:               Term1         Term2             Term3      When I am on the taxonomy page for Term1, I wish to use `get_term_children()` to retrieve Term2, without retrieving Term3. If that makes sense... Can this be achieved with get_term_children() or is there another function I can use?


title: Category Archive

text: What's is the best way to make an archive page have editable text, as opposed to hardcoding text into the template file? Here is what I am trying as per suggestion below.               <?php     if(is_category( '1' ))       echo category_description( );           ?>      Am trying this but for some reason I can not get it to work. This is on an ARCHIVE page and Codex suggests using is category for archive pages.


title: Custom Post Types. Are there any disadvantages/advantages in using a plugin to develop them?

text: There are a few plugins which can assist you in building your CPT's, and these can usually handle your taxonomies and sometimes postmeta also. Some even take it further than that. I know that as with any plugin it's possible that development may cease; but aside from that are there any reasons why it's better to code your own CPT's taxonomies etc. **Here are some of the plugins I'm referring to**   * Custom Post Type UI   * Types   * WCK    * Custom Post Type Maker **Here's my Advantage/Disadvantage list** _Advantages_   * Quicker and Easier    * Developers have hopefully considered security so no need to worry about nonces or protecting the database etc _Disadvantages_   * Might be a performance issue for some applications   * Depending on development to continue.   * Possibly Less Flexible Does anyone want to add to or take away from this list?


title: Get the selected custom taxonomy value for a specific post in the WordPress admin panel

text: I'd like to get the term value of a custom taxonomy attached to a post inside the wp-admin area, specially on the post edit page. Only one term value can be (is) selected for that specific taxonomy. I've tried the following functions without success: http://codex.wordpress.org/Function_Reference/wp_get_post_terms http://codex.wordpress.org/Function_Reference/get_the_terms I'm getting only errors or empty arrays. I know this must be tackled as outside the loop, but I'm stucked right now.


title: Hide featured post on second page

text: I have a index.php with a featured post and a number of other posts and the standard wp_pagenavi at the bottom. I'm using the 2 loops from the wordpress codex like this:               <?php $my_query = new WP_Query('category_name=featured&posts_per_page=1');     while ($my_query->have_posts()) : $my_query->the_post();     $do_not_duplicate = $post->ID;?>       <!-- Do stuff... -->     <?php endwhile; ?>       <!-- Do other stuff... -->     <?php if (have_posts()) : while (have_posts()) : the_post();      if( $post->ID == $do_not_duplicate ) continue; ?>      <!-- Do stuff... -->     <?php endwhile; endif; ?>      If I've read the theme hierarchy correctly, an archive.php page should be used when clicking "Previous" in the pagination section... (correct?) However, this is not the case, clicking previous is showing me a page with the same layout as my index.php and thus with the same featured post. (pagination on the other posts does work though) I've been messing around with `is_paged` but haven't been able to get it working... Thanks for the help!


title: How to show custom post type in hierarchy

text:
I want to show my custom post type in list pattern like ## S.No Title   * 6 samplePost1               - replypost      - replypost        * 5 samplepost2               - replypost        * 4 samplepost3 Here i am setting post_per_page count from admin so If admin set post count to 4 then on list page it should show 4 post including reply post. I am posting my code below please let me know how can i resolve this issue.                  <?php                  $args  = array(                     'post_type' => 'customposttype',                     'posts_per_page' => $posts_per_page,                     'paged' => $paged,                     'orderby' => 'post_date',                     'order' => 'DESC',                     'post_status' => 'publish',                     //'post_parent'=>0,                     'tax_query' => array(                         array(                             'taxonomy' => 'custompostcategory',                             'field' => 'slug',                             'terms' =>  $cat                         )                      )                     );              $my_query = new WP_Query($args);              $max_num_pages =  $my_query->max_num_pages;         $post_count =  $my_query->found_posts;         $i = $post_count - (($paged - 1 ) * $posts_per_page) ;         ?>
           <?php if ( $my_query->have_posts() ) : ?>

Sno.

Title

                  <?php while ( $my_query->have_posts() ) : $my_query->the_post();?>
                <?php //if($my_query->post->post_parent < 1) :?>
<?php echo $i; ?>

 <?php echo mb_substr(get_the_title(),0,30)?>
                  <?php  $i--;// else: ?>                 <?php //if($my_query->post->post_parent > 1) :?>                 <?php                      $r_args  = array(                         'post_type' => 'customposttype',                         'orderby' => 'post_date',                         'order' => 'DESC',                         'post_status' => 'publish',                         'post_parent' => $my_query->post->ID                            );                          $Rquery = new WP_Query($r_args);                  ?>                  <?php if ( $Rquery->have_posts() ) : ?>
                      <?php while ( $Rquery->have_posts() ) : $Rquery->the_post(); ?>

<?php echo mb_substr(get_the_title(),0,30)?>

                       <?php endwhile; ?>
                   <?php endif;//endif;?>
                 <?php   endwhile; // End While?>


title: Display only first level children of my custom taxonomy categories

text:
I'd like to display only first level children of my custom taxonomy categories I'am using wp 3.8 I've something like for my taxonomy "listing_category": Category 1 SubCattegoy1 Subsub category1 I'd like to display only a link to "sub category1" when I'am on "Category 1" (not "subsub category1"). With the code below It displays all sub cat and subsub cat :               $taxonomy_name = 'listing_category';     $queried_object = get_queried_object();     $term_id = $queried_object->term_id;     $termchildren = get_term_children( $term_id, $taxonomy_name );       echo '
';        foreach ( $termchildren as $child ) {        $term = get_term_by( 'id', $child, $taxonomy_name );       echo '
' . $term->name . '
';      }       echo '
';      Any ideas to help me ? Thanks


title: Organization of time insensitive content

text: I'm planning to use WordPress to maintain and publish a role-playing system. Is there a best practice for managing content in WordPress that isn't time sensitive? Should I use pages and make short notification posts when those are updated? I know posts and pages are stored the same, it's handling the creation and presentation that's giving me trouble. I want updates to be obvious, but without republishing entire sections of content.


title: I dont want to show shortcode in <pre> tag

text: I have a theme and I want to show vistors how shortcode format is in `<pre>` tag. But when I add shortcode in `<pre>`, it shows what shortcode does. I just want to show shortcode format in plain text. How to do that?


title: Custom Post Type and Breadcrumbs Conflict

text:
![An example of the extra space](http://i.stack.imgur.com/mRcFl.png) I have a custom post type. It seems the breadcrumbs have an extra space for a parent page (which does not exist) inserted. You can see this in the image I attached. What is happening with theis custom post type that is causing this extra, non- existent parent? Here is my custom page type:               add_action( 'init', 'register_cpt_result' );          function register_cpt_result() {              $labels = array(              'name' => _x( 'Case Results', 'result' ),             'singular_name' => _x( 'Result', 'result' ),             'add_new' => _x( 'Add New', 'result' ),             'add_new_item' => _x( 'Add New Result', 'result' ),             'edit_item' => _x( 'Edit Result', 'result' ),             'new_item' => _x( 'New Result', 'result' ),             'view_item' => _x( 'View Result', 'result' ),             'search_items' => _x( 'Search Case Results', 'result' ),             'not_found' => _x( 'No case results found', 'result' ),             'not_found_in_trash' => _x( 'No case results found in Trash', 'result' ),             'parent_item_colon' => _x( 'Parent Result:', 'result' ),             'menu_name' => _x( 'Case Results', 'result' ),         );              $args = array(              'labels' => $labels,             'hierarchical' => true,             'description' => 'My firm\'s case results',             'supports' => array( 'title', 'editor', 'excerpt' ),             'public' => true,             'show_ui' => true,             'show_in_menu' => true,                       'show_in_nav_menus' => true,             'publicly_queryable' => true,             'exclude_from_search' => true,             'has_archive' => true,             'query_var' => true,             'can_export' => true,             'rewrite' => true,             'capability_type' => 'post'         );              register_post_type( 'result', $args );     }      Here is my breadcrumbs function:               function crumbs() {         if ((is_page() && ! is_category()) || is_archive() || is_single() || is_single()) {             $crumbs = '';             $crumbs .= '
';             $crumbs .= 'Home';             $post_ancestors = get_post_ancestors($post);                  if ($post_ancestors) {                 $post_ancestors = array_reverse($post_ancestors);                 foreach ($post_ancestors as $crumb)                     $crumbs .= ''.get_the_title($crumb).'';             }             if (is_category() || is_single()) {                 $category = get_the_category();                 $crumbs .= 'cat_ID).'">'.$category[0]->cat_name.'';             }             if (!is_category())                 $crumbs .= ''.get_the_title().'';             $crumbs .= '
';             $close_crumb = '';             $open_crumb = '';             $separator = '→';             echo str_replace($close_crumb.$open_crumb, $close_crumb.$separator.$open_crumb, $crumbs);         }     }


title: Use different archive template for plugin

text: In my blog, I'm using a plugin for an encyclopedia. Unfortunately, the plugin uses the archive template from my blog. How can I use a different page / template for the encyclopedia? Here is the function of the plugin: (From the plugin-author I didn't get any support).               function Define_Rewrite_Rules(){     $post_type = Get_Post_Type_Object($this->post_type);     $archive_url_path = $post_type->rewrite['slug'];     $this->rewrite_rules[SPrintF('%s/filter:([^/]+)/?$', $archive_url_path)] = SPrintF('index.php?post_type=%s&filter=$matches[1]', $this->post_type);     $this->rewrite_rules[SPrintF('%s/filter:([^/]+)/page/([0-9]{1,})/?$', $archive_url_path)] = SPrintF('index.php?post_type=%s&filter=$matches[1]&paged=$matches[2]', $this->post_type);     }


title: wordpress simple loop, huge issues

text:
Im having a problem where for some reason, a basic loop im trying to add to a sidebar keeps....keeps looping on interior pages (single and page .php ) but not on index.php. on index.php (home page) is fine. for example, i wanted the loop to populate an unordered lists line items, so i went about it like this:

title4sidebar

                       <?php                  query_posts( array ( 'category_name' => 'left_sidebar', 'posts_per_page' => 4, 'orderby=menu_order' ) );                 if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink();  ?>"><?php the_title(); ?>
                 <?php endwhile; endif; ?>

      A few things are happening. 1. the MOST problematic is that when this loop is in place, it breaks the navigation and all. i click on a page and the page loads up with one of the list line items on the header...so if i click "about us" on the main nav, a page loads with "line item title" instead..... also happens on any item clicked. 2 - is that on the (page/single.php pages), on the sidebar, it will post the first 4 posts with the category "left_sidebar" how it should be displayed, css in place and all but after the fourth line item, it will repeat the loops one more time. 3 - My sites content area has 2 columns, the sidebar on the left, and the main content area on the middle. On the part that's being wrongfully repeated (after the loops repeats), when i checked with FireBug, on the repeated line items, its also taking the H tag properties from i assume, an h-tag thats next to it on another column. So the first 4 line-items come out fine with the styles given to them via CSS, link colors, rollovers etc, and the next buggy 4 line items come out un-styled, permalink also isnt being applied to them like the first 4 etc. 3 - i removed all html from that php loop like the divs and ul / lis etc so no css is being applied, this way only text come up from the loop but the same thing happens, Since i removed the html portion of the loop, the first 4 li's come up with the standard default blue link text etc, and the following buggy 4 come up the same as before all big with htags attached.... Troubleshooting it all, - theres only one loop on the page which stems from the sidebar. - ive properly cleared all floats - when checking on W3C for errors etc, there are none. green lights through and through. - no errors on the php side of things. (ive checked every page and have errors enabled) on local server. im lost. Any ideas as to what can be happening? NOTE: thinking ahead, although there is one loop ONLY on the sidebar.php page, once imported technically theres 2 loops which i guess is the sidebar wp loop, and the page.php / single.php loops which get the content. is there anything different as of the latest wp maybe? Ive always done it like this and now i have problems...... any ideas? im lost. Thanks in advanced.


title: Is the wp_enqueue method efficient?

text: I had a quick question regarding how you are supposed to load in scripts with Wordpress. I am developing a theme and I know that the best way to do this is to use the "wp_register_script/wp_register_style" methods and then to enqueue them with "wp_enqueue_script/wp_enqueue_style". Lastly, you add them to the action "wp_enqueue_scripts". My question is because I'm developing a theme, I have several javascript files I'm enqueueing. Is this a good practice to separate javascript files and enqueue each of them singlely, or should I combine all my javascript files into one file and enqueue just that one file? Ideally, I'd like to be able to keep the files separated for ease-of-future updating, but does this slow Wordpress down when serving your site if it has to enqueue all of those files every time? Does everytime Wordpress serves a page/post, does it have to run through these files, or after it runs once does it cache the files in some way? I guess I'd like a little more insight on how this action works. Just trying to streamline things best I can. Thanks in advance for the input guys!


title: What URL do you pass to wp_remote_get to load the body of the current post's preview?

text:
In the code below, I'm attempting to get a reference to the body content of the current post's fully rendered preview...               $response = wp_remote_retrieve_body(wp_remote_get('http://localhost/mysite/test-post/?preview=true&preview_id=28&preview_nonce=640bc54ca4'));     $post->post_content =  $response;      I'm just sending it to $post->post_content so that I can easily see it. Here's part of what it returns...
You do not have permission to preview drafts.
           I'm logged in as the administrator, so obviously I'm calling the preview wrong. How can I pass the URL in wp_remote_get to obtain the body section of the preview stream? When I use...               $post->post_content =  "
".$response['body']."
";      I get
<


title: How do I make wp_get_archives show me months where only pages were created?

text: I am creating a plugin and have a problem, this code gives my all months that post were added:                       <select name="sdate" id="sdate">         <?php wp_get_archives('format=option'); ?>             </select>       the problem is that i dont get dates that only pages were added. basicaly, i want dropdown thats gonna list every year+month (for example "September 2010") that something was added with value like "year-month" (for example "2010-05") Something that you can see working on Wordpress Export page, but copied code is not working for me.


title: get_term and get_term_by returning null or false eventhough the term exists

text: I am trying to use the action hook delete_term, delete_$taxonomy, among other hooks that delete a term but they are presenting the same issue. For example: `1234` is an existing term in the `favorite` custom taxonomy.               add_action( 'delete_favorite', function($term, $tt_id ) {              $get_term1 = get_term( $term, 'favorite' );         $get_term2 = get_term( 1234, 'favorite' );              $get_term_by1 = get_term_by( 'id', $term, 'favorite' );         $get_term_by2 = get_term_by( 'id', 1234, 'favorite' );         $get_term_by3 = get_term_by( 'name', 'term-name', 'favorite' );             $output = 'get_term1: ' . $get_term1 . ' get_term2: ' . $get_term2 .          ' get_term_by1: ' . $get_term_by1 . ' get_term_by2: ' . $get_term_by2 .          ' get_term_by3: ' . $get_term_by3;             ob_start();         var_dump($output);         $contents = ob_get_contents();         ob_end_clean();         error_log($contents);          }, 10, 2);      They all return nothing. So, how can I get the term inside this type of functions?? Please help me, this is driving me crazy. The functions get_term and get_term_by work everywhere else but inside these hooks. What is wrong?


title: WP_Query: Mixing category__in and tag__in together

text: I'm creating a "Related posts" section for my theme, based on a tutorial from wpbeginner.com. It offered two options in selecting posts: those in the same category(ies), using `category__in`, or those with the same tag(s), using `tag__in`. Is it possible to put of them into one big mixing pot, if you will, and select posts from all of them? I don't mean those that have the same category(ies) AND the same tag(s), but those that have either or.


title: Breadcrumbs using the Menu Structure.

text: I know there are several questions regarding how to use the menu hierarchy for breadcrumbs and I followed the instructions doing the following... I added this code to my theme's functions file:               /** Breadcrumbs from Menu Structure     -----------------------------------------------------------*/          function menu_breadcrumbs($theme_location = 'main', $separator = ' » ') {              $items = wp_get_nav_menu_items($theme_location);         _wp_menu_item_classes_by_context( $items ); // Set up the class variables, including current-classes         $crumbs = array();              foreach($items as $item) {             if ($item->current_item_ancestor || $item->current) {                 $crumbs[] = "url}\" title=\"{$item->title}\">{$item->title}";             }         }         echo implode($separator, $crumbs);     }      Then I added this to the page template:               <?php menu_breadcrumbs('primary-menu'); ?>      All this works, BUT... I really need the breadcrumbs to show all options for each main category, if that makes sense... For examples on my events page (http://www.sciotomile.com/events/), the code above creates a breadcrumb trail consisting of the main category and then the current page (like this: Events >> Events Calendar). For many sites this would be perfect, but my site doesn't have any subpages of subpages (in other words there are only 2 levels to my page structure). So I would like the breadcrumbs to show all options under the current category or tier and then underline or bold or whatever the current page... So instead of this: Events >> Events Calendar I would see this: Events >> **Events Calendar** >> Rhythm on the River >> FountainSide >> Jazz & Rib Fest >> Grand Illumination >> Plan an Event I would also like to see the option for "Home" provided... Anyway, if anyone can help me, I would really appreciate it :)


title: Alternative to wp_get_nav_menu_items?

text:
I have tried out a technique to implement the `wp_get_nav_menu_items`, however, a child on the level 1 is being nested inappropriately on the menu. Kindly suggest an alternative of how this issue can be handled.               <?php         $args = array (             'order'                  => 'ASC',             'orderby'                => 'menu_order',             'post_type'              => 'nav_menu_item',             'post_status'            => 'publish',             'output'                 => ARRAY_A,             'output_key'             => 'menu_order',             'nopaging'               => true,             'update_post_term_cache' => false );              $menu_name = 'header_menu';         $locations = get_nav_menu_locations();         $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );         $menuitems = wp_get_nav_menu_items( $menu->term_id, $args );?>
              <?php            foreach ( $menuitems as $item ) :             // get page id from using menu item object id             $id = get_post_meta( $item->ID, '_menu_item_object_id', true );             $page = get_page( $id );             $title = $page->post_title;             $link = get_page_link( $id );             // item does not have a parent so menu_item_parent equals 0 (false)?>                  <?php if ( $item->menu_item_parent == "0" ):                     // save this id for later comparison with sub-menu items                $parent_id = $item->ID;                     switch (strtolower($title)){                case 'home': $icon='home.png';                             break;                case 'about us': $icon='about_us.png';                                 break;                case 'services': $icon='services.png';                                 break;                case 'products': $icon='products.png';                                 break;                case 'energy solutions': $icon='energy_solns.png';                                         break;                case 'contact us': $icon='contact_us.png';                                   break;                default: $icon='';                }                ?>
             <a href="<?php echo $link; ?>" class="title">                 <img src="<?php echo bloginfo( 'template_url' ).'/images/icons/'.$icon; ?>" />                 <?php echo $title; ?>                          <?php endif;?>                  <?php if ( $parent_id == $item->menu_item_parent ):?>                      <?php if ( !$submenu ): $submenu = true; ?>                 <ul class="sub-menu" par_id="<?php echo $parent_id; ?>" count="<?php echo $count; ?>">                 <?php endif; ?>                          <?php                      // Retrieve second level menu through appropriate query                     $args = array (                                 'sort_order'   => 'ASC',                                 'sort_column'  => 'menu_order',                                 'child_of'     =>  $parent_id,                                 'parent'       => -1,                                    'post_type'    => 'page',                                 'post_status'  => 'publish'                             );                     $pages_under = get_pages($args); ?>
                         <a href="<?php echo $link; ?>" class="title"><?php echo $title; ?>                         <?php if ( count($pages_under)>0 ): ?>
                                      <?php foreach($pages_under as $page):                                          $id    = $page->ID;                                               $title = $page->post_title;                                          $link  = get_page_link($id); ?>
                                     <a href="< ?php echo $link; ?>" class="title">< ?php echo $title; ?>
                                 <?php endforeach; ?>
                         <?php endif; ?>
                     <?php if ( $menuitems[ $count + 1 ]->menu_item_parent != $parent_id && $submenu ): ?>
                 <?php $submenu = false; // endif; ?>                  <?php // if ( !$menuitems[ $count + 1 ]->menu_item_parent || !$menuitems[ $count + 1 ]->menu_item_parent==0 ): ?>
                                        <?php endif; ?>         <?php endif; ?>          <?php $count++; endforeach; ?>


title: Sortable Attachments Using 3.5 Media Uploader with Custom View

text:
I'm using the tutorial by Mike Jolley to integrate the media uploader introduced in 3.5 into a custom post type edit page. The pertinent HTML on the page is this:

             <button class="button manage-images">Manage Images</button>             Click the button above to add or edit images.

      And the following JS is called on the page:                   jQuery(document).ready(function() {             if(jQuery('.post-type-collection').length > 0) {                 iaa_collection_manager.setup();             }         });              var iaa_collection_manager = {                      setup: function() {                          var file_frame;                          jQuery('.manage-images').click(function(e) {                              e.preventDefault();                              if (file_frame) {                             file_frame.open();                             return;                         }                              file_frame = wp.media.frames.file_frame = wp.media({                             title: 'Manage Images',                             button: {                                 text: 'Finish',                             },                             multiple: true,                             library: {                                 type : 'image',                                 uploadedTo : wp.media.view.settings.post.id                             }                         });                              file_frame.on('open', function(){                             console.log(file_frame);                         });                              file_frame.on('close', function(){                             location.reload();                         });                     });                 }           }      It's working quite well except the images aren't sortable. What would be the best way to manage this?


title: Timeout While Upgrading Network in Multi-site

text: I updated from 3.8 to 3.8.1 on a Multi-site setup. The initial upgrade was fine. When I clicked "Upgrade Network" ... It fails after some time and prompts me with: > Your server may not be able to connect to sites running on it. Error > message: Operation timed out after 120000 milliseconds with 0 bytes > received. or > Your server may not be able to connect to sites running on it. Error > message: connect() timed out! The upgrade to 3.8 went just fine. However, the upgrade from 3.8 to 3.8.1 doesn't let me "Upgrade Network". Any idea why that would happen? I tried deactivating all plugins just in-case they might be interfering with the network upgrade. The problem still exists.


title: // Nonce generated 0-12 hours ago

text: [x-post: SO] In wordpress there's a nonce generating-verifying mechanism, and I'm having trouble understanding why it's not working correctly... At a point it checks for whether the nonce was generated 0-12 hours ago.               // \wp-includes\pluggable.php:1260      function wp_verify_nonce($nonce, $action = -1) {         $user = wp_get_current_user();         $uid = (int) $user->ID;         if ( ! $uid )             $uid = apply_filters( 'nonce_user_logged_out', $uid, $action );              $i = wp_nonce_tick();          >>> // Nonce generated 0-12 hours ago         if ( substr(wp_hash($i . $action . $uid, 'nonce'), -12, 10) == $nonce )             return 1;         // Nonce generated 12-24 hours ago         if ( substr(wp_hash(($i - 1) . $action . $uid, 'nonce'), -12, 10) == $nonce )             return 2;         // Invalid nonce              return false;     }      How does that `if` work? I see that `wp_hash($i . $action . $uid, 'nonce')`=`8ae70558afac4a6951e3bc0f9ef1f59a`   and `$nonce`=`3551`. How is `$nonce` being compared to `-12,10`th part of `8ae70558afac4a6951e3bc0f9ef1f59a` supposed to be a check for "0-12 hours ago"?


title: How to exclude uncategorized from permalink structure /%category%/%postname%/

text: I'm using a custom permalink structure:               /%category%/%postname%/      So that my posts are listed like:               mysite.com/widgets/blue-widget      This works fine as long as "blue-widget" exists in one and only one category. However, when it appears in more than one category, like perhaps a child of uncategorized, the resulting URL becomes:               mysite.com/uncategorized/child-of-uncategorized/blue-widget      Even though the post is still in "widgets", it appears that there is something that makes uncategorized trump it. I believe its because it has the lower id. I need to know if its possible to exclude uncategorized and any children of uncategorized from appearing in the permalink structure. **UPDATED EXAMPLE:** So, if a post is in 3 categories for example: Widgets (parent_id=0), Uncategorized (parent_id=0), Child of Uncategorized (parent_id=1) I want the filter to use "Widgets" as the permalink slug and exclude "uncategorized" and all of its children. If the post is in 2 or more categories that are not uncategorized or a child of uncategorized, then just use the newest category as the permalink slug. If the post is assigned solely to uncategorized or one of its children, then do not display a category slug permalink


title: URLs to images get messed up after migration

text: I migrated a website from one host to another, and I am having a weird issue I never encountered before. The urls to images in html are fine, but the full path to the image has a broken url, the domain outputs twice. So here is the code generated for an image: `<img src="subdomain.domain.com/wp-content/uploads/2013/12/aleksandra.jpg" class="attachment-full wp-post-image" alt="aleksandra">` And here is the full path to the image in inspector: `http://subdomain.domain.com/subdomain.domain.com/wp- content/uploads/2013/12/aleksandra.jpg` If you need more info please do not hesitate to ask. Any help is much appreciated. Thanks


title: Wordpress URLs changed to relative on transferring server

text: I have developed a Wordpress site on staging server. It is working absolutely fine. When I moved the site to live server, media upload URLs changed to relative. Staging media URL as image source:                     Live media URL as image source:                     Did I need to take care of something while moving site? Or this issue may be server dependent. Another cause what I think can be from the SEO plugin installed, I'm not sure about this. **Note:** Both servers are at different domains. Thanks in advance.


title: Code Highlighting in BlockQuote

text: Many of my Wordpress Blog(http://subinsb.com/) posts have code snippets which is wrapped in **blockquote** elements. I need to highlight these code snippets. I tried using **GeSHi** , **Prettify Code Syntax** , **CodeColorer** but none of them works for **blockquote** elements. Is there any plugin that supports code highlighting for **blockquotes** ? OR How can I customize the current highlighting plugins to highlight blockquote elements too ?


title: Why are previous_post_link/next_post_link skipping some posts?

text: I have a single page template for one of my custom post types. Are the top of this page I have...               <?php previous_post_link('%link', 'Prev Project'); ?>          <?php next_post_link('%link', 'Next Project'); ?>      These links seem to skip some posts, but not all of them. Any idea?


title: Adding Custom Post Type Counts to the Dashboard

text: The dashboard conveniently tells me how many posts, pages, and comments I have. I would like it to tell me how many articles, videos and cartoons I have too (three custom post types registered with my theme). How would I go about including these into the _"Right Now"_ panel on the dashboard? ![alt text](http://i.stack.imgur.com/f8LWg.jpg)