title: Performance with autoload and the options table

text: I am playing around with the `autoload` column of the `options` table. I didn't find much information about how the autoloaded values are used. I tried a `print_r($GLOBALS)` and saw that the autoloaded options are stored in `$GLOBALS['wp_object_cache']->cache['options']['alloptions']`. Is there another way to access those variables? Suppose I need to access an option `my_option`, which was set to autoload, multiple times in different templates (eg. once in `header.php`, once in `footer.php`), which method is recommended?   1. Is it okay that I retrieve it from the `$GLOBALS` array(since the value is already here)   2. Must I use `get_option('my_option')` once and globalize the variable **again**   3. Use `get_option('my_option')` each time (which I don't see the point of doing)   4. Something else


title: post_prev & post_next within same category

text: In my single blog view, I only want to show the Prior and Next buttons within the same category the current post is in. I thought I could just change these two lines thus (set first term to true). but that doesn't seem to ever display the buttons. Any suggestions ?               $post_prev = get_adjacent_post(false,'',true)  ? get_permalink(get_adjacent_post(false,'',true))  : false;     $post_next = get_adjacent_post(false,'',false) ? get_permalink(get_adjacent_post(false,'',false)) : false;      Thank in advance!


title: Include custom table into search results

text: How can I include custom tables into search results. My all custom tables has qa_ prefix and wordpress has default wp_ prefix


title: Get Advanced Custom Fields values before saving

text: Basically, I need to alter the info the user inputs into an advanced custom fields textbox before it is written to the database but I don't know how to grab it. I can only get it after it has been written to the meta portion of the database by using `get_field()`.


title: Redirect Problems with Archive Page and GET variables

text: I'm having an issue with a third party plugin called WP-Calendar, where clicking on the "next" and "prev" links in a small calendar results in a redirect error. This problem only appears to be happening on archive pages, as I have the calendar on the front page of a few MU pages and it does not have the same problem. Clicking the links basically adds the following to the URL: ?month=may&yr=2011 Which changes depending on the current month viewed. This leads me to believe that there's something up with the archive / category page accepting parameters through $_GET. To test this theory I tried ?a=b at the end, and I still got the same redirect error (The page isn't redirecting properly). Anyone know why the archive pages won't accept inputs through the URL? EDIT: Some additional information that I should've mentioned, I've tested all of the plugins and the problem still exists after disabling them. The theme being used is a style modified version of this: http://www.woothemes.com/2008/02/gazette/. Also the permalink settings are custom to: /%category%/%postname% and category base is . to get an URL such as myurl.com/category to work for a category landing page.


title: Get multiple db prefix with $wpdb

text: I have installed wordpress with question2answer as a single signon. The database created by wordpress with wp_ prefix and question2answer prefix is qa_ Now wordpress tables doesnt required to define prefix with $wpdb-> but how can I get question2answer table without query with prefix like I prefer something like as below               $titles = $wpdb->get_results("             SELECT title             FROM qa_posts // with qa_ prefix         ");      Its giving output of the title but i want something like below code where I dont have to define qa_ prefix same like wordpress default tables               $titles = $wpdb->get_results("             SELECT title             FROM posts // without prefix         ");


title: How do I correctly get all posts within the last year using the query_posts function?

text: Specifically, I am making a custom rss feed. I have modeled it after the rss2 feed that is in the wp-includes folder. I can successfully retrieve all posts using the standard query_posts('posts_per_page=-1'). Here is how I am attempting to get just the ones posted in the past year:               $today = date('Y-m-d');     $newdate = strtotime ( '-1 year' , strtotime ( $today ) ) ;     $ayearago = date( 'Y-m-d' , $newdate );          function filter_where($where = '') {             $where .= " AND post_date >= '" . $ayearago . "'";         return $where;     }          add_filter('posts_where', 'filter_where');          query_posts($query_string);      Yes this returns only posts from 2011 forward. Can someone help me figure out why? Here is the main source code from my custom feed page called feed- postlist.php:                   /**      * Custom RSS Feed      *      * @package WordPress      */          header('Content-Type: ' . feed_content_type('rss-http') . '; charset=' . get_option('blog_charset'), true);     $more = 1;          echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>          <rss version="2.0"         xmlns:content="http://purl.org/rss/1.0/modules/content/"         xmlns:wfw="http://wellformedweb.org/CommentAPI/"         xmlns:dc="http://purl.org/dc/elements/1.1/"         xmlns:atom="http://www.w3.org/2005/Atom"         xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"         xmlns:slash="http://purl.org/rss/1.0/modules/slash/"         <?php do_action('rss2_ns'); ?>     >     <?php     $today = date('Y-m-d');     $newdate = strtotime ( '-1 year' , strtotime ( $today ) ) ;     $ayearago = date( 'Y-m-d' , $newdate );          function filter_where($where = '') {             $where .= " AND post_date >= DATE('" . $ayearago . "')";         return $where;     }          add_filter('posts_where', 'filter_where');          query_posts('posts_per_page=-1');     ?>     <channel>         <title><?php bloginfo_rss('name'); wp_title_rss(); ?></title>         <atom:link href="<?php self_link(); ?>" rel="self" type="application/rss+xml" />         <link><?php bloginfo_rss('url') ?></link>         <description><?php bloginfo_rss("description") ?></description>         <lastBuildDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_lastpostmodified('GMT'), false); ?></lastBuildDate>         <language><?php echo get_option('rss_language'); ?></language>         <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>         <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>         <?php do_action('rss2_head'); ?>         <?php while( have_posts()) : the_post(); ?>         <item>      Thanks, Ryan


title: Trackbacks not displaying

text:
I'm building a new theme and I'm just working through the Theme Unit Test requirements in the Codex. I'm stuck on the Many Trackbacks test. My theme doesn't show any Trackbacks but for the test post but when I switch to Twenty Eleven they appear. The comment count is correct. Here's what I have in comments.php:               <?php $comment_list_args = array('style' => 'div'); ?>
         <?php wp_list_comments($comment_list_args); ?>
     <?php $comments_args = array(                 'title_reply' => __('
Leave a Comment
', 'mytheme'),                 'comment_notes_after' => '',                 'comment_field' => '
' . _x('Comment', 'noun', 'mytheme') . '<textarea id="comment" name="comment" aria-required="true"></textarea>
',                 'style' => 'div',             ); ?>
         <?php comment_form($comments_args); ?>
     <?php $pagination_args = array(                 'prev_text' => __('‹ Older', 'mytheme'),                  'next_text' => __('Newer ›', 'mytheme')             ); ?>
         <?php paginate_comments_links($pagination_args); ?>
      I've tried adding `'type' => 'all'` to the arguments for `wp_list_comments` but I get the same result. All help much appreciated!


title: Custom post type menu

text: The theme I have has its own admin menu using add_menu_page and add_submenu_page. Question: is there any way for me to add custom post types to this admin menu? Instead of the custom post type appearing in its own menu?


title: WP Search using taxonomy terms

text:
I have been looking for hours for an example on how to do this. I have 2 simple taxonomies, Type, Size. I need to create a custom form with the 2 taxonomies available as Select list/filter. Please help! tx in advance               <form role="search" method="get" id="searchform" action="<?php bloginfo('home'); ?>">                 <input type="text" value="" name="s" id="s" />                   <?php             function get_terms_dropdown($taxonomies, $selectname,$args){                 $myterms = get_terms($taxonomies, $args);                 $selected = "selected";                 $output ="<select name='".$selectname."'><option selected='".$selected."'>Select</option>'";                      foreach($myterms as $term){                     //$term_taxonomy=$term->$taxonomies;                     $term_slug=$term->slug;                     $term_name =$term->name;                     $output .="<option value='".$term_slug."'>".$term_name."</option>";                 }                 $output .="</select>";             return $output;             }                  $taxonomies = array('location');             $taxonomies2 = array('function');             $taxonomies3 = array('sector');             $args = array('order'=>'ASC','hide_empty'=>false);             echo "
".get_terms_dropdown($taxonomies,'location' ,$args)."
";             echo get_terms_dropdown($taxonomies2,'function' ,$args)."
";             echo get_terms_dropdown($taxonomies3, 'sector' ,$args)."
";             ?>             <input type="submit" id="searchsubmit" value="Search" />             </form>


title: Tracking last login and last visit

text: I'm using the code below to track when a user last logs in. I'm realizing though that if they checked the `Remember Me` option, this won't track their last **visit**.               // Catch the time they login and save it     function set_last_login($login) {       $user = get_userdatabylogin($login);       update_usermeta( $user->ID, 'last_login', current_time('mysql') );     }     add_action('wp_login', 'set_last_login');          // Function to display the time     function get_last_login($user_id) {       $last_login = get_user_meta($user_id, 'last_login', true);       $date_format = get_option('date_format') . ' ' . get_option('time_format');       $the_last_login = mysql2date($date_format, $last_login, false);       return $the_last_login;     }      In addition to the working code above for tracking login, I'm looking to see when the user was last active **if they are already logged in**. Any tips?


title: Adding Multiple "Parents" in get_categories

text:
I am using the below mentioned code to get top 5 child categories (by number of posts) from a Parent category. **The code works fine** , however I need to add more "Parent" categories so that I cant get total of Top 5 child categories from multiple parent categories.               Adding 'parent' => '599,588,590',  **Does not work.**      **The working code for single parent category.**               <?php     $args=array(       'orderby' => 'count',       'order' => 'DESC',       'parent' => '599',       'number' => '5'       );     $categories=get_categories($args);       foreach($categories as $category) {         echo '
term_id ) . '" title="' . sprintf( __( "" ), $category->name ) . '" ' . '>' . $category->name.' (' . $category->count .')
';      }     ?>


title: Get themes's images path in WordPress Multisite

text: I have installed a WordPress multisite subdomain network site, so for some blog, it can be accessed with this address               http://theme.example.com/blog      I tried to install theme, but it can't access all image used in the theme folder. Is there anythings i need to set up first? such as multisite settings or maybe using .htaccess?


title: Custom Page Template Category loop not functioning correctly

text:
So after several attempts to correct this - It seems the pages not load but don't pull in the correct posts from each category. It just seems to pull in the same default posts whenever I click each category link. I've attempted to customise the query but with no luck here is the code I'm using below.               <?php global $up_options, $post, $paged, $wp_query; ?>     <?php get_header(); ?>
             <?php $args = array(                 'title_li'           => __( '' ),             ); ?>
<?php wp_list_categories($args); ?>

Case Studies
            <?php          /* retrieves all the terms from the taxonomy portfolio */          $args = array(         'type' => 'post',         'orderby' => 'name',         'order' => 'ASC',         'taxonomy' => 'category');          $categories = get_categories( $args );          /* pulls 5 posts from each of the individual categories */          foreach( $categories as $catergory ) {         $args = array(         'posts_per_page' => 5,         'post_type' => 'post',         'category' => $category->slug,         'no_found_rows' => true,         'update_post_meta_cache' => false,         'update_post_term_cache' => false         );     }          $the_query = new WP_Query ( $args );         // the loop     while ( $the_query->have_posts()) : $the_query->the_post(); ?>         <div id="post-<?php the_ID(); ?>" class="post">                             <a href="<?php the_permalink() ?>">                                 <?php if (has_post_thumbnail()) { ?>                                     <?php the_post_thumbnail('thumbnail'); ?>                                 <?php }?>
<a href="<?php  echo get_post_meta($post->ID, 'lj_file_url', true) ?>" title="<?php the_title(); ?>"> <?php the_title(); ?>

     <a href="<?php echo get_post_meta($post->ID, 'lj_file_url', true) ?>" title="Download pdf <?php the_title(); ?>">                                  <?php the_excerpt(); ?>

                                     <?php endwhile;                                 ?>           <?php // Reset Post Data     wp_reset_postdata(); ?>
                         <?php wpld_pagenavi(); ?>

Secure Solutions

         <?php get_footer(); ?>      here is a link to the current page I'm working on here


title: Is it possible to display the admin bar while in the Theme Customizer?

text: I've been using Debug Bar + Kint Debugger for debugging. Presently I'm working on a custom theme where I'm trying to hook some code into customize_save_after. The code doesn't appear to be running when the theme is saved, so I'd like to be able to access Debug Bar so I can see the variables I'm watching. Is there any way to force the admin bar to show up in the theme customizer? My search results so far have have been full of people trying to get rid of the admin bar, not make it show up....


title: filter posts by meta key with pagination

text:
Trying to filter out specific posts that have certain meta_key from the main query... problem is it doesnt work with pagination which is my issue here. Anyone knows how to solve this?               $paged = (end( explode( '/', $_SERVER['REQUEST_URI'] ) )) ? end( explode( '/', $_SERVER['REQUEST_URI'] ) ) : 1;     $posts_per_page = 10;     $offset = ($paged-1) * $posts_per_page;          function strip_codes_deals ($where = '', $ignore_posts) {         global $wpdb, $ignore_posts;         if (count($ignore_posts) > 0) {             $where .= ' AND ' . $wpdb->posts . '.ID NOT IN(' . implode (',', $ignore_posts) . ') ';         }         //echo $where;         return $where;     }     $wp_query = new WP_query( 'post_type=deals&orderby=date&order=desc&posts_per_page='.$posts_per_page.'&paged='.$paged.'&meta_key=codes-deal' );     //          echo '
';     //          print_r($wp_query);     //          echo '
';     $ignore_posts = array();     if($wp_query) {         foreach ($wp_query->posts as $post) {             $codes_deal = get_post_meta($post->ID, "codes-deal", true);             if($codes_deal == 1) {                 $ignore_posts[] = $post->ID;             }         }         echo '
';         print_r($ignore_posts);         echo '
';                   }                    add_filter( 'posts_where', 'strip_codes_deals' );     query_posts( $query_string . '&post_type=deals&orderby=date&order=desc&posts_per_page='.$posts_per_page.'&paged='.$paged );     remove_filter( 'posts_where', 'strip_codes_deals' );      This works for the first page, but all other pages are ignored. Any ideas how to fix this?


title: can't change page slug

text: I created a page (with slug "page-title" say), then deleted it. I created a 2nd page with the same title, and it automatically saved itself with a page slug of "page-title-2". The first page no longer exists, not in the trash either, but I can't rename the 2nd page's slug to "page-title". How can I do so?


title: Need help with rewrite of Attachment URL

text: How can I change Attachments URL to               example.com/photos/attachment_ID/post_name/attachment_name      Thank you


title: Different Header Files Wordpress

text: How do I call a different header files in WordPress. For example, I made a wordpress theme with a variety of different display header. There header1.php, header2.php, header3.php, header4.php, header5.php. As shown below. * * * ![Header Layout](http://i.stack.imgur.com/AvFec.png) * * * So I want to call any of the headers in the Appearance> Menus in WordPress. This is the code that I have created: * * *               <?php         if($options['header_style']) {             if(is_page('header2')) {                 include_once('inc/header/header2.php');             } elseif(is_page('header3')) {                 include_once('inc/header/header3.php');             } else {                 include_once('inc/header/header'.$options['header_style'].'.php');             }         } else {             if(is_page('header2')) {                 include_once('inc/header/header2.php');             } elseif(is_page('header3')) {                 include_once('inc/header/header3.php');             } else {                 include_once('inc/header/header1.php');             }         }        ?>      * * * I've managed to do, but by selecting the headers used in Theme Options and indicate any changes in the selected header. So for the demo, I want to make that a user can see some of the views that exist in the header menu link 'Header Layout' Such, for example:               Header Layout      |_ Header 1 Layout (Calling header1.php)      |_ Header 2 Layout (Calling header2.php)      |_ Header 3 Layout (Calling header3.php)      |_ Header 4 Layout (Calling header4.php)      |_ Header 5 Layout (Calling header5.php)       How can I do that? and how to call any of the headers in the Appearance> Menus in WordPress? Thank you :)


title: Create Pop-Up Box with Custom Field Content Inside the Loop

text:
I tried this using ThickBox first, then tried using some code I had that worked on another website... Total failure. **The Goal:** I have a custom post type (product) with a ton of custom fields. I also have a page that says "display all of these custom fields, and for each one show custom fields X, Y, and Z." So far so good. Where it goes wonky is when I try to insert a popup or a collapsible element for one of the fields (sample_script). No matter what I try, whatever ends up working ONLY shows the sample_script value from the first item on the page/inside of the loop. So if you click on a link that should trigger a popup/hidden accordion that displays the contents of sample_script, you're ONLY getting the sample_script value off of the first one, not whatever other custom post you're looking at. **What I have Right Now:** This is the current code I'm working with that's trying to utilize animatedcollapse.js:                   <?php query_posts( array(     'post_type' =>'product',     'orderby' => 'title',       'order' => 'ASC',      'showposts' => 9999999,     'tax_query' => array(         array(             'taxonomy'  => 'Group',             'field'     => 'slug',             'terms'     => array( 'books','video' ),             'operator'  => 'NOT IN',         ),     )         ) ); ?>             <?php while ( have_posts() ) : the_post(); ?>
               <?php if( get_post_meta($post->ID, 'highspeed_daytime_mp3_code', true) ) { ?>
                                    <?php the_title( '
', '
' ); ?>                   <a href="<?php the_permalink() ?>" rel="bookmark"><img class="thumb" src="<?php echo get_post_meta( get_the_ID(), 'product_cover', true ); ?>" alt="<?php the_title(); ?>" width="142" />
                   What's On the Recording?

<img src="<?php bloginfo('template_directory'); ?>/images/btn_close_button.png" alt="Close">
                     <?php echo get_post_meta($post->ID, 'sample_script', true); ?>

<a href="http://www.ewebcart.com/cgi-bin/cart.pl?merchant=2465&add=01&item_id=<?php echo get_post_meta( get_the_ID(), 'highspeed_daytime_mp3_code', true ); ?>" target="_self"><img src="images/homebuyplatinum.gif" alt="<?php the_title(); ?>" width="75" height="30" border="0">

             <?php } else { ?>             <?php } ?>             <?php endwhile; ?>             <?php wp_reset_query(); ?>      Anybody super smart and excited to help a dummy? I'm drowning over here! I just need to hide the sample script for each item until the user clicks on it, then it either expands or pops up (I don't care which, I just need the stuff to show).


title: How to sort custom post type posts in default order by multiple fields?

text: I'm with a non-profit that paid for development of a custom post type plugin that will help us track endangered plants that we're keeping in cultivation, rescued from development. We're mostly happy with it, but need a bit of help. Our plugin is called nasc_report and we have multiple "authors" who are generating reports. The plants are cared for over time, so each year we ask for a census to be taken. So I'd like the default sort order to be ruled first by author (each author's posts will be grouped) and then by nasc_population_code (A to Z), and then by date (most recent on top). This will produce little groups of our cultivated plant material by population code but separate them by author. (As an aside, our growers are assigned a separate role that only allows them to see their own entries - all entries are private - but admins unfortunately see all and can't hide all but their own; admins are also usually growers. Any ideas on that would be welcomed as well. If we could allow admins the options: "All | Private | Mine" and make "Mine" the default screen, then I'd only need to default sort by nasc_population_code and then by date.) I've searched around but haven't found a direct answer to my question or if I have I haven't been able to understand it very well. Would I use pre_get_posts? I'm just a little lost in the code, here. Any help would be appreciated.


title: How do I make my wordpress post appear in a mouse hover preview?

text:
Mouse hover previews usually only show title and image. Instead, I want the entire wordpress post to show. The code that calls the preview is this:                adTitle = jQuery(this).find('img').attr('alt');                jQuery('body').append("

"+ adTitle +"

");                                jQuery('#preview')                                 .fadeIn('fast')      I want to insert a wordpress post instead. I have tried to insert the php code after `append("<div..."` but it destroys the whole page. Does anyone know how to insert the wordpress post that relates to the thumbnail into this javascript so that the post shows with `overflow-y: auto` scrollbar into the hover preview? * * * I'm not sure if this website caters to beginners, but I really only know how to cut and paste. The single ad listing code (single-ad_listing.php) is below. I'm wondering how to do what you have described above to insert it.                   <?php get_header(); ?>                    <?php // if($_GET['reportpost'] == $post->ID) { app_report_post($post->ID); $reported = true;} ?>

                          <?php if ( function_exists('cp_breadcrumb') ) cp_breadcrumb(); ?>
                                           <?php // if($reported) : ?>                                              <?php // else : ?>                                              <?php // endif; ?>

                          <?php appthemes_before_loop(); ?>                          <?php if ( have_posts() ) : ?>                              <?php while ( have_posts() ) : the_post() ?>                                  <?php appthemes_before_post(); ?>                                  <?php appthemes_stats_update( $post->ID ); //records the page hit ?>

                                          <?php appthemes_before_post_title(); ?>
<a href="<?php the_permalink() ?>" title="<?php the_title(); ?>"><?php the_title(); ?>

                                          <?php appthemes_after_post_title(); ?>

                                          <div class="bigright"<?php if(get_option($GLOBALS['app_abbr'].'_ad_images') == 'no') echo 'style="float:none;"'; ?>>
                                                  <?php                                             // grab the category id for the functions below                                             $cat_id = appthemes_get_custom_taxonomy( $post->ID, APP_TAX_CAT, 'term_id' );                                                  // check to see if ad is legacy or not                                             if ( get_post_meta( $post->ID, 'expires', true ) ) {  ?>
<?php _e('Location:', 'appthemes') ?> <?php echo get_post_meta( $post->ID, 'location', true ); ?>

<?php _e('Phone:', 'appthemes') ?> <?php echo get_post_meta( $post->ID, 'phone', true ); ?>
                                                      <?php if ( get_post_meta( $post->ID, 'cp_adURL', true ) ) ?>
<?php _e('URL:','appthemes'); ?> <?php echo appthemes_make_clickable( get_post_meta( $post->ID, 'cp_adURL', true ) ); ?>

<?php _e('Listed:', 'appthemes') ?> <?php the_time( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) ?>

<?php _e('Expires:', 'appthemes') ?> <?php echo cp_timeleft( strtotime( get_post_meta( $post->ID, 'expires', true ) ) ); ?>
                                                  <?php                                             } else {                                                      if ( get_post_meta($post->ID, 'cp_ad_sold', true) == 'yes' ) : ?>
<?php _e('This item has been sold', 'appthemes'); ?>
                                                 <?php endif; ?>                                                 <?php                                                 // 3.0+ display the custom fields instead (but not text areas)                                                 cp_get_ad_details( $post->ID, $cat_id );                                             ?>                                                            <?php                                             } // end legacy check                                             ?>

                                               <?php if ( get_option( 'cp_ad_images' ) == 'yes' ) : ?>

                                                      <?php cp_get_image_url(); ?>

                                                      <?php cp_get_image_url_single( $post->ID, 'thumbnail', $post->post_title, -1 ); ?>

                                          <?php endif; ?>

                                          <?php appthemes_before_post_content(); ?>
                                              <?php                                         // 3.0+ display text areas in content area before content.                                         cp_get_ad_details( $post->ID, $cat_id, 'content' );                                         ?>
<?php _e( 'Description', 'appthemes' ); ?>
                                              <?php the_content(); ?>
                                          <?php appthemes_after_post_content(); ?>

                                  <?php appthemes_after_post(); ?>                              <?php endwhile; ?>                                  <?php appthemes_after_endwhile(); ?>                              <?php else: ?>                                  <?php appthemes_loop_else(); ?>                              <?php endif; ?>

                              <?php appthemes_after_loop(); ?>                              <?php wp_reset_query(); ?>

                              <?php comments_template( '/comments-ad_listing.php' ); ?>
                      <?php get_sidebar( 'ad' ); ?>

          <?php get_footer(); ?>


title: Meta box not appearing in my custom post type

text: I followed this tutorial on how to create a metabox on a custom post type I made and, at the time, it worked perfectly. the fist time worked like a charm. This time though, In a very similar environment, it just doesn't. The funny thing is, I can see the option to show or hide the metabox in the admin page. Also, if I mess up the `add_meta_box` bit, it adds a PHP error table inside the metabox otherwise missing. Here's my current code in my functions.php:               // Custom post type arcticles     function create_arcticles()     {         register_taxonomy_for_object_type('category', 'arcticles'); // Register Taxonomies for Category         register_taxonomy_for_object_type('post_tag', 'arcticles');         register_post_type('arcticles', // Register Custom Post Type             array(             'labels' => array(                 'name' => __('arcticles', 'arcticles'), // Rename these to suit                 'singular_name' => __('arcticle', 'arcticles'),                 'add_new' => __('Adicionar novo', 'arcticles'),                 'add_new_item' => __('Adicionar novo arcticle', 'arcticles'),                 'edit' => __('Editar', 'arcticles'),                 'edit_item' => __('Editar arcticle', 'arcticles'),                 'new_item' => __('Novo arcticle', 'arcticles'),                 'view' => __('Ver arcticle', 'arcticles'),                 'view_item' => __('Ver arcticle', 'arcticles'),                 'search_items' => __('Procurar por arcticles', 'arcticles'),                 'not_found' => __('Nenhum arcticle encontrado', 'arcticles'),                 'not_found_in_trash' => __('Nenhum arcticle encontrado no lixo', 'arcticles')             ),             'public' => true,             'hierarchical' => false, // Allows your posts to behave like Hierarchy Pages             'has_archive' => true,             'supports' => array(                 'title',                 'excerpt'             ),             'can_export' => true,             'taxonomies' => array(                 'post_tag',                 'category'             ), // Add categories and tags             'register_meta_box_cb' => 'add_link_metaboxes'         ));     }          // Add the meta box     function add_link_metaboxes () {         add_meta_box( 'linkToArcticle', 'Link to arcticle', 'linkToArcticle', 'arcticles', 'default', 'normal' );     }          // Add Metabox content     function linkToArcticle() {         global $post;         // Noncename seems to be obligatory         echo '<input type="hidden" name="eventmeta_noncename" id="eventmeta_noncename" value="' .         wp_create_nonce( plugin_basename(__FILE__) ) . '" />';         // Pegar o link se ele já foi gerado         $link = get_post_meta($post->ID, '_link', true);         // Echo the link's field         echo '<input type="text" name="_link" value="' . $link  . '" class="widefat" />';     }


title: Primary Taxonomy for Post

text: My blog posts have have multiple items from my custom taxonomy attached to them. For the sake of this post lets just use Tags taxonomy... So a post may contain 4 tags, is there a way I can select one tag as the primary tag for the post?


title: Replace dashboard widgets with banner ad

text: I know it's probably not encouraged, but is there a way to replace the standard dashboard widgets (Recent Drafts, Quickpress, etc.) with a standard image banner ad? I know how to add new dashboard widgets, but I want this to be a plain image with no surrounding widget.


title: Sandwich Coding Standards

text: I recently spotted the code for a `wp-lunch.php` file intended for a WordPress template, what would this look like if following the proper WordPress coding standards? ![wp-lunch.php](http://i.stack.imgur.com/Y6e0Q.jpg)               <?php if ( current_user_can('has_sandwich') ): ?>              <?php get_sandwich_header(); ?>                  <?php while( has_filling() ): the_filling(); ?>                      <?php get_sandwich_part( 'thick_layer',         get_filling() ); ?>                  <?php endwhile; ?>              <?php get_sandwich_footer(); ?>          <?php endif; ?>


title: How to write a new file when new post has been published in Wordpress

text: I having a problam with my wordpress plugin. The plugin does whenever new post has been published, it will automaticly create a new file with that post content. this is my code               function example($post_ID) {         global $post;         $content = htmlentities(get_post_field('post_content', $_GET['post']));         file_put_contents(dirname(__FILE__) . '\myFile.txt', $content);     }     add_action('publish_post', 'example');      But when i change the code some think like this. this will working               file_put_contents(dirname(__FILE__) . '\myFile.txt', "Some string here");


title: how to separate categories in loop.php?

text:
I am trying to get all the posts in a specific category separated into 3 different sections. Each category will be in a different div. When I try doing this, WordPress lists every post in every category in each div. How can I get it so that it will only list the posts in each category? I tried to modify loop.php so that my code would look like this                //loop.php      <?php  if ( is_archive() || is_search() ) :

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

      endif;      The idea is that each category will sit in a div floated left so that each div will sit next to each other. So I would have three divs, three categories and each div would only list the posts title in that category. for example, div 1: 4 posts div 2: 3 posts div 3: 6 posts Each div only showing the category posts related to that section.


title: How can I convert some categories to a custom taxonomy?

text: I have a WordPress install that has a ton of categories. I want to convert some of these categories into a custom taxonomy. For example, I have: Categories:   * Category A      * Subcategory 1     * Subcategory 2   * Category B      * Subcategory 1     * Subcategory 2   * Category C      * Subcategory 1     * Subcategory 2 And I would like to make Category C and all of its subcategories into a completely separate custom taxonomy. Is there a way that I can make this conversion, while keeping the relationships between Category C and existing posts intact?


title: Should I use add_filter for functions in function.php of the theme?

text: I have written few functions in the function.php file of the theme. Should I use `add_filter` function for those functions?


title: Getting a List of Categories for Use in a Plugin?

text: I need to access a list of all categories for a plugin I'm working on, I know that there is the `wp_list_categories` template tag for use in themes. What would be the best way of accessing these categories for use in a plugin? Is there a specific function or is it a case of writing a specific query? **Edit** : Here's a screenshot which shows the context of how I'm trying to display a list of categories: ![alt text](http://i.stack.imgur.com/3vXNs.png)


title: How to display the 5 latest post titles but allow only 1 in there of a specific category

text: The question probably needs some clarification so here I go: I'm building a carousel displaying the titles of the 5 latest articles. However, from a specific category (called schaft in my case) it should only display one post even though the 5 latest posts might have this category in there multiple times. If this is the case, it should display the latest one, but skip the following ones an jump to the next item in the query. I've got this working by using two loop functions. The first one is checking if there are excess schaft categories in the query, skipping to the next one if necessary and repeating the whole function adding 1 to the number of posts the query has to display until it displays 5 posts even without the excess schaft categories. It will then run a function with the loop actually displaying the post titles The problem is that it has to repeat the query a lot of times and I'm pretty sure this is not efficient. Maybe someone can tell me how to do this the right and efficient way? I've added my code for clarity.               function carouselimages( $postsinloop ) {          if ( !$postsinloop) { $postsinloop = 5; }     $i = 0;     $schaft = 0;          $schaft_duplicate_query = new WP_Query('posts_per_page='.$postsinloop);     while($schaft_duplicate_query->have_posts()) : $schaft_duplicate_query->the_post();                  $category = get_the_category();             $category = $category[0]->slug;                  if ( $category == 'schaft' ) {                       $schaft++;                      if ( $schaft >= 2 ) { continue; }             }                   $i++;          endwhile;     wp_reset_postdata();          $postsinloop++;     if ( $i < 5 ) { carouselimages( $postsinloop ); }     if ( $i == 5 ) { carouselloop($postsinloop); }          }


title: Limit image upload to 10

text: Based on this previous WPSE question: I tried a limit of 10 files, but it did not work:               if ( count( get_posts( "post_type=attachment&post_parent={$post_id}" ) ) > 10 )      How to limit it to 10 images? Thanks


title: How to initialize $wpdb?

text: I have a .php page in the theme root to check the data of one CUSTOM form. After receiving this data I need to do a query in a custom mysql table, so I need $wpdb, but I can't use it directly (or doing `global $wpdb`) because it is a phisical .php file, so the rewrite rule will not affect the request (the request is not passed to index.php because the file exists). So In this case how can I create an object $wpdb? Thanks


title: How can I create a plugin installation link?

text: Currently, my code is generating the wrong nonce, I guess. Here is the code:               $action = 'install-plugin';     $plugin = 'akismet';     wp_nonce_url(         add_query_arg(             array(                 'action' => $action,                 'plugin' => $plugin             ),             admin_url( 'update.php' )         ),         $action     );      Which generates the following url:               http://www.example.com/wp-admin/update.php?action=install-plugin&plugin=akismet&_wpnonce=27ac98eeeb      When it should generate (notice the different nonce):               http://localhost/WordpressEN/wp-admin/update.php?action=install-plugin&plugin=akismet&_wpnonce=a625535dd6      clicking on the first link causes WordPress to throw a 403 forbidden error with the message: > Are you sure you want to do this?


title: How to register a user to a group by an invitation code?

text: I'm working on a site where I'd like anyone to be able to sign up, but people who sign up with an invitation code would automatically be registered to an existing group associated with that code. How can I do this? I have not yet chosen how groups will be created, but I know that this can be done with one of these plugins: Groups, User Groups or Simple Groups. The same with invitation codes, there are very good plugins for this: CM Invitation Codes, Register Plus Redux or Pie Register. What is missing is an intermediate tool (code/function) that will associate some groups with some invitation codes.


title: Store source permalink on XMLRPC calls

text: In a theme I'm developing, I need to link to the source post when the post has been stored using XMLRPC. That implies that every time Wordpress asks for a permalink (using get_permalink()) the theme will return a previously saved link. That's accomplished by adding a new filter:               add_action('the_permalink', 'filterPermalink');          function filterPermalink($url) {         $permalink = get_previously_saved_permalink(get_the_ID());         return $permalink? $permalink : $url;     }      That's not the problem (by the moment). The problem is, how to make the same with the _metaWeblog.newPost_ function. I've already tried something like this:               add_filter('xmlrpc_methods','xml_rpc_functions_to_add');          function xml_rpc_functions_to_add($args) {         $args['metaWeblog.newPost'] = 'add_permalink';         return $args;     }          function add_permalink($args) {         // Do it     }      What I need is to know how to call the previous 'metaWeblog.newPost' from 'add_permalink'.


title: How do the pros code up a WordPress theme? Locally? Through FTP?

text: Up until now, I've been building my WordPress sites by transferring files through FTP. This can sometimes get really slow (time it takes to upload the file, Firebug slows to a crawl, etc.) and I was wondering how all the pros do it. I heard about installing something locally on your computer and building everything there? I'm new to this whole concept of building a site locally and would appreciate some guidance—mostly to speed up my development time. Thanks in advance.


title: Does a plugin's "main" file need to be named the same as the folder containing it?

text: I remember - many moons ago - debugging a plugin that I was building for a very, very, long time. The only thing that fixed my issue (which I can't remember for the life of me), was to name the plugins main file (the one with the plugin header) the exact same name as the plugins folder. Since then, I have never named the plugin file anything other than the name of the folder. Is this necessary for any core functionality to work, or am I just being superstitious?


title: new theme permissions don't allow me to edit

text: When I use wordpress to install a new theme it creates the permissions and ownership in such a way that I can't edit the files via FTP. Any ideas? (Using Plesk)


title: Comment_form and GD Star Rating

text: I'm finding GD Star Ratings a bit complex to work with. I'm using the comment_form function to generate a custom "review" form on a custom post type. At the top of the form, I want reviewers to leave their rating. I am _guessing_ that I want to hook into the "comment_form_top" action with one of the gd star ratings functions. Am I thinking the right direction? If so, do any of you have a code sample I could refer to? I'm having a hard time finding much in terms of documentation. Any ideas and suggestions are welcomed - Thank you!


title: 500 Internal Server Error when Trying to Save Menu

text: I've got a few dozen pages in my menu. When I try to add new pages to the menu, then Firefox gives me the "connecting" message int eh tab and it eventually stops after a few minutes and gives me an 500 Internal Server Error. The problem is intermittent. I'll be able to add a few pages to the menu without a problem and then run into the error again and lose many of the menu items that I had saved. I use HostGator and I have the dedicated server option. I submitted a ticket to HostGator to work on it. I'm running WP 3.1 I looked at the server's error log and saw these entries: > [Mon Jul 11 14:40:42 2011] [error] [client 74.202.255.243] SoftException in > Application.cpp:303: UID of script "/home/mysite/public_html/wp- > admin/index.php" is smaller than min_uid > > [Mon Jul 11 14:40:38 2011] [error] [client 216.110.94.228] SoftException in > Application.cpp:303: UID of script "/home/mysite/public_html/wp- > admin/index.php" is smaller than min_uid > > [Mon Jul 11 14:40:36 2011] [error] [client 74.202.255.243] SoftException in > Application.cpp:303: UID of script "/home/mysite/public_html/wp- > admin/edit.php" is smaller than min_uid, referer: http://www.mysite.com/wp- > admin/ > > [Mon Jul 11 14:27:31 2011] [error] [client 74.202.255.243] SoftException in > Application.cpp:303: UID of script "/home/mysite/public_html/wp- > admin/index.php" is smaller than min_uid > > [Mon Jul 11 14:27:30 2011] [error] [client 74.202.255.243] SoftException in > Application.cpp:303: UID of script "/home/mysite/public_html/wp- > admin/index.php" is smaller than min_uid > > [Mon Jul 11 14:27:22 2011] [error] [client 74.202.255.243] SoftException in > Application.cpp:303: UID of script "/home/mysite/public_html/wp- > admin/index.php" is smaller than min_uid > > [Mon Jul 11 14:27:19 2011] [error] [client 74.202.255.243] SoftException in > Application.cpp:303: UID of script "/home/mysite/public_html/wp- > admin/index.php" is smaller than min_uid > > [Mon Jul 11 14:27:18 2011] [error] [client 74.202.255.243] SoftException in > Application.cpp:303: UID of script "/home/mysite/public_html/wp-admin/nav- > menus.php" is smaller than min_uid Any suggestions on what to do? Could this have something to do with it? Thank you! -Laxmidi


title: Limit archive widget results

text: Is there a way to limit the amount of months shown in the Archive widget? I don't want to use a drop-down list (I can manually add a drop down in my footer so people can get the full archive). I'm currently showing 19 months in my Archive list, and want to limit it to 7. I know you can do this manually, but that would mess up my theme, so I wanted to do this with the Archive widget.


title: Include a metabox in the 'home' screen of a custom post type? If not, then the dashboard page?

text:
I have a page with a simple YouTube embed. I would like the client to be able to easily switch the video id from the dashboard without having to edit any templates. Something like this: `<iframe width="576" height="324" src="http://www.youtube.com/embed/<?=$video_id ?>"></iframe>` So I'm trying to insert a metabox in the home page of the respective custom post type (see below) but am not sure how to go about it. ![enter image description here](http://i.stack.imgur.com/hVEA3.png) Is something like this possible? If not, is there a way to insert a metabox into the 'home' dashboard page of the WordPress dashboard? I'm open to any suggestions as well. Thank you. - Update - This is what I currently have in my functions.php:               // YouTube Metabox     add_action('wp_dashboard_setup', 'custom_dashbox');          function custom_dashbox() {       global $wp_meta_boxes;       wp_add_dashboard_widget('widget_slug','Featured Video', 'widget_display','widget_submission');     }          function widget_display() {       echo 'YouTube ID

<input type="text" name="youtube_id" />

       <input type="submit" name="submit_youtube" />';     }          function widget_submit() {       //Do what you need to do with your youtube id possibly:       if (get_option('youtubeid'))       {         update_option('youtubeid',$_POST['youtube_id']);       }       else {         add_option('youtubeid',$_POST['youtube_id']);       }     }


title: Query multiple meta values

text: I'm working on a 'checkbox filter' to query posts by checked values. See this link ( _EDIT_ : As you can see there are just 2 posts in this link, as soon as the user checks for 'MINI' it gets a good result, as soon as the user checks 'MINI' and 'COMPACT', it gives no results instead of the 2 posts). Now it works if the user only checks 1 value. As soon as the user the checks more then one it will give no results. I'm using following meta query code (it's part of a longer code, that's why there is the if statement):               if (gap_meta_values($key, $value)) {                 $args['meta_query'][] = array(                     'key' => $key,                     'value' => $value,                     'compare' => 'LIKE'                      );      So this works if there is only 1 meta value. However if there are more than one values it does not work. So I tried several things to get it work, I tought it was because there's no relation between the key and value. So I tried this:               if (gap_meta_values($key, $value)) {                 $args['meta_query'][] = array(                 'relation' => 'OR',                     array (                     'key' => $key,                     'value' => $value,                     'compare' => 'LIKE'                     )                  );             }      But this neither seem to work. How to make this works so it will query all posts from the checked values? Thanks for your response.


title: If menu has submenu, add parent as first child

text: I am using CSS framework (Metro UI, but this is a problem in Bootstrap too). When I set parent menu, the item itself isn't clickable, it's only toggle for its submenu. I tried to change JS and CSS so it works on hover, but this solution is bad for lower resolution devices (they can't open submenus). So I need to add current parent item as its own child, if you know, what I mean. I can do it manually by assigning duplicate menu as its own child, but it would be better this way, because I could add something like:   1. Category      *       1. Category (clickable)     * divider -     * 1.1 Subcategory     *       * 1.1 Subcategory (clickable)     *       * divider     *       * 1.1.1.... etc. Many thanks for any idea! EDIT: So basically I am looking for something like:               if ( $item->has_children ) {          // add $item as first child, then add real children          }


title: Adding “ ” before the last word in multiple defined areas with a plugin

text: How would this be done with javascript or a plugin? This would prevent widows from happening in my WordPress posts. Shaun Inman has created a similar plugin for post titles, but not for actual posts. Can his plugin be modified to include posts? http://shauninman.com/archive/2006/08/22/widont_wordpress_plugin Here is a screenshot of my post with a widow: http://cl.ly/image/0A0j383H0Z2U


title: Get all images in post and comments like Twitter before post title

text: I want to know if it's possible to get all the `images` that are in a post and his `comments`, make them a thumbnail and put it before (or in a sidebar or something) the post title to show, just like `Twitter` does. Of course it would be wonderful if you navigate to the comment where it was inserted if you click on a `thumbnail`, but that's something for later. Is this possible, if so, how? PS: I am not using a plugin, I just want to know if it can search for all the `<img>` tags and make them thumbnails out of no where...


title: Add a new confirmation page before saving

text: I'm going to add a hook that does some modifications of the text before saving. Before making the changes permanent, I would like the user to confirm the changes after a "save_post" hook. Is there a way to redirect to an intermediate page before finally saving?


title: custom search results affected by _REQUEST set

text: I am displaying search results in order of number of views or recency. To set the initial search results view to "views" I have this in my code:               if( !isset($_REQUEST['sorting'])) {         $_REQUEST['sorting'] = "views";     }      However, if I include this code, then if there are no matches, it still displays all of the results for that category. If I remove this code, the search results display correctly. How can I set the default view without destroying the search results? And why does this code affect it?? Thanks!


title: Related Taxonomy Doesnt Show any Posts

text: Doesnt Show Any Results               <?php          $query = array(         'tax_query' => array(                  'relation' => 'AND',                  array (                 'taxonomy' => 'location',                 'field' => 'slug',                 'terms' => array( 'california', '' ),             ),                  array(                 'taxonomy' => 'genre',                 'field' => 'slug',                 'terms' => array( 'comedy', '' ),             )         )     );               $query = new WP_Query();               ?>       Doesnt Show Any Results :( No Posts are displayed, Need Help thanks


title: SQL query to delete comments older than 90 days?

text: I'm working on a site that has 150,000 comments with an obvious hit in performance; is there an SQL query that can delete all comments older than say 90 days? They're not spam comments, and they are all approved; they're just too numerous. And: what about bulk changing all posts older than 90 days to untick "Allow comments" and "Allow trackbacks and pingbacks"? So they don't get re- commented?


title: Can't update old posts 3.5.2

text: **Background:** I'm working on a customers site that I haven't build myself. The site works pretty ok, when I got it the wp_header and wp_footer was missing and the javascript files were all linked to before the body tag was closed. WordPress 3.5.2 **Issue:** There is this problem with old posts and printing the updated content. The content is printed in a foreach where the attached images of one posts should be displayed. For some reason the old content is stuck there. I can update the post, see the content of the post, but I cant see the new content on the specific place where I'm trying to display it. The foreach results in a scrolling div that is moving back and forward with the images. **I've tried:** Repairing the database, to disable all of the plugins, update WordPress and all the plugins. **I don't have:** Access to edit the database. I would really appreciate some help with this if possible. Been searching for a solution almost a whole day now. **Code:**               $bottomSliderImages = get_posts(         array(              'numberposts' => -1,              'post_parent' => 54,                   'post_status' => 'inherit',              'post_type' => 'attachment',              'post_mime_type' => 'image',              'order' => 'ASC',              'orderby' => 'menu_order ID'         )        );          <?php foreach($bottomSliderImages as $img): ?>     <?php $thumb = wp_get_attachment_image_src($img->ID, '200,94');            if ($img->post_excerpt): ?>           <a target="_blank" href="<?php echo $img->post_excerpt; ?>"><?php endif; ?>           <img src="<?php echo $thumb[0]; ?>" alt="<?php echo $img->post_title; ?>" />     <?php if ($img->post_excerpt): ?><?php endif; ?>     <?php endforeach; ?>


title: Exclude image titles from search results

text: I would like to exclude image titles from search results. For instance, if I have an image called `image-wikipedia.jpg`, right now, if I search for `Wikipedia` the story that uses that image is returned in the results. I tried the Simply Exclude plugin and Relevanssi plugin, but neither worked. I don't know if it's because I am using a custom search results page that these plugins aren't working. Any help would be much appreciated. Thanks!


title: Best way to transfer Wordpress install to root of directory when I'm ready to launch?

text: I'm currently designing a site for a client and I don't want anyone to be able to navigate to the homepage and see it. So currently the site is located in a subfolder of the main domain. Like so: http://gointrigue.com/beta/ What steps do I need to take to move the site to simply http://gointrigue.com/ when we are ready to launch it? Or, is there a way to move it there right now, while I'm still developing it, and simply hide the homepage from the outside world while I can still see it? The only reason I decided to develop it in a subfolder like /beta/ was because I didn't know how to stop other people from seeing the homepage while still allowing myself to see it. What's the easiest, simplest answer here? Your help is greatly appreciated!


title: WP E-commerce: Showing 3 random products from current category when viewing product

text: This is more of a template tag question than a programming question, but since WPEC's wiki and forum is quite useless I had to give it a shot here. Using shortcodes you can easily include a given number of products from a given category in any post and page. **But how can I achieve the following:** In the bottom of the single product view template I would like to show three random products from the same category as the product that is being viewed. > _PS: I'm aware of the related product plugins that exists, but they're > struggling with the new product variations in WPEC. That's why I prefer to > use the standard category listing included in WPEC instead._ Thanks in advance for all kinds of help!


title: Setting Custom Sort Order of Posts within a Category

text: I've got this category setup that includes several posts. By design it's not a blog, but a staff listing. Currently all of the staff members have their own posts with the category. I'd like to be able to sort the order they are displayed in in their parent category. How do I go about doing this in the most user friendly manner? My client may want to change this sorting order in the future, especially when staff members leave or new ones get hired. Any and all help will be greatly appreciated. http://gointrigue.com/beta/faculty/ To expand on this: In the link I've provided you'll be taken to a category page I made called /faculty/. In this category page I have several posts listed. Wordpress automatically lists them in the order they were created. With the most recently created post being listed first. I want to list them in my own custom order. How do I do this?


title: Is there any way of making post tags (or custom post type tags) pop up as suggestion as in StackExchange sites?

text: In any SE site, there are suggestions that pop out when you are writing in the **Tag** field. Is there any way of doing something similar in Wordpress? (a simple vertical list is enough). (Maybe helped with jQuery).


title: Wordpress keeps crashing my server

text: I wonder whether anyone has experienced this, but every 5-10 clicks or so either in the admin panel or somewhere around navigating the website, my server crashes. Would anyone know why this happens and how I can stop this from happening? I have a basic hosting, but I have been using the same hosting for years and nothing came even close to crashing that server so much. EDIT: Here are some server log errors:               [Sun Dec 08 05:59:31 2013] [error] [client 41.160.218.195] PHP Fatal error:  Out of memory (allocated 16252928) (tried to allocate 19456 bytes) in /home/webadmin/glowingstart.com/html/wordpress/wp-content/themes/twentythirteen/header.php on line 52     [Sun Dec 08 09:58:32 2013] [error] [client 74.64.0.36] PHP Fatal error:  out of dynamic memory in yy_create_buffer() in /home/webadmin/glowingstart.com/html/wordpress/wp-content/plugins/w3-total-cache/inc/define.php on line 1449, referer: http://glowingstart.com/wp-admin/post.php?post=640&action=edit&message=6     [Mon Dec 09 16:16:59 2013] [error] [client 110.85.107.155] PHP Fatal error:  Out of memory (allocated 15990784) (tried to allocate 19456 bytes) in /home/webadmin/glowingstart.com/html/wordpress/wp-content/plugins/social-media-feather/synved-option/addons/option-type-addon/option-type-addon.php on line 53, referer: http://glowingstart.com/look-business-partner/      Thanks!


title: How to deal with spam comments and distinguish them from non-spam comments?

text: I have something like 10000 comments. They are probably all spam except for one or two. And they are all waiting for me to approve them. Is there a free solution to this issue? Thank you!


title: Removing standard links in the posts page

text: Is there any way of removing the 'extras' that come on the posts page? i would rather not have the links to the previous and next posts at the top and neither do I want the "This entry was posted in News. Bookmark the permalink." at the bottom.


title: Multiple parent categories

text: I'm new to wordpress. I want to create some main categories and 5 sub categories for each main category. Sub categories will be same for both main categories. E.g main categories will be "USA","Canada" etc. sub categories will be "places","photos" etc. Is it possible to make this with single wordpress or do i need to install another wordpress for each main category?


title: How to change admin bar color scheme in MP6 / WP 3.8 front end?

text: I need to change default color scheme for all users. The admin bar on my site is vidibile for all users including guests. The default black color scheme isn't beauty with my design and I would like to change it with cofee scheme. Is there any way to do this? I already found               add_filter('get_user_option_admin_color','change_admin_color');     function change_admin_color($result) {        return 'coffee';     }      But it disable feature to choose another color scheme for users. And first of all it work only for logged in users.


title: Make query_post category name dynamic

text: I have a working funtion:               <?php query_posts('category_name=category');?>      I want to make the category name dynamic to reflect the page title. Something like this:               <?php query_posts('category_name='.the_title());?>      But this doesnt work, & nothing I do seems to have the desired effect.


title: New to CMS - WP functionality. overkill or just right?

text: I am a designer / developer. My experience is in HTML/CSS/JS, some knowledge in PHP, MySQL, and Wordpress one-click-install and pre-made template. I want to program an entire website layout myself, and I have two places/needs for content management. (custom WP template?)   1. A media gallery in HTML/CSS/JS that can populate with images from a CMS image upload.   2. A series of 'profile cards' with fields I can customize in the CMS. A name, a title, a bio, an image etc. And then be able to display that content in customized HTML/CSS. These two features, along with a well-designed intuitive admin panel are the requirements. In your opinion, can WP get this done and still allow me freedom in programming HTML/CSS layout? Sorry for general question, I really need some reassurance bc I'm very new to back-end CMS setup.


title: Don't show images inserted into content

text: I'm using a lightbox plugin to display my post images with `[gallery]`, it works   but those images show up in the content area too. So there are thumbnails and full size of same image.   How can i hide images from content?   http://guide2nepal.com/packages/island-peak/


title: Theme editor not showing correct index.php

text: I've run into a weird issue. Not a big deal, but I'm curious about the cause. I was making a small edit to a site built by someone else; it was also temporary, so I was just using the built-in theme editor. The index.php that is loaded in the theme editor is _not_ the version that currently exists in the theme folder; it seems to be a cached, previous version. This wouldn't be so unusual except that it is only affecting index.php. For every other theme file, changes showed up if I made them on my desktop and FTP'd the file up; likewise, changes made in the theme editor appeared in the actual files. I have tried:   * switching themes to and from the correct one   * resetting my permalinks in case it was an .htaccess issue   * deactivating and reactivating all plugins (there are no caching plugins installed) Any ideas?


title: Can't seem to replicate permalink structure for localhost development site

text: I'm helping a friend migrate her WordPress powered shop. I'm to the part where I manually re enter all of her products on WooCommerce. On her current live site the link looks like: `?product=yonce-tee` And I can see on her permalink control panel that only the default settings have been used. So I go into my localhost permalink control panel and select the same settings(default and default), input the same exact product with the same settings, publish it and this is what my permalinks look like:               ?product=yonce-tee-24      Ideally the links to the products stay exactly the same, but as you can see, '-24' has been appended to the permalink. How can I replicate her site links exactly? I've tried messing around with the permalink settings for a bit, but can't get that -24 removed.


title: Replace shortcode in substring

text:
I've created these two functions to toggle between the first paragraph of the content and then everything but the first paragraph so when the user selects 'More' it slides out the article smoothly without replacing the first paragraph that's already displayed as the excerpt. However if there's a shortcode in that text it shows up as the shortcode syntax rather than displaying properly. I understand why it's not displaying but I'd like to replace any shortcodes in the text so just show up as text instead of shortcode syntax wrapped in brackets.               function get_first_paragraph(){         global $post;              $str = wpautop( str_replace( 'src="http://', 'src="https://', get_the_content() ));         $str = substr( $str, 0, strpos( $str, '
' ) + 4 );         $str = strip_tags($str, '');              return '
' . $str . '
';     }     function get_the_post(){         global $post;         $str = wpautop( str_replace( 'src="http://', 'src="https://', get_the_content() ));         $str = substr( $str, (strpos( $str, '
')));         return $str;     }


title: add_sub_menu page() to be replaced by add_theme_page()

text: While checking my theme with theme-check plugin, i found few errors which are listed below along with the line of codes where it displays those errors(REQUIRED:) to be fixed.               REQUIRED: plugin-activation.php. Themes should use add_theme_page() for adding admin pages. Line 335: add_submenu_page(          add_submenu_page(         $this->parent_menu_slug,                // Parent menu slug         $this->strings['page_title'],           // Page title         $this->strings['menu_title'],           // Menu title         'edit_theme_options',                   // Capability         $this->menu,                            // Menu slug         array( &$this, 'install_plugins_page' ) // Callback     );          REQUIRED: panel_functions.php. Themes should use add_theme_page() for adding admin pages. Line 143: add_menu_page(theme_name.' Settings', theme_name ,'install_themes', 'panel' updated the list.          $icon = get_template_directory_uri().'/innovative_panel/images/ipanel-settings.png';         add_menu_page(theme_name.' Settings', theme_name ,'install_themes', 'panel' , 'panel_options', $icon  );         $theme_page = add_submenu_page('panel','Settings', theme_name.' Settings','install_themes', 'panel' , 'panel_options');         add_submenu_page('panel',theme_name.' Documentation', 'Documentation','install_themes', 'docs' , 'redirect_docs');         add_submenu_page('panel','Support', 'Support','install_themes', 'support' , 'innovative_get_support');      Also tell me whether my theme will be accepted by the reviewer with these errors? Thanks in advance!


title: Echo only gives me the first part of string

text: So I was pulling some meta_value and trying to use it in a mass email and tested it first by echoing what I obtain in the array. In var_dump I see the array and that it gets my correct data, but when I echo the values in the loop, they only return the first letter in the string.               $meta_key = 'agency_email';     $agency_emails = $wpdb->get_col($wpdb->prepare("SELECT meta_value FROM $wpdb->postmeta WHERE meta_key = %s", $meta_key));     var_dump($agency_emails); //I can see the array and the full string here     foreach ($agency_emails as $ae) {     $aemail = $ae['meta_value'];     echo $aemail; //Only gives me the first part of string?     }      if one of my emails is 'test@test.com' it will only give me 't' in the echo. What is the reason for this and how do I get the full string? Thanks.


title: 3 x 3 grid of posts on the home page

text: I'm using Wordpress as more CMS than blog, and I want to create a theme that uses 9 specific posts on the home page. I don't want those posts to show up in other lists. I don't want other posts to accidentally override these posts. My rough sense is that I'd put the 9 posts in a single category (`front`) and then give each one a placement tag (`top center` / `middle left` / etc) and build a static front page around that. Am I on the right track here?


title: Custom Post Type and Custom Taxonomy - Same rewrite/permalink

text: I may be attempting the impossible here, I'd like a custom post type and a custom taxonomy to share the same rewrite. The rewrite being "/", with the intention of not having the custom post or taxo slug in the URL. (I understand the issues this may cause with existing posts and pages). domain.com/custom- post-type/post would be domain.com/post and domain.com/custom-taxo/term would be domain.com/term See Remove Slug from Custom Post Type for how I was removing the slug for the custom post type. I get that I can call each `register_post_type()` and `register_taxonomy()` with `'slug' => '/'` Like this `'slug' => '/', 'with_front' => true, 'pages' => false, 'feeds' => false, ` and `'slug' => '/', 'with_front' => true, 'hierarchical' => false, ` I'm hooking into `init` `add_action( 'init', 'custom_taxonomy', 0 );` `add_action( 'init', 'custom_post_type', 0 );` Both of these functions work individually, however when I combine them post the custom post and the custom taxos result in 404s. Am I running into a conflict and attempting the impossible?


title: Comment number does not increment

text: I am making a custom wordpress theme and when I add a comment to a post and retrieve the number of comments using `get_comments_number()` the number does not change. I do know the function works because for the first comment that gets preinstalled with wordpress it returns 1. but somehow the number does not increment if I add additional comments. Is there a way to manually increment this number? Does anyone know what the problem might be? Thanks for your suggestions!


title: Relaxing unescaped HTML filtering inside <pre> tags?

text: By default, WordPress strips out any content that might be unescaped HTML in comments from unregistered users, which is good to protect against XSS, but it unnecessarily extends that filtering into `<pre>` elements too. On my blog, where almost every post generates comments that benefit from HTML code snippets, that filtering has caused my users (and myself) lots of frustrating trouble. Is there a way to "fix" that overly aggressive filtering inside `<pre>` elements within unregistered comments, without disabling it for the rest of the comment? Preferably, in a way that survives upgrades.


title: Does plugin uninstall always put WordPress back into original state?

text: What is a plugin lifetime within a deployed instance of WordPress? Namely:   * do the plugins modify existing files or do they only use defined extension points within WordPress?   * are plugins allowed to modify database schema (e.g. add new columns)?   * how does Wordpress make sure that plugin uninstall always leaves WordPress in original state? (Does it?)


title: Creative uses of WordPress

text: As WordPress grows, it becomes possible to make more and more sites using the technology. Pages and the permalink structure give it CMS power, custom taxonomies and post types expand this further to differentiate chronological posts, pages and arbitrary objects, and plugins fill the gaps. So, you can use WordPress to power your blog, photo gallery, and website. What are some of the more creative uses you've seen that exploit powerful WordPress features? What are some sites that made you say, " _That's_ WordPress?"


title: Modifying the comments section through a plugin regardless of theme

text: I need to be able to add some data (text/images) to each comment in the comments section through a plugin. What I'm trying to do is actually very similar to the way the stack exchange sites have their little user profiles in questions/answers that show a user's points and badge count. I've tried using a few filters (most recently "comment_author" - yeah, didn't work too well) but haven't found something that would work. I need a spot where I can inject some information about the user that won't mess up other parts of the blog (like admin sections) and that will hopefully play nice with whatever theme they are using. I realize starting out that this probably won't work for every theme but hopefully there is an answer for those themes that stick to the general blog layout.


title: how to edit functions.php in a child theme

text: I am using wordpress for my site. I am using a theme called esplanade. I have made a child theme folder and created a style.css with the required lines in it. My child theme is working nicely. I have functions.php in my original theme. I want to edit a function in it which creates an author box below the article. I heard that we can create a new function in the child theme functions.php but cannot edit the existing function. I dont want to edit in the main theme folders funcions.php file. because tomorrow if i update then it will create a problem.


title: No Current Class showing in Menu for Custom Post Types

text: I have Created Custom Post Types "NightLife" "Event" "DLStore" I have added them to Secondary Nav Menu. They show up but when i select the page it does not show any active/current class unlike other Pages like Home or Contact etc. How can i add a Current Class to this in the Menu. I have tried all the suggested methods here under similar questions. But couldn't Fix it. AnyBody Help. My Menu is Secondary Menu.


title: Display the Terms from a Custom Taxonomy Assigned to a Post(inside the loop) in Hierarchial Order

text: This link tells me how to display categories assigned to a post. How would I modify this code to display the terms from a custom taxonomy assigned to a post in hierarchical order?


title: Function to shorten string without cutting off last word

text: This code is working great to shorten a strong of text to the nearest end of a word except that if the string is shorter than the cut length, it cuts off the last word. Can anyone tell me what to change to make it not cut off the last word in that instance?               function shortened_description($cutlength) {         $content   = get_field('event_short_description');         $charcount = strlen($content);         $cutlength = $cutlength;         $shorter   = substr($content, 0, strrpos(substr($content, 0, $cutlength), ' '));         if ($charcount >= $cutlength) {             echo $shorter . '... more >';         } //$charcount >= $cutlength         else {             echo $shorter;         }     }


title: (Plugin) Icon needed beside the post title

text: I need a plugin to do some posting like this. The icon "Hot!" will appear in front of the post title. Please suggest me any plugin for this. ![enter image description here](http://i.stack.imgur.com/dtVNs.png)


title: Sub post not showing in wordpress admin

text: I am trying to show all the post (including sub post) in wp-admin. but the post which are having parent are not showing in the list of post although the count is giving like 142 post but showing 42 out of 142 since 100 posts are sub posts. I installed a plugin **wp sub post** for this where it gave me an option to add a post as parent but not coming in wp-admin. what can i do for this? In database it is stored with post_parent id where as the normal have post_parent= 0


title: Registering and using actions which return results in a Plugin class

text: I have a plugin class which contains a function spektrix_list_events()               class SpektrixPlugin {              public function __construct(){                  add_action( 'init', array ( $this, 'init' ));         }              public function init()         {             add_action( 'spektrix_list_events', array ( $this, 'spektrix_list_events' ));         }              public function spektrix_list_events($getPrices = FALSE) {             $api = new SpektrixApiClient();             return $api->getAllEvents($getPrices);              }     }          $SpektrixEvents = new SpektrixPlugin;     add_action('init', array($SpektrixEvents, 'init'));      In a template file, I want to be able to call do_action('spektrix_list_events') but can't seem to get this working. I've tried following the advice here Additional question - is using add_action() the recommended way to do this? **UPDATE:** The method is in fact being called but no results are returned. So how should one call a plugin class method which returns some output for display?


title: Redirect depending on category chosen

text: I'm using Ninja Forms and their extension to do front-end posts. They have a function that isn't working that is supposed to allow you to redirect to a specific "thank you" page depending on values from the form (you specify the form field ID). This is the code but it isn't working:               function change_ninja_forms_landing_page(){         global $ninja_forms_processing;               $form_id = $ninja_forms_processing->get_form_ID();               if( $form_id == 1 ){              $swapcategory = $ninja_forms_processing->get_field_value( 21 );                   switch( $swapcategory ){                  case 'Need':                     $url = 'http://dcartistexchange.org/start-swapping/need/';                     break;                 case 'Offer':                     $url = 'http://dcartistexchange.org/start-swapping/offers/';                     break;             }                  // $url now contains our new success page. Let's update the form setting.             $ninja_forms_processing->update_form_setting( 'landing_page', $url );         }     }      Field 21 is a custom post type category checkbox and the "case" are the field values. When I submit the form, nothing happens (I get the form submitted confirmation but it doesn't go to the pages specified). I've tried putting wp_redirect in there (with the exit) and that doesn't seem to work either. Can anyone see what I may be missing?


title: Post count by Parent Category

text: I want to show post count in my site by parent category. Example - We have 18 Tutorials, 15 Article, 3 Freebies


title: Is there a maintenance mode in Wordpress core?

text: If I want to put a Wordpress (3.2.1) site into Maintenance mode, is it still necessary to use a plugin? If so, is this a good option?


title: Can I have Comments open to specific users only?

text: Like for example, I have 5 users I want to give permission to comment, but no one else. But everyone needs to be able to read them. (Publicly viewable) Like a blog about a show with 5 actors and I only want them to be able to comment on this specific page. This is for a custom page template. I think I could use this action hook, but I can't find any examples by searching.               768  *     769  * @param int $post_id An optional post ID to check instead of the current post.     770  * @return bool True if the comments are open     771  */     772 function comments_open( $post_id = null ) {     773      774      $_post = get_post($post_id);     775      776      $open = ( 'open' == $_post->comment_status );     777      return apply_filters( 'comments_open', $open, $post_id );      Would it be something as simple as this pseudo code?               if my_user_can_post_comments = true {          add_filter('comments_open', true, $ID);     } else {          add_filter('comments_open', false, $ID);     }


title: Plugin LDAP Authentication 2 In stallation ploblem

text: I didn't understand the 3rd step of Installation procedure of plugin LDAP Authentication 2 http://wordpress.org/plugins/ldap- authentication-2/installation/ Place in your templates Where is the templates to place this script????


title: How to display custom style based on theme option select box

text: How can I display a different style snippet if a user selects and option from my theme options page select box. For example. To show the sidebar on the right a user would select "Right" and the default stylesheet would be used. However, if they chose "Left" to display it on the left, a small style snippet would appear that overrides the default stylesheet. This is how I do it for checkboxes if that helps.               <?php if ( of_get_option('show_post_sidebar', false ) ) { ?>             <!-- default styles would be used -->         <?php } else {?>             <style type="text/css" media="screen">                 .post{width:720px}             </style>         <?php } ?>


title: How to have Multiple Archives Widgets, one archive widget per category (in a different page)?

text: Please read the whole question before assuming this question is repeated. After one day of trying plugins and tutorials, I am convinced that there is no straightforward method of achieving what I am trying. Basically I am building a site that has different components: **Blog** , **News** and **Gallery** , they are all items in the menu. I am trying to have different archive widgets for all of them. So, when I go to **News** I can see my Archive Widget that just organizes information for **News**. The same for **Blog** or **Gallery**. What have I tried?   1. **`get_archives`:** there is no category parameter for `get_archive`   2. **Categories** :: 2.1 **`getarchives_join` and `getarchives_where`** filters: They work well when is just one archive. Then you can modify the query one archive. **Problem** : I need more than one archive 2.2 **adding templates,`template_include` filter and global variable**: this allowed me to have a global variable with the corresponding template name (`category-blog.php`, `category-news.php` and `category-archive.php`). With those names I could change the `getarchives_where` accordingly. **Problem** : This almost work until I realized that the widget links for the archive point to something like `mysite.com/2012/02` and use a different common template 'archive.php' (see 3 for using custom post type). 2.3 **category in permalink and (`$_SERVER['REQUEST_URI']`)**: this is more elegant than grabbing the permalink `mysite.com/2012/02` to something like `mysite.com/news/2012/02`. Then I can use `$_SERVER['REQUEST_URI']` in the `getarchives_where`. **Problem** : I have no idea how to modify the `mysite.com/2012/02`. I research, `get_month_link` and `get_year_link`. There is no category parameter.   3. **Using custom post type** :: Obviously I needed `archive-news.php`, `archive-blog.php` and `archive-gallery.php` and add to my `getarchives_where` of 2.2. I crashed into `Custom Post Type`. I created and register the three custom post types: **Blog** , **News** and **Gallery**.  3.1 **The`has_archive` delusion**: The parameter was there and I was convinced I got it. So I went to the news archive (`mysite.com/news`) and the archive was there. It worked on the right side displaying the news. **The problem** : The archive widget was still displaying the normal posts. 3.2 **adding the archive templates to the`template_include` filter and global variable**: This is similar to 2.2 but with `archive-blog.php` and `archive- gallery.php`. **Problem** : Exactly the same as 2.2. The widget links for the archive point to something like `mysite.com/2012/02` and again using the the default common template 'archive.php' instead of the ones I created.   4. **Plugins** : I don't want to use a plugin for this but I did and didn't work. 4.1. **jquery-archive-list-widget** : almost work except it works with exclude categories instead of include them. **Problem** : The link is still `mysite/2012/20/`. I am about to modify this plugin but I am still 4.2. I tried a few others with less success. How do I have different archive widgets according to category/post_type that appears according to the page I am?


title: Help with .htaccess and Login with Subfolders

text: I know this question has been asked many times, but I still not sure whether I have this correct. I am trying to make it so that my login page is here:               www.url.com/login      My WordPress installation is contained within a subfolder of my webserver called 'Main' (I have already followed these instructions and it is working fine). Here is how I have set up my two .htaccess files. The first one, which is located in the /main folder is:               RewriteRule ^login$ wp-login.php [NC,L]     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /main/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /main/index.php [L]     </IfModule>     # END WordPress      The second one is located in the root directory:               # Use PHP5 Single php.ini as default     AddHandler application/x-httpd-php5s .php     RewriteBase /main/     RewriteRule ^login$ /main/wp-login.php [L]     # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>     # END WordPress      Lines 3 and 4 are my answer to doing the rewrite while being able to use a relative address for what I am rewriting. The issue is - I am pretty new at this stuff and I could not find information on someone doing this exact thing, so I basically just guessed this answer. It seems to work, but is this the correct way of doing it? More importantly, is there a way of replicating this process programatically in WordPress?


title: Javascript from Easy-Fancybox place into footer

text: the Easy FancyBox WP-Plugin works fine for me. Just the script will be placed in the header of my source, like other plugin, too. I´d like to push it down to the footer of my website (incl. the inline- script) below jquery-library. Can i fixed it? Thanks Ingo


title: Enque Javascript in Footer?

text: I currently enque jQuery like so - how do I move this to the footer instead?               // Enque: jQuery     if (!is_admin()) add_action("wp_enqueue_scripts", "my_jquery_enqueue", 11);     function my_jquery_enqueue() {        wp_deregister_script('jquery');        wp_register_script('jquery', "http" . ($_SERVER['SERVER_PORT'] == 443 ? "s" : "") . "://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js", false, null);        wp_enqueue_script('jquery');     }


title: Doubled titles when using All in One SEO with custom template

text: I created a separate template, attachment.php, for displaying image attachments. It's relatively simple; basically a stripped down version of single.php. Everything is working great _except_ that when I have the All in One SEO plugin enabled (and set to rewrite titles), the titles on those attachment pages are being doubled. For example, this attachment's title should be "11 hours of MacBook Air battery life", but the title tag is being rendered as "11 hours of MacBook Air battery life 11 hours of MacBook Air battery life" This only happens on the attachment.php pages, not on the rest of the site's normal posts and pages. Any idea what could cause that?


title: WordPress prompt checklist before publish?

text: Does anyone have a suggested plugin that does the following: when a user hits publish on a post for the first time, it should have a popup, notice, or alert that asks the following:   * Do you have a title?   * Is the article complete?   * Spell checked?   * Did you pick tags?   * Have you selected a category?   * Choose a featured image? Any type of that functionality to catch uncompleted fields or merely serve as a warning would be quite awesome.


title: How to store datetime from custom meta box so that it can be sorted by

text: I have a custom meta boxe on a custom post type that has two date time fields. I will need to sort by these fields and also return posts that contain a date between two dates. Will WordPress automatically store these dates as varchars? What will be the best format to save the date in so that I can query them?


title: How to make post content from each post display within the same div

text:
Basically what I am trying to do is have the featured image of each of my posts display in rows of 3 showing only the featured image. When you click on one of the featured images, a div above the row slides up containing the post content. I'm not sure how I can accomplish this since if I put the content div inside the loop, it generates a separate div for each post's content. Here are some images to show what I am trying to accomplish:      **Initial State:** ![Initial State](http://i.stack.imgur.com/FKOwK.jpg) **Selected State:** ![enter image description here](http://i.stack.imgur.com/JWQhk.jpg) Here is the code I currently have:               <?php query_posts( array( 'post_status' => 'publish' , 'post_type' => array( 'stories' )  ) ); ?>         <?php if ( have_posts() ) : ?>             <?php while ( have_posts() ) :?>                 <?php the_post(); ?>

<?php echo get_the_title(); ?>

<?php echo get_field('location'); ?>

                                 <?php echo get_the_content(); ?>

<?php echo get_the_post_thumbnail($post_id, 'full'); ?>

             <?php endwhile; ?>         <?php endif; ?>     <?php wp_reset_query(); ?>      And the Javascript:               $('.story-photo').click(function() {         $(this).siblings(".story-info").slideToggle('fast', '');     });      However, because the content for each post is in it's own separate div, the result I get cascades instead of moving all of the images in the row down an equal amount. Any ideas how best to solve this? Thanks!


title: How do I avoid having duplicate of plugin in trunk?

text: I published a plugin and then installed it into a test site to check it was published OK. The copy that was installed contains:   * plugin.php   * readme.txt   * trunk/plugin.php   * trunk/readme.txt The trunk folder is redundant and other plugins don't seem to come duplicated. How can I avoid the plugin files getting downloaded twice?


title: Comment Moderation and CDN Caching

text: I work on a site that is entirely cached by a CDN. We are about to roll out comments and will be moderating every comment before it goes live. When someone posts a comment and the page is rendered with a message indicating their comment is being held in moderation. What I don't want is for the CDN to cache this page with the moderation message. What can I do to prevent this? Ideally I would be able to hook in somewhere and return the URL with a query string in it which aren't cached by our CDN.


title: How to add filetype to meta value when using wp_upload_bits?

text: I've set up a custom post type and would like to have the ability to attach files to those posts. I've got the CPT and metabox set up, and the upload function as well. When I display the CPT on the front end, I'd like there to be a download link for the file. To simplify things, I'd like to use the included MIME type icons (`wp-includes/images/crystal/document.png` for example). Using `wp_upload_bits()` there's no MIME in the meta array. Is it possible to add the MIME type to the function? Or should I be looking at another function/method of identifying the MIME? Here's my upload code:                $upload = wp_upload_bits($_FILES['resources_attachment']['name'], null, file_get_contents($_FILES['resources_attachment']['tmp_name']));           if(isset($upload['error']) && $upload['error'] != 0) {        wp_die('There was an error uploading your file. The error is: ' . $upload['error']);      } else {      add_post_meta($id, 'resources_attachment', $upload);      update_post_meta($id, 'resources_attachment', $upload);             }


title: Display Term Metabox Only On Certain Term Edit and Add Pages In Admin

text: I have a simple metabox added to a taxonomy and in turn its terms, however I am looking for a way to only display the metabox on a single term of this taxonomy, is this possible? This metabox with inputs appears on all term edit and term add screens for ALL terms of the taxonomy applied, can this be limited to a single term add and term edit screen? Regards John


title: Award points if a specific custom taxonomy is selected - Cubepoints

text: I run a multiple author platform where Cubepoints is a major part of its point and ranking system. I have added a custom category taxonomy called `highlight` and it contains two items: `featured` and `spotlight`. Whenever an excellent post is submitted, an editor check it as `featured` or `spotlight` - both of which gives the article a lot of exposure on the site. If the users article is highlighted, they receives a custom amount of extra points. The problem is that the editors are forced to add these points manually by browsing to Cubepoints / Add Points. This is an exhausting process to do manually. **How can I make this work automatically**? This means that if `featured` is checked for the custom taxonomy (highlight), then the user gets 30 points with the description "Your article has been featured", and if `spotlight` is selected, they receive 50 points with a similar form of description. Unfortunately, the Cubepoints API documentation is noneexistent, however, I good tutorial was recently written by a user.


title: Is there a way to exclude the content from the post variable to save on RAM usage?

text: So, I've run into what looks like a WP RAM usage problem and am looking for a solution. The only place I'm really having this problem on my site is with a Site Map page that I'm trying to populate, but a solution to this problem could be universally applied and save on RAM usage across an entire site. Essentially, this Site Map page I have is a list of all `posts` and `pages` on my site. The only elements of the $post variable that I need access to on this page are the title and permalink. Unfortunately, the query I'm using returns all posts with all the information in each of their $post variables. The following is an example of a query I'm using on this Site Map page for a single `custom-post-type` named "products" with a custom taxonomy of "supplements" and term "all-supplements". My Site Map page has multiple such queries, but for explanatory purposes I'm only including the code for this single query.                $varArray= array(           'post_type' => 'products',           'post_status' => 'publish',           'supplements' => 'all-supplements',           'posts_per_page' => -1,           'orderby' => 'title',           'order' => 'ASC'      );      $myProducts= new WP_Query($varArray);      The large majority of the information saved within the $post variable (for my site, and I'm guessing that this trend is seen for general usage) is found within "the content" The typical RAM usage for my Site Map page is ~140MB (reported by Debug Bar), whereas the usage for any other typical page on my site is 50-60MB. Big difference. Yesterday the Site Map page stopped working (WSOD), and to fix it I had to increase the maximum amount of RAM that WP can use. So I'm increasing overall necessary system resources because of a single page. Thus, I come to my question. Is there a pathway/option somewhere within Wordpress that I'm missing that would fetch `posts`/`pages` like a normal query, but _NOT_ get the content for retrieved posts? Or, alternatively, is there some easier way for me to only grab particular elements within a given query (Title/Permaklink/Slug/etc...) instead of getting the whole $post variable shebang? It seems to me that for many WP applications, the only place that "the content" of a post/page would typically be needed is on that `page` or `post` page (obviously there are exceptions here), and that having access to the full content for posts/pages retrieved by query on other pages is simple overkill. If there is a way of avoiding loading up the full content for post list pages, then a significant amount of RAM usage could be saved. Any help would be appreciated.


title: Prevent Indexing of 404 Page

text: I'm tryying to prevent search engines from indexing my 404 page which is in a template called 404.php. I do not create an actual page, I simply rely on the php template for my 404 errors. I'm using the code below and it's not working, I'm unsure what the best way to go about this is and I would appreciate help.               <?php if(is_single('404.php')): ?>     <META NAME="ROBOTS" CONTENT="NOINDEX, NOFOLLOW" />     <?php endif; ?>


title: Control content before and after custom post type loop

text:
I am trying to create a left nav menu that contains a couple of different taxonomy lists of a custom post type. For example, the left menu might look like this...
New Stuff

Item 3

Item 4

Old Stuff

Item 2

Item 1

      Below is the code I currently have in my sidebars template...
New Stuff

     <?php         $args = array(             'post_type' => 'stuff',             'taxonomy' => 'stuff-type',             'term' => 'new-stuff',             'orderby' => 'date',             'order' => 'DESC',             'posts_per_page' =>-1         );         query_posts($args);             if ( have_posts() ) : while ( have_posts() ) : the_post();     ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php endwhile; ?>     <?php else : ?>     <?php endif; ?>

Old Stuff

     <?php         $args = array(             'post_type' => 'stuff',             'taxonomy' => 'stuff-type',             'term' => 'old-stuff',             'orderby' => 'date',             'order' => 'DESC',             'posts_per_page' =>-1         );         query_posts($args);             if ( have_posts() ) : while ( have_posts() ) : the_post();     ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php endwhile; ?>     <?php else : ?>     <?php endif; ?>
      This all works fine expect that I need the h2 and ul tags to not appear if there are no posts assigned to the taxonomy. How can I get the opening h2 title and ul wrappers somehow in the WordPress loop (just before and after), leaving the else/endif statement to print nothing (printing nothing if there are no posts for that taxonomy)?