title: How to connect rating to individual comments?

text:
I have managed to make my own custom comment rating system - that was working fine until now. I got an idea: why not add star rating to individual comments? I thought it would be easy as I have already added a custom rating field in comment - through filter that is ..               add_action( 'comment_form_logged_in_after', 'additional_fields' );     add_action( 'comment_form_after_fields', 'additional_fields' );          function additional_fields ($below) {         $ratsec = '
'.         ''. __('Rating') . '*         ';                  //Current rating scale is 1 to 5. If you want the scale to be 1 to 10, then set the value of $i to 10.             for( $i=1; $i <= 5; $i++ )             $ratsec .= '<input type="radio" name="rating" id="rating" value="'. $i .'"/>'. $i .'';              $ratsec .= '
';     $below = $below .$ratsec;     return $below;     }      But when I change things and add this filter               add_filter( 'comment_text', 'additional_fields' );      it starts showing the radio button in every comment just below the user text - but how to submit them? As along with comment you have submit button ? My first Question is: How I can make the rating submit ? My Second Question is: If I vote 3 star for "comment number one" will it affect all the comments or just the one I voted? I am confused how to make connection between them. I was using comment meta data to save the data that was ...                    add_action( 'comment_post', 'save_comment_meta_data' );          function save_comment_meta_data( $comment_id ) {        if ( ( isset( $_POST['rating'] ) ) && ( $_POST['rating'] != '') )        $rating = wp_filter_nohtml_kses($_POST['rating']);        add_comment_meta( $comment_id, 'rating', $rating );          }      Now the Code is completely changed How will I save the data in comment meta data to make it show on the front end ? What Modifications are required in the above action ? Plus now using the perfect method explained below by @s_ha_dum -- How will I store this data according to comment id ?


title: Why my theme option not working?

text: I am looking for the bugs about an hour but i can't find anything. Can you look and say why my theme option is not working? **Problem:** The theme option not saving. Even the default option is also blank. I checked the value via php my admin. Check the code in pastebin. And also how i can debug this kinds of problem? http://pastebin.com/TPV5YvD9 Thanks in advance.


title: Where to call my pagination function?

text:
I have just been following this tutorial - http://www.lateralcode.com/wordpress-pagination/ I have written that function in my functions.php file and taken numerous notes on how it works. The problem now is I just don't know what to do with it to get it working. I want it running on my search results and my in a loop on my blog page. Any ideas? I'm trying to learn this rather that use a plugin.... This is my code from my loop over ride file - loop-search.php
Results for: "<?php echo get_search_query(); ?>"
     <?php if(have_posts()) { while(have_posts()) { the_post();?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php the_excerpt(); ?>     <?php }}?>      Thanks.


title: WordPress Plugin as 'Library' From Abstract Application?

text: Here is my thought, and I could be digging myself a huge hole. That's why I'm here ;) I am looking to develop a complex application but I want this application to run both as a standalone script as a wordpress plugin. Later I may develop into a Joomla plugin and so on. My thought is I develop an abstract custom framework and then implement the custom functionality via extending this framework. Does that make sense? So say `WP_Plugin` extends `My_Engine`, and then that plugin class will act as factory to manage the custom functionality in the WordPress `/lib/wordpress/` directory. I really don't want to have to repeat myself and I would definitely be producing multiple versions of the app. Any thoughts?


title: Custom Admin CSS styles to style media uploader?

text: Hopefully a simple answer to this. Using the wp custom header feature, the media upload screen shows an extra field: "set as header". I'm trying to make this text bigger as it can easily be missed. Firebug says it has a class of "a.wp-set-header". I can change the font size within firebug and it works, but adding this in my css doesn't do anything - any ideas? Thanks               a.wp-set-header{     font-size:22px !important;     font-weight:bold !important;     }


title: wp_remote_get vs. fetch_feed ? which is the better for performance?

text: I m trying **to share my web site contents** for other web sites using by external loop file or rss file. when i asked some questions about `wp_remote_get` function ; @Serkan suggest to me , using `fecth_feed` methot / function etc. (check the question here.)= I really confused , which one i should, which one is better way for high performance, could anyone explain it why ? Thanks.


title: Loop that displays PARENT PAGE & CHILD PAGE & outputs GRANDCHILD PAGE title and content

text:
I've never posted here, but I'm tired of slapping code together. That said, I would be most appreciative if someone could help me with this. I need a page template that:   1. outputs the PARENT PAGEs,    2. the CHILDREN PAGES of that PARENT PAGE,   3. and finally output the titles and content of the GRANDCHILDREN PAGES so I can insert them into a tabbed layout. Here's a diagram The idea is that visitors should be able to get to the content on the GRANDCHILDREN PAGES in two clicks. For the PARENT PAGES, I'm using wp_nav_menu. For the CHILD PAGES, I'm using:                   <?php if ( is_page() ) { ?>         <?php         if($post->post_parent)         $children = wp_list_pages('title_li=&child_of='.$post->post_parent.'&echo=0'); else         $children = wp_list_pages('title_li=&child_of='.$post->ID.'&echo=0');         if ($children) { ?>
         <?php echo $children; ?>
         <?php } } ?>      And to output the GRANDCHILDREN PAGES title and content, I'm using some code from the codex: GRANDCHILDREN PAGES
     <?php     $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');     $count = 0;     foreach($pages as $page)     {         $content = $page->post_content;         if(!$content)             continue;         if($count >= 100)             break;         $count++;         $content = apply_filters('the_content', $content);     ?>
     <a data-toggle="tab" href="#<?php echo $count ?>"><?php echo $page->post_title ?>
          <?php } ?>
      GRANDCHILDREN CONTENT
          <?php         $pages = get_pages('child_of='.$post->ID.'&sort_column=post_date&sort_order=desc');         $count = 0;         foreach($pages as $page)         {             $content = $page->post_content;             if(!$content)                 continue;             if($count >= 100)                 break;             $count++;             $content = apply_filters('the_content', $content);         ?>               <div class="tab-pane" id="<?php echo $count ?>">     <?php echo $content ?>
          <?php } ?>
      I am certain there is a more efficient way to do without a gazillion loops and queries. Anyone have any ideas? I'm want to learn, and put code an elegant solution. Thanks.


title: Function Error after WP Upgrade to 3.9.1

text: Following the update to WP 3.9.1 and MySQL I am getting the following error on a site: > Strict Standards: call_user_func_array() expects parameter 1 to be a valid > callback, non-static method dc_jqverticalmegamenu::header() should not be > called statically in /home/xyzsite/public_html/wp-includes/plugin.php on > line 470 The reference is to this plugin. A quick search shows about 82 pages out there with the same error, but no reference to a solution. I would appreciate some guidance on resolving this.


title: How to add a javascript snippet to the footer that requires jQuery

text: I know I can add a script file to the footer of wordpress that requires jquery using this code:               <?php     function my_scripts_method() {        // register your script location, dependencies and version        wp_register_script('custom_script',            get_template_directory_uri() . '/js/custom_script.js',            array('jquery'),            '1.0',            true);        // enqueue the script        wp_enqueue_script('custom_script');     }     add_action('wp_enqueue_scripts', 'my_scripts_method');     ?>      But what if I want to add just a normal snippet of jquery inline, not a file. How can this be done. # Edit I know I can use this script to add something to the footer:               <?php     function myscript() {     ?>     <script type="text/javascript">      // This depends on jquery     </script>     <?php     }     add_action('wp_footer', 'myscript');      But how do I specify the script that is used **requires jquery** to run.


title: How to change the layout of a product page

text: I'm using WP-ECommerce with the genesis framework. I can set the layout of the Products page to single column, but when I select a single product it uses the default layout and not the products layout. I'm not sure where to even begin. Is this a configuration issue with WP-EC or with the genesis framework.


title: Allowing users to Sign-up > Login > Post articles that need approval

text: I need your advice! I have a small hobby website, it's a small music magazine, with all the content published by me. It's setup with an open source Wordpress Theme with my custom graphics and CSS. I want to turn it into something else now, and allow users to have the ability to be able to sign-up > login > and post articles and any pretty much any post content they'd like. But I'd like it to be sent to my email or something for me to have to 'approve it' before it's published? Whats a good approach of taking a standard Wordpress small magazine site, and creating allowing these functionalities? Is this a page or two of gluing PHP snippets together from around the web, could this be handled with a good plugin or two - or is it something deeper? Thanks as always!


title: Multiple custom post type queries causing wrong post types to be grabbed in taxonomy + single templates?

text: Ok, this may be a bit confusing but here goes... Im working with several custom queries on the same page throughout my site. Some queries are grabbing regular post data, others are fetching CPTs depending on what page your on, namely the store section for example... I had everything working perfect until I decided to try and make things easier for the client by converting an existing image gallery fader/slider into an "additional CPT" so that they could just add the images on their own when they want without having to continue requesting updates for this. So in order, let me explain whats going on in the site (I'll also include a simple graphic to outline my situation):   * I have a newly added CPT called featimggal to allow my clients to post their own images to the slider at the top of every page.   * I have a CPT for my store section called product. I use a couple custom queries to grab different products based on a custom taxonomy slug and list them out on the landing page for the store.    * I use a taxonomy template to show all product CPTs in an archive format when viewing items via taxonomy from links in the sidebar.   * Lastly, I use a single-product.php template to display products by themselves.  ............. After adding a new CPT called featimggal with a custom query that comes before the product CPT's on the page everything still functions as expected when visiting the store.php page, however once you click an individual product to view it from the single-product.php template the cpt product does not appear there anymore and instead "all" the CPTs for the image gallery show up instead, its the strangest thing. ## Examples: **Store Page - Featured Image Gallery CPT - featured_images.php**               <?php $wp_query = new WP_Query(array('post_type' => 'featimggal')); ?>     <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>          <?php the_post_thumbnail('feat-img-gal', array('class' => 'featured_image_gallery', 'alt' => '', 'title' => '')); ?>          <?php endwhile; ?>     <?php wp_reset_query(); ?>      **Store Page - Product CPT - store.php**               <?php $wp_query = new WP_Query(array('post_type' => 'product', 'productcategory' => 'epr-apparel', 'posts_per_page' => 6, 'orderby' => 'rand', 'paged' => $paged )); ?>     <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>     // Do Stuff     <?php endwhile; ?>     <?php wp_reset_query(); ?>          <?php $wp_query = new WP_Query(array('post_type' => 'product', 'productcategory' => 'epr-accessories', 'posts_per_page' => 6, 'orderby' => 'rand', 'paged' => $paged )); ?>     <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>     // Do Stuff     <?php endwhile; ?>     <?php wp_reset_query(); ?>      **Store Page - Footer Query - footer.php**               <?php $wp_query = new WP_Query('category_name=blog&posts_per_page=1'); ?>     <?php while ($wp_query->have_posts() ) : $wp_query->the_post(); ?>      // Do Stuff     <?php endwhile; ?>      ![store.php](http://i.stack.imgur.com/UfUdr.jpg) ![taxonomy.php](http://i.stack.imgur.com/Rtv5t.jpg) ![single- product.php](http://i.stack.imgur.com/xUeMN.jpg)


title: How to sell an album for download

text: I'm trying to deliver a set of nine audio files, as part of a single purchase for download. My first thought was to make an RSS file as the actual purchased item and then the customer would be able to download the nine actual files using iTunes from that feed. I'm not convinced that this is the best approach. I have tried to deliver an RSS file but the file simply arrives as an XML document in the download folder of the users browser. I believe I would need to use itpc:// in the URL, but that doesn't seem to be an option. I'm sure I'm not the first person to try and see a collection of recordings, not unlike selling an album.


title: Rewrite rules for custom post type

text: There is a nonhierarchical custom post type "news".               /news/     /news/page/2/     /news/post_slug/      Each post has custom field `"views"`. When someone opens post, field's value increased by one. Would like to sort posts by this custom field, by its value.               /news/     /news/views/ = /news/?sort=views (get posts with custom field "views" and sort asc)     /news/views/page/2/ = /news/?sort=views&page=2 (similar to previous, next page)     /news/post_slug/      Got working `/news/?sort=views`, but this link is not human-like. It should be transformed to `/news/views/` and be able to handle pagination. How can we do this?


title: echo site_url() returns a different value than what is in the database siteurl field

text: I have just copied a WordPress site to a different domain, everything on the front-end and admin side displays and works smoothly except I found my category links are linking to the old site domain. ( when echoed from get_category_link($parent->cat_ID) ) The siteurl and home fields in the database are correct (http://subdomain.newdomain.com) However when I echo any of home_url() site_url() or network_site_url() I get http://www.oldsite.com I've tried setting it in both the functions.php file and wp-config.php files, and have checked and re-checked the database field, even switching it away, breaking the site, switching it back to have the same results. What is going on?


title: What is the right way to clean up $title before wp_insert_post?

text: I am using a function to insert some post data and i am having problems with the title/title - slug. The title is random selected from an array, some title have `?`, `!` or `.` (dots) I notice `wp_insert_post` doesn't clean up the title so in the title slug (permalink) i see the `?`, `!` or dots. How can i fix this? Any WP built-in function? This is my function               function my_add_post($title, $content){       // Create post object       $title = str_replace('.','',$title);       $title = str_replace('?','',$title);       $my_post = array(         'post_title'    => $title,         'post_content'  => $content,         'post_status'   => 'publish',         'post_author'   => 1,         'post_category' => array(1)       );            // Insert the post into the database       wp_insert_post( $my_post );        }


title: html id is removed for non admin user?

text:
I have a custom functionality which create a custom post with info entered on a form Part of the post content is a line like `<div id="featuredcocktail">` When I tested it as an admin all worked perfect and the content was created as I wanted, but once I used the form as non-logged user the custom post was created with only `<div>`. When I changed the id to class like `<div class="featuredcocktail">` it worked well for both admin and non-logged user.               $my_post = array(                     'post_title' => $company_field,                     'post_type' => 'bgmp',                                   'post_status' => 'draft',                     'comment_status'  => 'closed',                     'ping_status' => 'closed',                     'post_content' => $content                 );              $id = wp_insert_post( $my_post );         $cont   = '
'. "\r\n";         $cont  .= ''. "\r\n";         wp_update_post( array('ID' => $id, 'post_content' => $cont ) );       Any idea how I can use id?


title: WordPress Custom Permalink Structure with Custom Post Type and Taxonomies

text: I searched for a solution everywhere, using plugin and without but I can't reach my goal. I have a Custom Post Type called "services", an associated Custom Taxonomy called "service-categories", and some sub-terms of the same Taxonomy. I want to create a hierarchical permalink structure. I need one of these:   1. /custom-post-type-name/term-name/(subterm-name)/post-name   2. /custom-taxonomy-name/term-name/(subterm-name)/post-name   3. /custom-post-type-name/custom-taxonomy-name/term-name/(subterm-name)/post-name Thanks to all.


title: How to List Custom Post Type Titles Based on Theirs Taxonomy Terms Inside a Nested Loop

text:
I am trying to list at least the last three updated Custom Post Type's title lets call it "Cast" inside another loop which is listed based on the Taxonomy terms called "Actress" I used the following loop to get the list of my tax terms:               $taxonomy = 'actress';     $term_args=array(       'hide_empty' => false,       'orderby' => 'name',       'order' => 'ASC'     );     $tax_terms = get_terms($taxonomy,$term_args);     ?>
     <?php     foreach ($tax_terms as $tax_term) {     echo '
' . $tax_term->name.'
';     }     ?>
     <?php       well this helped me to list the terms but I am really confused how to add the list of each terms associated custom post? to be more clear I illustrate following image,hopefully this will give you an idea what I am seeking for? Can you please help me to figure out how to do this? Thanks **Update**               <?php          get_header();     //list terms in a given taxonomy     $taxonomy = 'actress';     $term_args=array(       'hide_empty' => false,       'orderby' => 'name',       'order' => 'ASC'     );     $tax_terms = get_terms($taxonomy,$term_args);     ?>
     <?php     foreach ($tax_terms as $tax_term) {     $loop = new WP_Query(                       array(                         'post_type' => 'cast',                         'tax_query' => array(                             array(                                 'taxonomy' => 'actress',                                 'field'=>'id',                                  'terms' => $tax_term->ID                                )                         ),                         'posts_per_page' => 3                       )                  );     while ( $loop->have_posts() ) {             $loop->the_post();             echo '
' . get_the_title() . '
';         }          }          ?>
     <?php get_footer(); ?>


title: How to remove uncategorised posts from WordPress

text:
I am using koresponsive theme. I am displaying name of categories as my menu bar just below my header. Now I need to remove 'Uncategorized' category from displaying it in the menu bar. How can I do it? What is the code.Please help me. Here is my `header.php`. I guess I have to change in `wp_list_categories`. I tried many ways. But it is not working.                   <!DOCTYPE html>         <?php $options = get_option('koresponsive'); ?>        <html class="no-js" <?php language_attributes(); ?>>              <meta charset="<?php bloginfo('charset'); ?>">     <title><?php wp_title(''); ?></title>     <?php kore_meta(); ?>      <link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />     <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>" />     <?php wp_enqueue_script("jquery"); ?>     <?php if ( is_singular() ) wp_enqueue_script( 'comment-reply' ); ?>          <?php kore_head(); ?>     <?php wp_head(); ?>         <?php if (is_front_page()) { ?>            <?php } ?>                   <?php flush(); ?>       <body id ="blog" <?php body_class('main'); ?>>

                      <?php if( is_front_page() || is_home() || is_404() ) { ?>
                             <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?>
                   <?php } else { ?>
                             <a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?>
                   <?php } ?>                   <?php if ( !function_exists('dynamic_sidebar')          || !dynamic_sidebar('Top Widget') ) : ?>             <?php endif; ?>

                                              <?php if ( has_nav_menu( 'primary-menu' ) ) { ?>                             <?php wp_nav_menu(   array( 'theme_location' => 'primary-menu', 'menu_class' => 'menu', 'container' => '' ) ); ?>                         <?php } else { ?>
                                 <?php wp_list_categories('title_li='); ?>
                         <?php } ?>


title: Hiding posts - WP Hide Post not working

text: I frequently publish posts that I need to be hidden. They need to be published, so that someone who has their url can go to them, but I don't want them showing up on my homepage, in my recent posts widget, on my blog page, in my categories etc. I know I can normally use the WP Hide Post plugin for this, but somehow that isn't working for my site. When I create a new post and choose all the hide options WP Hide Post offers, the post still shows up on my blog page (which isn't my homepage). I've looked around here and found some similar topics to hide posts using code, but only to hide posts from one location, for example from the recent posts widget or from the homepage or from... I'm searching for a way to hide them from practically everywhere without having to add several lines of code each time I publish a post that needs to be hidden. Would really appreciate it if someone could help me. Bummed that the WP Hide Post plugin doesn't work for me:/ Thanks! PS I'm know publishing those posts as pages using WP Hide Post to hide the pages, this works, but it clutters up my pages list.


title: tags & categories with custom post type

text: What do i need to do to enable categories and tags for a custom post type i´ve made? I use the following code:               /* Create custom post type: "Tilbud" */     register_post_type('tilbud', array(     'label' => __('Tilbud'),     'singular_label' => __('Tilbud'),     'public' => true,     'show_ui' => true,     'capability_type' => 'post',     'hierarchical' => false,     'rewrite' => false,     'query_var' => false,     'supports' => array('title')     ));


title: How to prevent plugins from loading jQuery

text: I recently downloaded a free plugin from wordpress.I want to remove the plugin from loading jQuery because you experts know that it is already loading from wordpress header.php file. The plugin is testimonial-slider How to edit the plugin to prevent it from loading jQuery? I tried other methods like enqueue scrips, but cannot find success.Now I'm planning to edit this plugin, can anyone guide me? thanks


title: Filter custom post types by custom field using AJAX

text: I have a few custom post types (books, films etc) created with WP-Types. I then have a custom field called Genre, created with ACF. If a user selects "Books" from the dropdown on the frontpage, he is taking to an archive page displaying all the books available. What I would like now is to create a dropdown on that archive page, that lists all the genres available in "Books". When the user selects a genre from that dropdown, the posts must be filtered with AJAX. I have been trying for hours with no success to get this filtering plugin working which seems to do exactly what I need: > http://luis-almeida.github.io/filtrify/ I understand that something like this is quite difficult to achieve, but hoping someone on here knows Wordpress enough to help me achieve this. Thanks in advance!


title: Can a Wordpress blog be entirely hosted on a CDN if cached?

text: I am developing a Wordpress blog for a client who believes that more than 1m pageviews will be served every month. Unfortunately his server resources are very limited so I was thinking of hosting the blog - as a static website - on a CDN. My client intends to publish posts in batches, morning, afternoon and evening so I was thinking of doing the below:   1. I install the blog on my client's server where my client can manage posts, pages, etc.   2. Whenever a new post is published, I would create a static .html version of the post and upload it to the CDN. I could use W3 Total Cache or WP Super Cache to create the .html. I would then use the CDN's APIs to upload the file.   3. In-between batches, when his server is idle, I will re-create the .html of all old posts for areas such as "Latest blog posts", etc.   4. I update the .html of the old posts on the CDN Comments in this blog are closed. Of course when users open the blog at http://www.mydomain.com, this has to be loaded from the CDN(which I believe would be push CDN) and not from the client's server. I don't want my client's server to be accessed in any way(which I believe would be pull CDN) due to the lack of CPU and memory; it will only be used by the client himself to manage the content. Is this something I can achieve? My main concern are permalinks, can a CDN replicate the same permalink structure of my blog?


title: Wordpress multisite change language

text: I want to change site language through cookies. As I have multisite, so define('WPLANG') is not working in wp-config.php. So I added hook to filter "locale". But still not working... What to do ? p.s I have translated .po & .mo files in "wp-content/languages/" folder. The code in functions.php               add_filter( 'locale', 'set_my_locale', 9999 );     function set_my_locale( $lang ){     $lang = "fr_FR";     return $lang;     }      Any ideas ? **UPDATE:** Created as a plugin and all worked like a charm.


title: Safe way to allow sample HTML code in comments?

text: I see that post comments do not allow short snippets of sample HTML code to be entered for safety reasons. But if you have a blog where you expect to have conversations about code, how do you handle this? Is there a safe way to allow code in comments so that it can be discussed? Thanks.


title: Sort Posts by custom fields inside a table

text:
I am trying to build a table in each category pages where all the posts from the category will be displayed and make them sortable by custom fields value. I searched a lot about this and I am not sure whats the best way to do this. I have tried this method which has several flaws. this is what I have in category.php

Event Name	     <a href="<?php $category_id = get_query_var('cat'); echo get_category_link( $category_id );?>&last_updated">Updated	     <a href="<?php $category_id = get_query_var('cat'); echo get_category_link( $category_id );?>&published">Published	     <a href="<?php $category_id = get_query_var('cat'); echo get_category_link( $category_id );?>&votes_desc">Votes	     <a href="<?php $category_id = get_query_var('cat'); echo get_category_link( $category_id );?>&ratings_desc">Rating
              <?php if(have_posts()): while(have_posts()): php the_post(); ?>            <tr <?php post_class(); ?> id="post-<?php the_ID(); ?>">                <a href="<?php the_permalink();?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>
	               <?php the_field('last_updated'); ?> <?php $updtd = get_field('last_updated'); echo time_ago($updtd); ?>	               <?php the_field('published'); ?> <?php $pub = get_field('published'); echo time_ago($pub); ?>	                <?php the_field('votes'); ?>	                <?php the_field('ratings'); ?>
         <?php endwhile ?>               <?php endif ?>
      and this is what I have in my functions.php:               add_action('pre_get_posts', 'wpd_pre_get_posts');          function wpd_pre_get_posts( $query )     {     // validate     if( is_admin() )     {         return;     }          // get original meta query     $meta_query = $query->get('meta_query');          if(is_category()){                  if( isset($_GET['votes_desc']) )         {         $query->set('orderby', 'meta_value_num');           $query->set('meta_key', 'votes');           $query->set('order', 'DESC');          }              if( isset($_GET['ratings_desc']) )         {         $query->set('orderby', 'meta_value_num');           $query->set('meta_key', 'ratings');           $query->set('order', 'DESC');          }              if( isset($_GET['last_updated']) )         {         $query->set('orderby', 'meta_value_num');           $query->set('meta_key', 'last_updated');           $query->set('order', 'DESC');          }              if( isset($_GET['published']) )         {         $query->set('orderby', 'meta_value_num');           $query->set('meta_key', 'published');           $query->set('order', 'DESC');          }          // always return     return;          }      } **How it works:** When you go to yoursite.com/cat=3&published the table is sroted by the latest published posts. **Flaws**   1. The last updated filed is not being sorted. although its as same as the published field, when clicked, the posts are not sorted by latest dates.   2. you cannot sort the table by multiple custom fields value.. If anyone can help with this, I will be grateful. I know I am doing a lot of things wrong. :( Thanks


title: How to remove categories filter from wordpress admin?

text: I removed the categories column from "All posts" page by applying this code.               add_filter("manage_edit-post_columns", "my_post_edit_columns");     function my_post_edit_columns($columns){       unset($columns['categories']);       return $columns;     }      This code removed categories column. But still i see the categories filter in the top. Is there a way to remove it other than using CSS to hide it? Thanks


title: Simplest way to create two private sections each with a common account

text: My client's site requires two separate, private sections. For each of them, there is one common login/password pair (or possibly one password without login) to be used. The client probably wants this information to be manageable in dashboard. Since for each page the credentials are the same for everybody with access, I guess working with WP users and WP native private functionality is unnecessarily complicated. But then what would be the easiest way to implement this?


title: queries inside of a class

text: I'm building a plugin and I'm quite new to wordpress I have a class what has couple of methods what should execute database queries. The class look as it follows               class MyClass{                  private $wpdb;                  function __construct(){                 global $wpdb;                  }                  function query(){             $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->wp_competitors                                  ( id, field_key, field_value ) VALUES ( %d, %s, %s )",1,                                  $field_key, $field_value) );                  }               }      I would like to be able to use inside of my class wordpress native database class, how to do this?


title: Specific Post Format Image Thumbnail

text: I have a post thumbnail set for standard posts (when an image is featured) but for image format posts I'd like to have a separate, dynamically resizing (i.e. image resizing in the functions php via add_image_size), thumbnail. I found this snippet from the codex:               if ( has_post_format( 'video' )) {     echo 'this is the video format';     }      I've tried using it on my index.php with 0 success. Am I on the right track or should I be doing something completely different?


title: I want my yearly archives to show a list of all posts

text: The default behaviour for monthly and yearly archives is to get a set of posts for that period (limited by the max-posts-per-page setting) and show them in full, with paging. I would like a different behaviour for yearly archives (it would seem more natural in most blogs to me, BTW) : show a list of all posts for that year -like an index-, perhaps with excerpts. Which would be the recommended way?


title: Get the bare URL for an attachment

text: I'm trying to get the link to the thumbnail size of an attachment image. I tried this:               wp_get_attachment_link( $img_id, 'thumbnail' );      but it returns the actual HTML for the image wrapped in a link. I want just the bare URL directly to that size image. Does Wordpress have a different function I should be using, or do I have to extract it from the HTML returned by `wp_get_attachment_link`?


title: Disable single post page

text: Is there a way to disable single post page, for example when some tries to go to single post page to show 404 page.


title: How to show a random selection of posts from the search

text: I want to show only a random selected number of search results from a search. Its different to the random output from a category. Any Ideas how to do this? it is for a big database to give every post of the search result the chance to be viewed.


title: prepare() not working

text: When I do this:               $transients = $wpdb->get_col(         "         SELECT     option_name         FROM       $wpdb->options         WHERE      option_name         LIKE       '_transient_wb_tt_%'         "     );      It works fine, but when I use prepare like so:               $transients = $wpdb->get_col( $wpdb->prepare(         "         SELECT     option_name         FROM       %s         WHERE      option_name         LIKE       '_transient_wb_tt_%'         ",         $wpdb->options     ) );      It doesn't work, what am I doing wrong here?


title: Search widget breaks when using multiple loops?

text:
I have created wordpress template that uses two loops via WP_Query object. Everything works fine except **Search widget**. I've been pulling my hairs out for three days now Googling like a madman,but didn't find a solution. For example in my **searchbox** I type: _**First cat**_ (that is the name and content of my post inside "cat" category) and click search and NOTHING happens. Strange thing is this: if I create a "normal" (main Loop) above other two Loops the **Search widget** WORKS, but the problem is that now my "normal" **(main Loop)** is showing **ALL** posts from my other two loops.   Can somebody please help me or give a suggestion how to solve this?   Link to my site if you want to check my non working search widget:(   **Index.php** look's like this:                <?php get_header(); ?>     <?php get_sidebar('Main Sidebar'); ?>

           <?php if (have_posts()) : ?>                 <?php                                      $paged1 = isset( $_GET['paged1'] ) ? (int) $_GET['paged1'] : 1;         $paged2 = isset( $_GET['paged2'] ) ? (int) $_GET['paged2'] : 1;         $args=array(              'category_name' => 'cats',         'paged' => $paged1,         'posts_per_page' => 2,         'order' => 'DESC'          );          $temp = $wp_query;          $wp_query= null;          $wp_query = new WP_Query($args);          while ( $wp_query->have_posts() ) : $wp_query->the_post();          ?>

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

                                         <?php the_post_thumbnail(); ?>                 <?php the_content('Read on...'); ?>
                 <?php _e('Filed under:'); ?>
<?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>
                 <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>

         <?php endwhile;?>         <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
         <?php endif; ?>
         <?php          $pag_args1 = array(             'format'  => '?paged1=%#%',             'current' => $paged1,                    'total'   => $wp_query->max_num_pages,                   'add_args' => array( 'paged2' => $paged2 )         );         echo paginate_links( $pag_args1 );         ?>
               <?php     $wp_query = null;     $wp_query = $temp;     wp_reset_postdata();     ?>

             <?php                 $args2=array(          'category_name' => 'dogs',     'paged' => $paged2,     'posts_per_page' => 2     );     $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query($args2);     while ( $wp_query->have_posts() ) : $wp_query->the_post();     ?>

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

                  <?php the_post_thumbnail(); ?>                 <?php the_content('Read on...'); ?>
                 <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>
                 <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>

         <?php endwhile;?>
                 <?php            $pag_args2 = array(             'format'  => '?paged2=%#%',             'current' => $paged2,             'total'   => $wp_query->max_num_pages,             'add_args' => array( 'paged1' => $paged1 )         );         echo paginate_links( $pag_args2 );         ?>
               <?php     $wp_query = null;     $wp_query = $temp;     wp_reset_postdata();     ?>

        <?php get_footer(); ?>      Modified **Index.php** with Main loop that kinda works (Main loop showing all the post's from other two loops,but search widget WORKS..)                <?php get_header(); ?>     <?php get_sidebar('Main Sidebar'); ?>

            //Now Search Widget is WORKING but its's showing posts from             //other TWO LOOPS so it looks like a BIG mess:(          <?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>

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

                  <?php the_post_thumbnail(); ?>                 <?php the_content(); ?>
                 <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>
                 <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>

              <?php endwhile; ?>
         <?php posts_nav_link(); ?>
              <?php endif; ?>

           <?php if (have_posts()) : ?>                 <?php                                      $paged1 = isset( $_GET['paged1'] ) ? (int) $_GET['paged1'] : 1;         $paged2 = isset( $_GET['paged2'] ) ? (int) $_GET['paged2'] : 1;         $args=array(              'category_name' => 'cats',         'paged' => $paged1,         'posts_per_page' => 2,         'order' => 'DESC'          );          $temp = $wp_query;          $wp_query= null;          $wp_query = new WP_Query($args);          while ( $wp_query->have_posts() ) : $wp_query->the_post();          ?>

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

                                         <?php the_post_thumbnail(); ?>                 <?php the_content('Read on...'); ?>
                 <?php _e('Filed under:'); ?>
<?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>
                 <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>

         <?php endwhile;?>         <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
         <?php endif; ?>
         <?php          $pag_args1 = array(             'format'  => '?paged1=%#%',             'current' => $paged1,                    'total'   => $wp_query->max_num_pages,                   'add_args' => array( 'paged2' => $paged2 )         );         echo paginate_links( $pag_args1 );         ?>
               <?php     $wp_query = null;     $wp_query = $temp;     wp_reset_postdata();     ?>

             <?php                 $args2=array(          'category_name' => 'dogs',     'paged' => $paged2,     'posts_per_page' => 2     );     $temp = $wp_query;     $wp_query= null;     $wp_query = new WP_Query($args2);     while ( $wp_query->have_posts() ) : $wp_query->the_post();     ?>

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

                  <?php the_post_thumbnail(); ?>                 <?php the_content('Read on...'); ?>
                 <?php _e('Filed under:'); ?> <?php the_category(', ') ?> <?php _e('by'); ?> <?php  the_author(); ?>
                 <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?> <?php edit_post_link('Edit', ' | ', ''); ?>

         <?php endwhile;?>
                 <?php            $pag_args2 = array(             'format'  => '?paged2=%#%',             'current' => $paged2,             'total'   => $wp_query->max_num_pages,             'add_args' => array( 'paged1' => $paged1 )         );         echo paginate_links( $pag_args2 );         ?>
               <?php     $wp_query = null;     $wp_query = $temp;     wp_reset_postdata();     ?>

        <?php get_footer(); ?>


title: Is there a blank theme framework compatible with WP 3.0?

text: I don't feel like making my own theme from scratch, so I looked for some theme frameworks, but they're all old and when I install them on WP 3.0 they produce loads of errors and don't behave properly. I just need a 3.0 ready blank theme with the bare elements (just text, but functional) to then shape myself into a good looking blog. Thanks in advance.


title: How to add an alternative style sheet as a theme option?

text: I'm trying to create a few extra theme options in the "customise" section of the wp admin menu. I would like to offer an option to load an alternative style sheet. Question: How can I adapt the following code to replace the stylesheet name "posts.css" with a user-selected option?               function theme_styles()       {       // Register the style like this for a theme:        // (First the unique name for the style (custom-style) then the src,       // then dependencies and ver no. and media type)      wp_register_style( 'custom-style',      get_template_directory_uri() . '/posts.css',      array(),      '20120208',      'all' );          // enqueing:     wp_enqueue_style( 'custom-style' );     }     add_action('wp_enqueue_scripts', 'theme_styles');      This is the particular line of code I am having trouble with - I have tried this, where 'posts' is a theme option and 'style.css' is a default - but it gives a blank page:               get_template_directory_uri() . '/<?php echo get_theme_mod( 'posts', 'style.css' ); ?>',       And this is how I added the alternative stylesheet option to the wp menu incase it matters:               $wp_customize->add_setting( 'posts', array(         'default'        => 'style.css',     ) );          $wp_customize->add_control( 'posts', array(         'label'   => 'Post Blocks',         'section' => 'themedemo_demo_settings',     'type'       => 'select',     'choices'    => array(         'style.css' => 'Default',         'posts.css' => 'No blocks',                 ),     ) );      Thanks


title: Custom post type not using it's own single-postname.php

text:
I have a custom post type (that I'm using on a template page), the custom post type is called 'headerhome'. When I post say a gallery there I'm trying to get it to redirect to 'single-headerhome.php', yet it always just goes to 'single.php'. The name of the custom post type itself is arbitrary, the name of the templage page it's on is 'front-page.php'. I'm really confused, I'm not the best at WP yet so when something simple like this doesn't work I have no idea how to fix it, even after pouring over the codex for an hour.               // Add new post type for homepage     add_action('init', 'frontpage_top_init');     function frontpage_top_init()      {         $args = array(             'label' => __('Homepage'),             'singular_label' => __('Homepage'),             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,              'query_var' => true,             'rewrite' => true,             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => 5,             'supports' => array('title','editor'),             'has_archive' => true         );          register_post_type('headerhome',$args);          }      Here's my code on the front-page.php EDIT:-               <?php      /*         Template Name: frontpage     */     ?>     <?php get_header(); ?>

           <?php     $portfolio_query = new WP_Query(array(             'post_type' => 'headerhome',             'showposts' => 1             ) );     ?>           <?php while ($portfolio_query->have_posts()) : $portfolio_query->the_post(); ?>
<?php the_title(); ?>
             <?php the_content(); ?>

           <?php the_field('showreel'); ?>

             <?php the_field ('gallery-description'); ?>
             <?php the_field('image-1'); ?>

          <?php endwhile; wp_reset_postdata();?>
           <?php get_footer(); ?>      No matter what I try, it always uses single.php and not single-headerhome.php. If my understand of wordpress is correct, and it's probably not - shouldn't creating the template file single-headerhome.php automatically make wordpress use that for this post type?


title: Wordpress permalink prefix

text: I have a small ecommerce site in Wordpress and I am having some difficulties in getting the right permalink structure. Basically, for basic pages it should look like : domainname.com/page_title. Other post types should have the structure: domainname.com/post_type_slug/item_title. Well, everything is fine except for the blog posts (I want it to show domainname.com/blog/post_title). Having the permalink setting as %postname%, I get domainname/post_title. On the other hand, /%category%/%postname%/ returns domainname.com/category/post_title. And obviously, entering /blog/%postname% won't work either because that would affect the permalinks of other post types. Any ideas? Thanks in advance.


title: Lead form that submits to 2 external APIs

text: I need to add 2 registration forms to my wp website, each form should submit the information in it to 2 different APIs. I don't know even where to begin. Is there a plugin that can help me handle the task? do i need to write a plugin from scratch? any pointer or recommendation will be much appreciated as i'm totally in the dark here. EDIT: Add more info as requested by UBERABUSER (thanks!) The 2 APIs i'm working with are (a) client CRM, a custom API written in perl, handles registration of prospective clients (b) An API of a list management / mailing service called TRACTION Here's a working example of such a form: http://benchmarketing.com.au/k2a/ebook/ Now i need to create a version of the same form with the exact same functionality in wordpress... and this is what i'm in the dark about.


title: Adding custom css to a theme depending on whether the admin user is logged in or not

text: Is it possible to add custom css to a stylesheet in a theme depending on whether the user is logged in or not? When I log in, the theme navigation and when viewing the main site bar is hidden behind the wpadminbar and I would like to change the css of the theme nav bar only when an admin is logged in and when the site is being viewed?


title: Thesis 2 custom Page

text: I have been installing lately the latest version from Thesis and getting to the point to make a custom landing Page. I have been building a plugin and I would like to link the content of it to my newly created landing Page. How do I do this, where can I upload my custom php code for the thesis landing Page? thanks in advanced


title: reverse next/prev page order

text: I think the way wordpress display previous and next posts is basically non sense, with next posts on the left side, and older posts on the right side. I am using the code               <?php posts_nav_link() ?>      is there a way to reverse such order?


title: How to select a template for a custom post type?

text: I've created a custom post type and custom taxonomy (all fine so far!) but when I try to view the post it's giving me a page not found. What do I need to do to setup a template which the custom post type below will use?               add_action( 'init', 'create_post_type' );     function create_post_type() {         register_post_type( 'members',             array(                 'labels' => array(                     'name' => __( 'Members' ),                     'singular_name' => __( 'Members' )                 ),             'capability_type' => 'post',             'supports' => array('title','editor','comments'),                'public' => true,             'has_archive' => true,             'rewrite' => array( 'slug' => 'members' ),             )         );     }          function members_init() {         // create a new taxonomy             register_taxonomy(             'members',             'members',             array(                 'label' => __( 'Member Categories' ),                 'sort' => true,                 'hierarchical' => true,                 'args' => array( 'orderby' => 'term_order' ),                 'rewrite' => array( 'slug' => 'members' )             )         );            }     add_action( 'init', 'members_init' );


title: wordpress multisite... collect all posts on main blog - exclude category?

text: hey guys, I'm using the sitewide tags Multisite plugin on my wordpress setup. I'm collecting all blogposts of multiple subblogs on my mainblog. Any idea how I could manage to exclude a certain category from this collection? e.g. If a user is writing a blogpost on a subblog and is adding it to the category "private" the mainblog should not show this post! thank you for your help.


I'm having the exact same problem described in this post: add_action('wp_ajax_[action name]', myfunction) problem I set add_action('wp_ajax_my_function_call','my_ajax_function'). If I print_r($wp_filter) immediately after this line, my action is in the $wp_filter array. However, by the time I do my jQuery.post call to admin-ajax.php, my action has disappeared from $wp_filter. I verified this by adding this to line 354 of wp- includes/plugin.php:               if($tag=='wp_ajax_my_function_call') print_r($wp_filter);      According to user1567 in the above-cited post, "the problem was the loading order and the location of the add_action calls." Unfortunately this hasn't helped me track down the problem. I tried setting the priority of the add_action to 99 and to 1. Neither helped. Any other ideas on what might be causing this situation, or at an explanation of why, in general, an action that was definitely in $wp_filter at one point would inexplicably disappear from it without even being triggered?


title: What's the internal concatenation function for creating Excerpts with Wordpress?

text: I'm already familiar with the_excerpt() and get_the_excerpt() functions. These two functions relate specifically to some node/taxonomy/whatever (post, page, custom post type) inside of Wordpress, unless I'm mistaken. What if I have some external text, and wanted to pass it through a concatenation function. Does anyone know the function to do that? What I'm trying to avoid, is creating a new function or re-writing an old function to limit words inside of a string. For example, > echo some_excerpt_function($text, $amount_of_words_to_limit); I'm assuming Wordpress has something similar to this, that's why I'm asking.


title: Selling WordPress sites?

text: What are the laws concerning developing WordPress sites using other developers' plugins and then selling the sites?


title: How does one reduce the number of stored revisions?

text: How does one reduce the number of stored revision (e.g. 5 max) for post types that support revisions?


title: Make Theme Options Native to Theme Customizer

text:
With the native Theme Customization API it makes no sense to have an independent options panel. So how do I implement my code (below) into the Theme Customizer? Here is the code for my Theme Customizer: code here In my options panel I allow users to select between Next/Previous Links in archives or pagination, the code looks like this:               array( "name" => "Paginate or next/previous links?",     "desc" => "Choose your option",     "id" => $shortname."_next_prev_or_paginate",     "type" => "select",     "options" => array("Next/Previous Links", "Pagination"),     "std" => "Next/Previous Links"),      Here is the function that makes it work:               // Pagination     function my_theme_navigation() {         global $shortname;              if( get_option( $shortname . '_next_prev_or_paginate' ) == 'Next/Previous Links' ) :         // the block for next-prev navigation         echo '
';         next_posts_link('Older');         echo '
';         echo '
';         previous_posts_link ('Newer');         echo '
'; else :         // the block for pagination         global $wp_query;         $big = 999999999;         // need an unlikely integer         echo paginate_links(            array(                'base' => str_replace( $big, '%#%', get_pagenum_link( $big ) ),                'format' => '?paged=%#%','end_size'     => 1,'mid_size'     => 2,                'current' => max( 1, get_query_var('paged') ),                 'total' => $wp_query->max_num_pages            )        );         endif;     }      I then simply call it using this:               <?php my_theme_navigation(); ?>


title: Navigate by Tags inside a custom Post Type

text: I want to have the possibility of navigate by 'standard Tags' inside my custom post type 'Car', like the following: > http://www.example.com/car/toyota > > http://www.example.com/car/blue Of course, this will show only post from `post_type` 'car'. Not standard posts. I guess, I need a rewriting function or sort, but I am not good enough to start from scratch. Any suggestions, code, plugins? Or any clue how I can do what? Here my settings: I'm using custom post type + specific custom post type category   * post_type: car   * post_type-category : car_sedan, car_suv , car_supercar   * **standard** Tags : toyota, hummer, blue, red I'm using the Magic fields 2 plugin. _Note: I do not want to create specific`post_type` tags, because I allready have a lot of tags and a lot of tagged posts._


title: Disable image resizing on specific upload fields

text: I am using the Options Framework Theme from devinsays, but am having a "small" problem with the Image Upload functionality. Basically, I need to disable resizing on a specific upload-field, but keep it on all others. I do realize that this functionality is not specifically dependent on this framework, but I haven't been able to find any resource on how to achieve this on a case by case basis for specific Theme Options, so I'm hoping someone here could help. Any input would be appreciated!


title: Media library and posts list problems with Wordpress on IIS

text: I have Wordpress 3.5 installed on IIS7 and I'm using SQL Server instead of MySql. Some strange "glitches" occur and I think their related to the same problem.   1. I cannot see media library items on the first page. If I'll go to ~/upload.php?paged=2 I am able to see all the media. It basically starts to show the items from the second page.    2. The same problem occurs with the posts list. If I'm going to another page in the posts category, I am able to see them.    3. Settings/Permalinks throws and internal server error, so I can't check what's there even if I'm not sure if I would be able to change permalinks from there.  Any ideas are appreciated, I'm curious what's the reason for the first two points. Update: for point 3, the detailed error sounds like this:               C:\Program Files\PHP\v5.3\php-cgi.exe - The FastCGI process exited unexpectedly     Handler PHP53_via_FastCGI     Error Code  0x00000001


title: Taxonomies for Wordpress Media Library

text: > **Possible Duplicate:**   >  How it is possible to use taxonomies on attachments? I know this has been a long debated issue with WP, but I was hoping that since the 3.5 upgrade, there has been some progress in categorizing images in the Media Library. Really, what I am hoping to accomplish is creating a set of categories for the images in the Media Library, and then assigning the current images, or future images, to those categories. Then, later down the road I could call them in a page template based on their category. Any ideas WPA? Many thanks.


title: How do I output a list of a specific post type in a table?

text: I've used the Custom Content Type Manager plugin to create a new post type of "Job". It includes a couple custom fields for "Location" and "Job Type". I have a page called "Jobs", and now I'd like to display a table on the Jobs page that shows an HTML table, with eg:               Job Title              Location       Type     Web Developer          Canada         Full-time      Data Entry             USA            Contract     Sales Rep              Switzerland    Full-time      and obviously clickable links to view the job page. I know I can do this by creating a custom template and writing the code, but it seems to me like this is a pretty straight-forward thing, so I was kind of expecting there would be a shortcode or something that I could use to easily display this. Is there a way to do this? A plugin?


title: What Triggers a Plugin Update Alert

text: How does WordPress know a plugin has an available update? Is the process handled by the readme.txt file? I am trying to manage 3rd party plugins that I alter in an effort to better fit/meet the needs of my instance of WordPress but I would like to maintain the functionality that alerts the CMS user that an update is available for the 3rd party plugin. If I alter a plugin’s title will WordPress still know if there is an update to that plugin's code base? E.g. ‘Plugin Name’ (changed to) ‘Plugin Name – Modified’


title: How to assign a WP 3.0 custom nav menu to a theme's navigation menu location via script?

text: I'm using this script inside a plugin to create a new custom menu on the fly and assign a page to it...               $menu_id = wp_create_nav_menu( 'header-menu' );     $menu = array( 'menu-item-type' => 'custom', 'menu-item-url' => get_home_url('/'),'menu-item-title' => 'Home', 'menu-item-status' => 'publish' );     wp_update_nav_menu_item( $menu_id, 0, $menu );      And this works great. However, what I'm stuck on is how to hook this menu up to one of my theme's "Menu Locations". Since I'm registering a nav location called "header-menu" in my theme's functions.php, I thought that the code above, calling wp_create_nav_menu( 'header-menu' ) would hook my custom menu to the location defined in my theme as "header-menu", but its not. For example, my theme registers two menu locations...               register_nav_menus(       array('header-menu' => __( 'My Header Menu' ),       'footer-menu' => __( 'Footer Menu' ))     );      How can I hook the "Header Menu" I created with wp_create_nav_menu( 'Header Menu' ) to the "My Header Menu" location that i've registered in my theme? I'm sure the answer is somewhere in nav-menu.php, but I can't find it. ie, I can do this manually from the WordPress "Appearance > Menus" Manager and under "Theme Locations > Main Navigation Menu" I select "Header Menu" and click "Save". I'm trying to do this in script.


title: Pagination doesn't function properly for archive of a custom post type set as the front page

text:
I created a similar question about an hour ago but since then I feel that I've changed things enough so that if someone viewed it for the first time, it'd just be a confusing mess. So I am opening up a new question that is a bit more clear and relevant to my issue. Basically, I have a custom post type called `podcasts` and I have created an archive page for this post type by creating a new file called `archive- podcasts.php`. I have made this page into a custom template and have set it as the front page via `Settings > Reading` in the dashboard. However, even after doing this, the archive page wasn't showing as the front page, so I did a little research and found this gem to drop in my `functions.php` which finally allowed the archive of posts to show up on the front page.               add_action("pre_get_posts", "custom_front_page");     function custom_front_page($wp_query){         //Ensure this filter isn't applied to the admin area         if(is_admin()) {             return;         }              if($wp_query->get('page_id') == get_option('page_on_front')):                  $wp_query->set('post_type', 'podcasts');             $wp_query->set('page_id', ''); //Empty                  //Set properties that describe the page to reflect that             //we aren't really displaying a static page             $wp_query->is_page = 0;             $wp_query->is_singular = 0;             $wp_query->is_post_type_archive = 1;             $wp_query->is_archive = 1;              endif;     }      Awesome, but not quite finished yet. Below is what my `archive-podcasts.php` page looks like:               <?php     /*     Template Name: Podcasts     */     ?>                  <?php get_header();?>

                      <?php                 $paged = (get_query_var('page')) ? get_query_var('page') : 1;                 $args = array( 'posts_per_page' =>5, 'post_type'=> 'podcasts', 'paged' => $paged );                 $postslist = new WP_Query( $args );                      if ( $postslist->have_posts() ) :                     while ( $postslist->have_posts() ) : $postslist->the_post(); ?>
                             <article id="post-<?php the_ID(); ?>">                                 <time datetime="<?php the_time('c'); ?>"><?php the_time('F j, Y'); ?></time>                                 <?php                                      $custom = get_post_custom($post->ID);                                 $buzzsprout_code = $custom["buzzsprout_code"][0];                                 echo do_shortcode($buzzsprout_code);                                      ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="View emails and comment on this episode.">View emails and comment on this episode

                          <?php endwhile; ?>
                         <?php my_paginate_links(); ?>
                          <?php wp_reset_postdata(); ?>                      <?php endif; ?>

                  <?php get_sidebar(); ?>                  <?php get_footer(); ?>      You'll notice that I'm calling the function `my_paginate_links()`. However, calling this function is screwy because it doesn't paginate the archive of posts correctly. When I click on a page number, it goes to the correct page, but the `current` CSS class doesn't match up. Here is what `my_paginate_links()` looks like:               function my_paginate_links() {         global $wp_rewrite, $wp_query;         $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] : $current = 1;         $pagination = array(             'base' => @add_query_arg('page','%#%'),             'format' => '',             'total' => $wp_query->max_num_pages,             'current' => $current,             'prev_text' => __('&laquo previous'),             'next_text' => __('next »'),             'end_size' => 1,             'mid_size' => 2,             'show_all' => true,             'type' => 'list'         );         if ( $wp_rewrite->using_permalinks() )                 $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );         if ( !empty( $wp_query->query_vars['s'] ) )                 $pagination['add_args'] = array( 's' => get_query_var( 's' ) );         echo paginate_links( $pagination );     }      Can someone help me figure out why the pagination isn't working? Also, is there a better or more efficient way of going about all of this? Also, I should note that the pagination works fine on my main query for my regular posts. They just don't work for this archive of custom post type posts. Is there a way to get the pagination to work for both instances? Edit: Updated the pagination function               function my_paginate_links() {         global $wp_rewrite, $postslist;         $postslist->query_vars['page'] > 1 ? $current = $postslist->query_vars['page'] : $current = 1;         $pagination = array(             'base' => @add_query_arg('page','%#%'),             'format' => '',             'total' => $postslist->max_num_pages,             'current' => $current,             'prev_text' => __('&laquo previous'),             'next_text' => __('next »'),             'end_size' => 1,             'mid_size' => 2,             'show_all' => true,             'type' => 'list'         );         if ( $wp_rewrite->using_permalinks() )                 $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );         if ( !empty( $postslist->query_vars['s'] ) )                 $pagination['add_args'] = array( 's' => get_query_var( 's' ) );         echo paginate_links( $pagination );     }


title: comment_email hook doesn't seem to work for comment editor field

text: I am building a plugin that allows users to PPK encrypt their users' IP/email data. Thus, IP/email data is set to dummy values in the comments table and encrypted values are stored in corresponding meta fields. I'm successfully using the `comment_email` hook to lookup email addresses in the admin comments browser from my encrypted meta values. When editing a comment in the admin interface, in the **Author** box the email field is preceded by the label "E-mail (send e-mail)", where the text in brackets is hyperlinked to the email address. My hook appears to operate correctly there, retrieving the encrypted email address from comment metadata and decrypting it before returning it. However in the edit field itself, the real (dummy) contents of `wp_comments.comment_author_email` is revealed. Is there a hook I can use to modify this before the screen opens? I thought perhaps `preprocess_comment` would do it, but it doesn't seem to be called. (I _can_ solve this by adding an AJAX op to this screen and modifying the edit box contents after the screen is rendered. However, that's a bit hacky, and may be impossible if I try to apply it to the Quick Edit AJAX feature).


title: How to validate the file name of the Media File Uploads?

text: I want to validate the file name of the files to be uploaded from the Media Library. CASE study: I want to restrict the file name containing '%', '. .', '/' etc..from uploading to the media library. I can restrict the file types but not able to restrict as per the file names. Suggest me any wordpress filter or any procedure to accomplish the solution.


title: Columns in a "post"

text: I understand that all of wordpress is structured around certain key "entities". Some of which are,   1. Pages   2. Posts   3. Comments That list is by no means exhaustive because I know wordpress has few other key "entities" Every wordpress site has a "homepage" and when I change any of the "theme" settings, it is this "homepage" that reflects those changes. For example I can configure the home page to have a "sidebar" + "content" + "sidebar" or any variation thereof. What I would like to know is, if I can have my "posts" use columns as well. Because I would like each of my "posts" to open in a new page and present 3 columns to the person browsing the site. The first column having a list of bookmarks into different parts of a video that is being displayed in the second column. And I would like to use the third column to display some pictures. I know my requirement is very specific. I am a very new to wordpress. Any help in this regards would be much helpful. Thanks.


title: Limit the number of posts in query_posts function with custom post types

text:
I am using the code below to display posts defined as a custom-post-type and filtered by a custom-taxonomy of 'england'. I've tried using 'posts_per_page=5' in the query_posts function but this brings up a completely different set of posts from one of my post categories of type 'news'. When I remove the posts-per-page from the query, it returns the listings I want but it defaults to the default 10 set within the Wordpress Settings. How do I override it in the code below?                       <?php query_posts( array( 'country' => 'event-england') ); ?>             <?php if( is_tax() ) {                 global $wp_query;                 $term = $wp_query->get_queried_object();                 $title = $term->name;             }  ?>
                 <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
                      <?php endwhile; else: ?>                 <?php endif; ?>


title: Query Multiple Custom Taxonomies

text: I registered 2 taxonomies: `festival_year` and `art_genre`. I would like users to search for a specific year and genre but am not sure the best way to do this. I have tried various plugins but none have worked. I was able to create separate files, like `taxonomy-art_genre-consumable-crafts.php` with the following code:               <?php     $festivalquery = wp_parse_args($query_string);     $festivalquery['tax_query'] = array(         'showposts' => 10 ,         'orderby' => 'title',         'order' => 'ASC',         'paged' => $paged,         'relation' => 'AND',         array(             'taxonomy' => 'festival_year',             'terms' => array('2010-artists'),             'field' => 'slug',         ),         array(             'taxonomy' => 'art_genre',             'terms' => array('consumable-crafts'),             'field' => 'slug',         ),     );     query_posts($festivalquery);     ?>      which gives me the query I'm looking for. However, there are 11 genres (and of course there will be multiple years). Instead of creating separate page templates, what is the best way to accomplish this? The test site: http://www.beta.cornhillartsfestival.com/artists/ Thank you so much!


title: Restrict file uploads by extension?

text: Is there a way in WordPress 3.1 to restrict allowed file uploads by extension (images only) and file size? Bonus question: Can I limit users to only be able view files they have uploaded themselves?


title: Limiting allowed html elements/strip harmful scripts from editor

text: How can I limit html elements allowed in the tinymce editor in Wordpress 3.1 and ensure harmful scripts have been removed (script/embed tags, etc)


title: Can you orderby slug in a taxonomy archive page using WP_Query?

text: In my taxonomy.php, my query is `                 $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );         $wpq = array ('posts_per_page' => -1, $term->taxonomy => $term->slug, 'order' => 'ASC', 'orderby' => 'slug');       $loop = new WP_Query($wpq);`      It correctly retrieves the ~~droids~~ posts I am looking for, but does not `orderby` `slug`. I can't find `slug` as an option in the documentation any more, but I swear I have successfully used it before. How do I make it so? Edit: `'orderby' => 'name'` appears to work in 1 category but not in my other category (so far, there are only 2). I'm wondering if the category where it does work is just coincidence...


title: Is Auto Post recognition a WordPress feature? How to turn it off?

text: I noticed that if you go to lostlettermen.com/aa, it redirects to a post. Is this a feature in WordPress that can be turned off, or is this done by some type of plugin or custom code?


title: Issue getting gettext to work with conditional statements

text: I've been trying to apply a `gettext` filter to return two different results for different product categories (or read as categories for posts, non- woocommerce specific). I cant seem to get it right. This loads, but does not actually apply the conditional, it always defaults to else condition. What am I missing? This is added to my child theme's functions.php.               function my_text_strings( $translated_text, $text, $domain ) {                 switch ( $translated_text ) {                             case 'Related Products' :                                         if  (is_product_category( 'providers' ) ) {                                             $translated_text = __( 'Check out these other Providers', 'woocommerce' );                                             } else {                                             $translated_text = __( 'Check out reviews of other Providers', 'woocommerce' );                                             }                                             break;                                             }                 return $translated_text;     }     add_filter( 'gettext', 'my_text_strings', 20, 3 );


title: How to add coupon printer?

text: Im building a directory site and for each business listing I wanted to include a printable coupon. I would want users to be able to click the coupon image (or link) and a printable version of the coupon to show up. I looked around for solutions but couldn't find anything that could help. Any help would be appreciated. Thanks a lot.


title: Adding uploaded images to editor from metabox instead of default popup uploader

text: I need to find plugin or create listing of all uploaded images for some post in custom metabox. And i can click to thumbnail for add image to editor in custom format. I downloaded a lot of photos to default upload box, and each time i will do a lot of clicks for insert new image to editor. It is very uncomfortable.


title: Deregister custom post types

text: Anyone know of a way to deregister custom post types ? Is there an equivalent to register_post_type() ?


title: How to correctly call custom field dates into a posts_where filter using SQL statements

text: Currently I have the loop listing posts between two dates using the `posts_where` filter:                function filter_where( $where = '' ) {       $where .= " AND post_date >= '2000-01-01' AND post_date <= 2004-12-31' ";       return where;      }      add_filter('posts_where', 'filter_where');      query_posts($query_string);      while (have_posts()) :        the_post();        the_content();      endwhile;      In a `meta_key` called `original_date` I have stored a different date for each post that I wish to use instead of the `post_date`. How do I correctly call up this `meta_key` into the `$where` query to fulfil the same purpose as the `post_date`?               $where .= " AND [meta_key=original_date] >= '2000-01-01' AND [meta_key=original_date] <= '2004-12-31' ";      For example, the following SQL query doesn't seem to work, even though correct values (`2001-10-29`, `2004-11-03`, etc.) are present in the `original_date` `meta_key` of the posts:               global $wpdb;      $where .= " AND (SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='original_date' ) >= '2000-01-01' AND (SELECT meta_value FROM $wpdb->postmeta WHERE meta_key='original_date' ) <= '2004-12-31' ";      whereas the following works fine on the same posts using their `post_date` as reference:               $where .= " AND post_date >= '2000-01-01' AND post_date <= 2004-12-31' ";      Perhaps the `meta_value` array needs to be stripped of some extraneous material in order to format the results into the same form as `post_date`? How can we approach this?


title: Wordpress as College Application System (Embark)

text: Anyone knows of any plugin or anyone has been using WordPress to serve as a College Application system similar to those by Embark? If not, I'm looking for idea of using current plugins to accomplish this. The system would allow students to create an account, upload their documents, check their status, invite people to submit a letter of recommendation. The admin would then be able to manage those applications, change the status, notify the applicants.


title: Changing directory and/or URL structure

text: I'm curious if its possible (and advisable) to change certain directory names and URL structure via customization by themes or plugins. For example, say I wanted the list of all a user's posts to appear at blog.com/people/username instead of at blog.com/author/username...is this possible via customization? If so, would this type of customization be very problematic when it comes to things like forward compatibility with the latest WP updates and such? Any advice anyone can offer on this would be most appreciated. Thanks. Eddie


title: Exclude all pages except a few?

text:
I have a bunch of pages and I only want to include 2 or 3 pages on my main menu. How would I do that? Currently my code looks like this:               wp_page_menu('include=156,572,542&sort_column=menu_order&echo=0');      If I am going to insert `exclude=x pages`, it wouldn't make sense because there's just too many of them. Please no plugin recommendation. I've tried some but they conflict with other things I do in this regard. **UPDATE** Here's the full function:               function main_nav() {?>

"><?php _e('Skip to content', 'thematic'); ?>
                 <?php echo preg_replace('/
/', '
', wp_page_menu('include=11,13,7,9,4&sort_column=menu_order&echo=0'), 1);?>

 <?php     }          add_action('thematic_header','main_nav',9);      It's a custom version of Thematic's thematic_access() function. I don't know why it's behaving this way. I tried it on a new installation, it doesn't work still.


title: How do I get posts to appear at mydomain.com/blog?

text: I'd like to use WP to manage my whole site, not just the blog. I don't want the blog to appear on the home page, but instead at mydomain.com/blog. What I've done so far under Settings/Reading is to change the "Front page displays" from the default of "Your latest posts" to the other option, "A static page". So that allows me to have a static page for my homepage, which is what I want. Now how do I go about getting the blog portion of my site (posts) to live at mydomain.com/blog ? Any assistance would be most appreciated. Thanks. Eddie


title: wp_get_current_user always returns 0

text:
I'm new to wordpress and modifying the code that's already working on a website. I want to get user's ID but I haven't figured out yet how. The following sample code works on my local environment but it only returs 0 for a user ID on the production site. Any idea would be appreciated.               <?php     $docroot = "/home/production-site/www";     require_once $docroot . '/wp-includes/pluggable.php';          testGetUserid();          function testGetUserid(){         echo 'Before wp_get_current_user
';         $user = wp_get_current_user();         echo 'After wp_get_current_user
';         echo 'ID= ' . $user->ID . '
';     }     ?>      Btw, though I don't know if this is relevant, to me it seems something strange might be occurring in `wp-includes/pluggable.php`, so I uploaded the entire php file here to allow everyone to take a look at the file. And with this file, I had to `require_once` following files on my local env.               require_once 'capabilities.php';     require_once 'functions.php';     require_once 'load.php';     require_once 'plugin.php';     require_once 'user.php';      Env production site: WordPress Ver 3.2.1, others unknown (using sakura.ne.jp hosting service) Env local: Ubuntu 11.04, Apache/2.2.17, PHP 5.3.5-1ubuntu7.2 with Suhosin- Patch (cli) (built: May 2 2011 23:00:17), WordPress Ver 3.2.1 * * * Update June 10, 2012) In addition to everyone's suggestions, @shabushabu (what a name :) I'm Japanese) pointed out the last key factor - `init` hook. Here's what worked for me:               require( dirname(__FILE__) . '/../wp-load.php' ); // Path depends on your file structure, needless to say      :     do_action( 'login_init' );      :  // Whatever you want to do


title: How do I get blog posts to appear within CMS?

text: I'm working with a WordPress CMS website that was set up without a blog. I want the site to continue to function as it has, with mostly static pages, including the home page. I want a page called "Blog" to function as a blog. Now I've been asked to add a blog, and what I expected would be extremely easy isn't turning out that way. This is what I've tried:   1. Added a page called "Blog" and published it.   2. Under Settings >> Reading, set the Posts page to Blog. (A Static Page is selected, with Front Page set to "Home".)   3. Added Blog to the main navigation in the Theme Options.   4. Created 2 posts. When I view the Blog page, two messages appear instead of the two blog posts:               Please go to Admin Panel > Settings > Reading and setup "Front page displays" option      Another detail that may be relevant is there are only 2 page templates: Default Template and Archives. If I select Archives as the template for Blog, I get an archive menu that links to the 2 posts I set up. Should I have a Blog Template as well? How can I add one? What else should I look at?


title: get all categories' latest post in one query

text: My WP blog has 12 categories, 80 subcategories. I need to fetch the latest post from each of those 12 categories. I know how to do it in 12 queries using 12 get_posts() but is there a way to get them in one query? I tried to make it work like this but it fetches more than 12 posts:               // Get array of categories (level-0 only).         $cats= array();         $categories=get_categories($args);         foreach($categories as $category) {              if ($category->parent == 0) {                 $cats[]= $category->term_id ;             }                }         $categories= implode(',',$cats);         // Fetch the latest post of each category              global $wpdb;              $querystr = "SELECT wposts.*          FROM $wpdb->posts wposts             LEFT JOIN $wpdb->term_relationships ON (wposts.ID = $wpdb->term_relationships.object_id)             LEFT JOIN $wpdb->term_taxonomy ON ($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)         WHERE $wpdb->term_taxonomy.taxonomy = 'category'             AND $wpdb->term_taxonomy.term_id IN($categories)         ORDER BY wposts.post_date DESC";              $pageposts = $wpdb->get_results($querystr, OBJECT);      And then the loop:               global $post;             foreach ($pageposts as $k=>$post):                 setup_postdata($post);                 // ... wp loop through your results               }


title: Register new widget

text:
I have a widgetized area and I am trying to add a new widget that can be added to my widget area, I need the code below to be the widget output
     <?php     $args = array( 'taxonomy' => 'post_tag' );     $terms = get_terms('post_tag', $args);     $count = count($terms); $i=0;     if ($count > 0) {         foreach ($terms as $term) {             $i++;             $term_list .= '
slug . '" title="' . s__('View all post filed under %s', 'my_localization_domain'), name) . '">' . $term->name . '
';         }         echo $term_list;     }     ?>
      I just need a tag list (not tag cloud) to be sortable with my other widgets, I tried extending the widget class but failed, please help


title: Can i add custom meta box (Media Uploader) at Category Description

text: I have Question how can i add custom meta box (Media Uploader) at category description, i mean when i will create or edit category then i can add any media file like PDF,                <?php add_meta_box( $id, $title, $callback, $page, $context, $priority, $callback_args ); ?>       That is wordpress meta box function but i did not understand how can i use at category description, can any one help me to solve this. Thanks Umer


title: Is it possible to "freeze" a WordPress blog?

text: I'm currently running a 365 photos project and it's based on a WordPress platform. Currently this is very helpful because I can upload the photos easily and manage comments and stuff. Because we are reaching the end of the year, I would like to "freeze" the blog. I mean, remove all the WordPress engine code and leave all the pages as statics HTML. This will allow me not to have to get updates for WordPress, or worry about security. **Is there any way to "freeze" a WordPress blog?** Do I have to download the entire site with, say, HTTrack and re-upload it or is there a fancier way to do this? BTW, I have no interest of keeping the comments on or any interactivity that the blog has. I just want a static website.


title: Front end posting, not working wp_redirect with 'cannot modify header information' error

text: Im trying to make front end posting page but, sometime 'wp_redirect' is not working with 'cannot modify header information' error. adding data is working well but I don't know why is working well without error sometime, showing error sometime.. Sorry for my bad english, please help me out... and I'm not a programmer just understand some codes anyway... Many thanks!!                   if (isset ($_POST['post_title'])) {             $title =  $_POST['post_title'];         } else {             echo 'Please enter a game  title';         }         if (isset ($_POST['description'])) {             $description = $_POST['description'];         } else {             echo 'Please enter the content';         }              $new_post = array(             'post_title'    => $title,             'post_content'  => $description,             'post_status'   => 'publish',             'post_type' => 'property',               'tax_input' => array( 'property_type' => array($property_type), 'suburbs' => array($suburbs) )          );                   //save the new post and return its ID         $pid = wp_insert_post($new_post);                  //add thumbnail             if (!function_exists('wp_generate_attachment_metadata')){                     require_once(ABSPATH . "wp-admin" . '/includes/image.php');                     require_once(ABSPATH . "wp-admin" . '/includes/file.php');                     require_once(ABSPATH . "wp-admin" . '/includes/media.php');                 }                  if ($_FILES) {                     foreach ($_FILES as $file => $array) {                         if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {                             return "upload error : " . $_FILES[$file]['error'];                         }                         $attach_id = media_handle_upload( $file, $pid );                     }                    }                 if ($attach_id > 0){                     //and if you want to set that image as Post  then use:                     update_post_meta($pid,'_thumbnail_id',$attach_id);                 }  //add thumbnail end              update_post_meta($new_post_id, 'tax_input', $property_type);         update_post_meta($new_post_id, 'tax_input', $suburbs);              //insert custom fields         update_post_meta($pid,'bathrooms',$_POST['bathrooms']);         update_post_meta($pid,'property_lease',$_POST['property_lease']);         update_post_meta($pid,'lost_found_date',$_POST['lost_found_date']);         update_post_meta($pid,'dog_sex',$_POST['dog_sex']);         update_post_meta($pid,'latitude',$_POST['latitude']);         update_post_meta($pid,'longitude',$_POST['longitude']);                   $url = get_permalink( $pid );         wp_redirect($url);         exit();     }           get_header();


title: Looping through tabular data

text:
I am trying to create a table containing information that is a result of two different loops. The first loops through a list of custom post types to display team names. The other is to provide data concerning each of the teams and stored as metadata. So I think I need some way of constructing a double query in order to create a single loop. This is what I have so far:               $team = new WP_Query(array('post_type' => 'team_page') );           $args = array(            'post_type' => 'match_report',            'meta_query' => array(              'relation' => 'OR',               array(                  'key' => 'report_home-select',                  'value' => $team->post->ID,                  'compare' => '=',               ),               array(                  'key' => 'report_away-select',                  'value' => $team->post->ID,                  'compare' => '='               )            )                                            );              $my_query = new WP_Query($args);          $played = $my_query->post_count;          if ( $team->have_posts() ) {     while ( $team->have_posts() ) {         $team->the_post();     ?>
                                  <?php the_title(); ?>	                                  <?php echo $played;?>	                                  9	                                  0	                                  2	                                  	                                  10	                                  33	                                  27
           <?php } ?>


title: Search results sorted by post types

text: I am working on a site with several post types - 4 to be exact - and I am trying to setup the search results page to have a filter/sort the results by post types. For example, when a person searches a term they are taking to the page with the results, all posts found from all post types are shown but up top there are the different post types name links that will sort the results and show only the respective post type's post. Right now I have several loops on the search results page for each post type but when I test it, the loops are all showing the same results even though each loop has a query for a different post type. How do I fix the loop so that it only shows the search results from that post type? I dont want to have different search forms or reset the query and end up losing the search term. Here is some of the code from the page -- http://pastebin.com/L9zEw1cn The first loop is the default loop which will show all the results and the second loop is the loop I am trying to use for the rest of the post types. So is there anyway to fix the second loop so that it only shows the search results for that post type? Any help would be greatly appreciated. Thanks. Reply


title: Neither the_excerpt() nor the_content() works properly?

text: I'm wondering what should be used in index.php (post listing page): `the_excerpt()` or `the_content()`?   1. Twenty Thirteen uses `the_content()` but this prints entire content unless `<!--more-->` exists and it completely ignores Excerpt field from [Posts > Add New > Excerpt].   2. So, I used `the_excerpt()` instead but this doesn't react to `<!--more-->` tag at all and it just grabs first 55 words or uses manual Excerpt and doesn't produce "Read more..." link. What I would like to achieve is this:   * print 55 words   * but react to `<\--more-->`   * and if manual excerpt is specified, use this instead (most people don't want the beginning of their post to be their excerpt so this is of crucial importance)   * produce optional "Read more..." link This looks like the most intuitive to me for post listing pages. Does something like this exist? If not, should `the_content()` be used on post listing pages? I think that most theme users aren't familiar with `<\--more-->` tag and they rather expect that themes will create proper excerpts for post listing pages rather than displaying full post content. Reference:   * http://codex.wordpress.org/Function_Reference/the_excerpt   * http://codex.wordpress.org/Excerpt   * http://www.rarst.net/script/wordpress-excerpt-teaser/


title: How to remove 'Site' in the comment form?

text: I' would like to remove the "site"-inputfield in the comment form in Wordpress twenty eleven. Someone who knows the answer? Thanks in advance.


title: How to output all taxonomy links from a custom post type in a menu?

text: I made a custom post type called Product. And a taxonomy with the name 'product-category'. These taxonomies have pages where we show a list of the products that have that taxonomy. Now my question is how to get all the taxonomies as a menu in the header. Its an awful lot of work to add it manually in the menu editor. Also because i need sub-menu's and sub sub menu's. How do I do this?


title: 294 Queries on Mainpage of Wordpress

text:
I have 294 queries on my wordpress site. I checked using sql monitorand the maximum queries are to display count of a cities list custom field. Lets say there are 200 cities then 200 queries are happening in a loop to count the number of posts about a city. Is a there a way to do this more efficiently. The code I have used to get counts of countries is               <?php      global $wpdb;     $countries = tgt_get_countries();     foreach ($countries as $country) {     $testcount = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->postmeta WHERE meta_value = '$country' AND meta_key = 'tgt_job_country'");     if ($testcount !=0)     echo "
".$country."(".$testcount.")
";     }     ?>


title: How to count get_users query?

text: I have been searching high and low for a way to count the amount of results from a get_users query. Most of what I found is to count the total number of posts in a post query, but nothing for counting the total number of users in the get_users query. Can someone point it out for me? Thanks a lot.


title: Warning: Creating default object... when altering Customize panels

text: I'm trying to move my theme's [only] widget area outside of WP 4.0's nested "Widgets" panel by doing the following:               $footer_widgets_section = $wp_customize->get_section( 'sidebar-widgets-footer_widgets' );     $footer_widgets_section->panel = '';      The key is to reset the panel to empty, rather than `widgets`. However, I'm getting a PHP warning: **`Warning: Creating default object from empty value in ...`** (the second line of my above code). Does anyone know how I can fix this?


title: How to remove class attributes from custom menu markup?

text:
Just playing around with adding "custom menu" support to my theme. I'm super excited about it. HOWEVER, Check this out >

           Home

      Worst case of "class-itus" I think I've ever seen. Is this something "I" did unintentionally or is this the default? How can I control or remove the class attribs on these menus?


title: Issue on Working with Metabox - Checkbox to enable Sale Items

text:
Using WP 3.8.1, I have a `Custom Post Type` which is called " **Sport** " and it has a Metdabox - medata data as ![enter image description here](http://i.stack.imgur.com/5u9Uh.png) I do not need to set up online shopping but I world like to add Price of my products to any Sport CPT and enable updating the Price in the WP table by Checking the Sale on checkbox and specifying sale amount or presentage. so the out put looks like ![enter image description here](http://i.stack.imgur.com/Zufj9.png) I know some part of job can be done by JavaScript(Like adding Sale class to Price or adding sale icon to box) on checkbox but on WP side I also need to update the table to take new price also be able to list all on sale Items for each CPT. Can you please let me know how to do this? and this is the code:               <?php     /* Custom Meta Boxex */     add_action('add_meta_boxes', 'cpt_metadata_add');     add_action('save_post', 'save_options');     function cpt_metadata_add()     {         add_meta_box(             "prodInfo-meta",             "New Dress Shoe Attributes ",             "render_meta_elemnts",             "sport",             "normal",             "low"         );     }     function render_meta_elemnts()     {         global $post;         $values  = get_post_custom( $post->ID );         $price   = isset( $values['metadata_price'] ) ? esc_attr( $values['metadata_price'][0] ) : '';         $sale    = isset( $values['metadata_sale'] ) ? esc_attr( $values['metadata_sale'][0] ) : '';         $saleamount  = isset( $values['metadata_sale_amount'] ) ? esc_attr( $values['metadata_sale_amount'][0] ) : '';         $salepercentage = isset( $values['metadata_sale_percentage'] ) ? esc_attr( $values['metadata_sale_percentage'][0] ) : '';         wp_nonce_field( 'my_meta_box_nonce', 'meta_box_nonce' );          ?>

       <?php echo 'Price : $'; ?>	       <?php echo '<input name="metadata_price" value="'. $price . '" id="metadata_price" />'; ?>	       	       <?php echo 'Sale On : <input type="checkbox" name="metadata_sale" id="metadata_sale" <?php checked( $sale, 'on' ); ?> />'; ?>	       <?php echo 'Sale Percentage : %'; ?>	       <?php echo '<input name="metadata_sale_percentage" value="'. $salepercentage . '" id="metadata_sale_percentage" />'; ?>	       	       <?php echo 'Sale Amount : $'; ?>	       <?php echo '<input name="metadata_sale_amount" value="'. $saleamount . '" id="metadata_sale_amount" />'; ?>

     <?php     }     function save_options()     {         global $post;     if (!isset($_POST['source']) || $post->post_type != 'sport'){          return $post;         }           update_post_meta($post->ID, "price", $_POST['price']);         }      Update:               <?php     $args = array( 'post_type' => 'sport');     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();     $meta = get_post_custom($post->ID);         the_title();         echo $meta['price'][0];          endwhile;     ?>      **Update 2**               <?php     $args = array( 'post_type' => 'sport');     $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();     $meta = get_post_custom($post->ID);          if(metadata_sale = checked) {             echo $meta['metadata_price'][0] - $meta['metadata_sale_percentage'][0];         }         else{            echo $meta['metadata_price'][0];         }     endwhile;     ?>