title: Trying to query all posts in category 4

text:
I have the following template page. I am attempting to output all of the articles from the category 4. However I am only getting some of the posts, about 20% of them. Not sure what would be causing this. Also is there a way to use the category name in the query_posts instead of the category number?               <?php     /*     Template Name: Blog     */     ?>          <?php get_header(); ?>

                             <?php query_posts('cat=4'); ?>                                       <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                                  <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
<?php the_title(); ?>

<?php                         printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by %3$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F jS, Y', 'bonestheme')), bones_get_the_author_posts_link());                       ?>

                                     <?php the_content(); ?>

<?php the_tags('' . __('Tags:', 'bonestheme') . ' ', ', ', ''); ?>
                                                                             <?php comments_template(); ?>
                                   <?php endwhile; ?>                                    <?php else : ?>

<?php _e("Oops, Post Not Found!", "bonestheme"); ?>

<?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?>

<?php _e("This is the error message in the page-custom.php template.", "bonestheme"); ?>

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

           <?php get_footer(); ?>


title: Troubleshooting white screen when editing specific posts

text: I've run into a bit of a perplexing challenge. I'm working on a WordPress installation where certain posts, without a yet apparent rhyme or reason, throw a white screen when you attempt to edit them in the admin area. Its a large site with _lots_ of plugins. I've tried disabling all plugins to see if that made a difference. None. I've been comparing the good posts to broken posts in the database, comparing wp_postmeta and wp_posts entries to see if I can spot any obvious difference. There are differences, but I don't see a consistent pattern and I'm not even sure that it would matter. Any ideas on how you would troubleshoot this next?


title: Get_Posts and multiple categories

text: I have created a custom query in hopes of showing the top posts from some child categories. It appears here: http://www.sitesofconscience.org/activities/whats-new The query has a big flaw: some posts belong to two categories; but, even if they get marked in BOTH categories, they only appear in one. For example, a post marked in both "Navigating Difference" and "Learning Exchanges" will only appear in "Navigating Difference". I also wonder if there's an easier way to do this: can I just query for all child categories of a certain category? The query is:   `<?php $posts = get_posts('numberposts=3&offset=0&showposts=3&cat=21,22,23,26,31,32,349'); foreach ($posts as $post) : start_wp(); ?> <?php static $count1 = 0; if ($count1 == "3") { break; } else { ?>` Thank you! Jeff


title: How do I use CPT and permalinks with a mobile theme?

text: We have a live site that is using one theme. Then I've got Wordpress Mobile Pack installed to enable a mobile theme which has different functionality and look. The problem I'm running into is that the live site uses a CPT for a "specials" page. This obviously has to be updated in the permalink structure in order for the url to work correctly. SO, when the mobile pack switches the theme for the mobile version, the permalink structure is killed and the CPT archive and single pages will not work. It doesn't mess up the main site, and the mobile version works perfectly, except that the CPT will not display. And yes I have copied all the code into functions.php as required to handle the CPT. Questions to be answered:   1. First off, am I correct in assuming this is the actual problem or am I missing something here?   2. Is there a way I can force the mobile theme to create that permalink structure when it recognizes that a new theme has been activated?   3. If 1 and 2 are not possible, what is another option for me to still use the CPT. This is highly important to the site as it carries the "specials" they want to allow people to pull up on their phones.  I've already thought that I may have to setup a separate install of wordpress for the mobile site and do browser detection/redirect. I would hope this is not the only option for many reasons but mostly because I don't want them to have to manage two admins. Any help thoroughly appreciated!


title: How to reorder and display a feed to be chronological?

text: I have a feed from an events calendar that once put in the WordPress RSS widget displays the feed items in reverse chronological order. So the events that are farthest in the future display first, and the events that are coming up soon are displaying last. We are only displaying the title from the feed (the event name) and the pubdate from the feed (which is the date of the event). Does anyone know of a way using SimplePie, a plugin or editing the default RSS widget's output (without modifying core) to output chronologically so that the oldest post (in this case event) displays first and newer posts display at the end of the list? I've already tried changing the feed itself so the order is chronological, but the RSS widget continues to sort it by the pubdate. Unfortunately, using a calendar plugin or custom post type is not ideal because we need to be able to update this feed in one place and display the events across many different sites.


title: Newer/older posts links don't show up

text:
I am working in a twentyten childtheme and the the newer/older links don't show up on my index page, under the listing of ten blog posts. What bothers me is that even when I add a `<!--comment-->` to the loop.php or index.php or archive.php files they don't show up on the source code of the live page. So I cannot even troubleshoot the issue. What am missing, why don't my edits of the files don't show up? BTW: the loop.php has the relevant code at the end but doesn't do anything.               <?php if (  $wp_query->max_num_pages > 1 ) : ?>

<?php next_posts_link( __( '← Older posts', 'twentyten' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'twentyten' ) ); ?>

     <?php endif; ?>


title: How to properly create a child theme

text: I would like to create a child theme based on the twentyeleven theme. I understand how to create my own styles.css file to work for my child theme. I would also like to create my own custom               header.php     index.php     footer.php     functions.php      files. My question is what information do I need to have placed in the header of each file. Currently the copied index.php file has:               /**      * The main template file.      *      * @package WordPress      * @subpackage Twenty_Eleven      */      Since this is my index.php file for my child theme what do I need to change?


title: How do I deque the default stylesheet?

text:
In order to create a static page template that does not use the site's default stylesheet, I created: page-custom.php header-custom.php footer-custom.php static.css For the most part the page is working as intended: it brings in the correct post, but some of the styling from the default style.css is still influencing the content display. Here is how I have coded it. For the customer header:               <!DOCTYPE html>     <html <?php language_attributes(); ?>>                   <meta charset="<?php bloginfo('charset'); ?>" />         <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">              <link rel="stylesheet" href="<?php bloginfo('template_url'); ?>/css/static.css">              <link rel="pingback" href="<?php bloginfo('pingback_url'); ?>">              <?php wp_head(); ?>           For the page-static.php. Note, here I have included the line to dequeue the default stylesheet:               <?php     /*             Template Name: Static Page     */     ?>     <?php wp_dequeue_style( 'style' ); ?>     <?php get_header('custom'); ?>          <?php get_header(); the_post(); ?>

<?php the_title(); ?>

                 <?php the_content(); ?>

          <?php get_footer('custom'); ?>      And for the footer:                            I am not sure what I am missing here and would appreciate some more experienced eyes to review and let me know how I can resolve this. Thanks.


title: get_terms of post->id

text:
I need a way to use get_terms and have it only grab the taxonomies of the current page. Example http://sitename.com/genre/hip_hop would only grab the taxonomies that also have the hip hop genre attached. wp_get_object_terms almost works for me but wont loop the way get_terms does. Here is what I have right now               <?php if (have_posts()) : ?>     <?php while (have_posts()) : the_post();     $cam_brands = get_the_terms( $post->ID, 'sub_genre' );?>     <?php foreach( $cam_brands as $brand ) : ?>
 <?php echo $brand->name; ?>
          <?php $wpq = array( 'post_type' => 'track', 'taxonomy' => 'sub_genre', 'term' => $brand->slug, 'post_status' => 'publish','posts_per_page' => -1, 'caller_get_posts'=> 1 );     $brand_posts = new WP_Query ($wpq);?>
     <?php foreach( $brand_posts->posts as $post ) : ?>
 <?php echo $post->post_title; ?> <a class="sc-player" href="<?php echo get('soundcloud_link'); ?>">track
     <?php endforeach ?>
     <?php endforeach ?>     <?php endwhile; ?>     <?php endif; ?>


title: How can I enable a TINYMCE rich text editor in the admin interface?

text: I'd like to add some text above my category archives, and I'd like to use the built-in Wordpress TinyMCE editor to do it. I've seen some plugins like `black-studio-tinymce-widget` which does a nice job of adding rich text to a widget, but I'd like to set up TinyMce to be used in the description area of the Edit Category page. Is there a plugin to do this or how would I set up Wordpress to allow this? ![screenshot-with- shadow.png](http://img140.imageshack.us/img140/4526/screenshotwithshadow.png)


title: Correct way of getting the current page uri

text: Can someone please tell me how to get the correct url of the page the user is on? I need to grab the url and construct a new link. Here is the issue that I am having. For example, let's say I am on http://localhost/myplugin/samplepage/?some_var=1&some_var=2               home_url() is http://localhost/myplugin     $_SERVER['REQUEST_URI] is /myplugin/samplepage/?some_var=1&some_var=2      As you can see, if I do this               $url = home_url() . $_SERVER['REQUEST_URI];      The outcome will be               http://localhost/myplugin/myplugin/samplepage/?some_var=1&some_var=2      Notice the 'myplugin' in the url twice, which doesn't work.


title: "Master" Wordpress Multisite - Database Sync

text: I've had an idea in my head about creating a Wordpress Multisite environment that would have Plugins along with them that would not only have "default" settings, but be able to update each blog's plugin options based on a "master" site. That way, instead of having to change settings through every site - you'd be able to just change it in one spot. Now I've seen http://snippets.davejamesmiller.com/code/php/wordpress/automatically-enable- plugins-in-new-wordpress-multisite-blogs which can handle activating and setting specific plugin settings - but this wouldn't take care of any ongoing sync between the websites. There'd be times when certain settings shouldn't be brought over/synced, for things like an API key for Akismet for example. Any suggestions would be greatly appreciated. Thanks!


title: Insert the current theme header into an external HTML/XHTML file

text: My Emacs org-mode projects get exported to XHTML files. I would like to loosely integrate them into my blog. In particular, I'd like to use the header (and possibly footer) from my theme in the XHTML file. Would it be possible to put something like `<?php include("../blog-wp- content/themes/my-theme/header.php");?>` (this obviously doesn't work) in my XHTML file to import the header from Wordpress? Are there other approaches to splicing the header with my file?


title: Set Wordpress TinyMCE Editor To Readonly

text: I am trying to disable the tinyMCEeditor in wordpress so it is `readonly` if the post has already been published. I already have the logic for determining if the post is published (by using `$post` object's `post_status` variable)but I have not found a solution for setting the `readonly` parameter in tinyMCE to `true`. Cross-Post from StackOverflow


title: Custom loop to query posts with no featured image and/or no post editor content

text: I am looking to query and pull a list of all custom posts 'foo' that have no featured image set and/or have no text copy (from the WP editor). The list will be used to determine which posts need content and/or a featured image. (We're importing a huge database from an outside source). I'm starting with this-               $result = new WP_Query( array( 'posts_per_page' => -1, 'meta_key' => '_thumbnail_id', 'post_type' => 'foo' ) );      How would I change this to 1) _exclude_ any post with a featured images set [I realize as it is now it includes them] and 2) also exclude any post that has content in the post editor?


title: wp_remote_get() never fires

text: I am quite familiar with the `wp_remote_get()` function. However, this one is blowing my mind. Here is my code to call the url:               // data to send in our API request             $api_params = array(                  'edd_action'        => 'activate_license',               // Action -> Activate License                 'license'           => urlencode($license),              // License submitted by user                 'email'             => urlencode($email),                // Email submitted by user                 'transid'           => urlencode($transid),              // Transaction ID submitted by user                 'user_ip'           => urlencode($user_ip),              // IP submitted by hidden field                 'user_email'        => urlencode($user_email),           // Admin - Email                 'user_firstname'    => urlencode($user_firstname),       // Admin - First name                 'user_lastname'     => urlencode($user_lastname),        // Admin - Last name                 'user_url'          => urlencode($user_url),             // Admin - URL                 'user_admin_email'  => urlencode($user_admin_email),     // Admin - Email                 'timeout'           => 10                               // Set timeout to ensure all data passes successfully                 //'item_name' => urlencode( 'ultimate-tinymce-pro' )             );                  // Call the custom API.             $response = wp_remote_get( add_query_arg( $api_params, 'http://EXAMPLE.com/plugin_activate_membership.php' ) );             // make sure the response came back okay             if ( is_wp_error( $response ) )                 return false;                  // decode the license data             $license_data = json_decode( wp_remote_retrieve_body( $response ) );      The `$api_params` variables are all defined before this snippet. I then process the `$license_data` from the returned code; after this snippet. This all works 99% of the time; across multiple servers. However, I have just encountered a site where the `wp_remote_get()` never fires. The code stops at `if (is_wp_error ($response)) return false;`. I can verify it is failing by sending an email to myself, within the error function. However, I cannot get any info returned. In Firebug, the function never fires. It never even attempts the get request. In all other sites, I can see in Firebug where the request is made.. and the response is given. In this particular site... Firebug shows nothing. Any ideas would be greatly appreciated. EDIT: I was able to receive an error by emailing myself during the check (it's performed on the `admin_init` hook). Here is the code I had to use to get the error:               if ( is_wp_error( $response ) ) {         $to      = 'example@example.com';         $subject = 'the subject';         $message = $response->get_error_message();         $headers = 'From: webmaster@example.com' . "\r\n" .         'Reply-To: webmaster@example.com' . "\r\n" .         'X-Mailer: PHP/' . phpversion();              mail($to, $subject, $message, $headers);              return $response;     }      The result in my email:               couldn't connect to host      I'm now leaning towards a server setting. Perhaps blocking outgoing TCP connections??


title: Add custom Attachment Display Setting for images

text: I've been doing a lot of research and I've yet to work this out. Can you add in a custom option in the `Attachment Display Settings` (part of `Insert Media` dialog in post editor)? What I'm after is the ability to add an anchor with a class around all images in posts.


title: Adding Alt Tag Column to Media Library List

text: I'd like to add a column in the Media Library that shows that alt tag that way I can quickly add alt tags for all images that don't have one. How could I go about this?


title: Exporting by table

text: I am using PHPmyAdmin to move a site. My site is too large to use the single file export/import method. (I know how to do it, it works fine on smaller sites.) It seems the only thing working for me is to export, and then import, a table at a time. 30 tables. This is ok for a one time move, but this method for ongoing backups is pretty crazy. Anyone know how to **export all tables, but in separate files?** i.e. instead of the one big dbxxxx.sql, I want each table e.g. wp_posts.sql to export one after the next.


title: Pre_get_posts query conditional

text: I try in "pre_get_posts" filter to alter the query so i can retrieve all posts that have been published by an author **AND** all posts with a certain meta value no matter the author.Is that possible or i have to write a custom query?   And if i have to write a custom query how can i return it from pre_get_posts? The following will not work as it will return posts by an author that have a meta value.               $args = array(            'author' => 'author_id'             'post_type' => 'custom_post_type'             ,'post_status' => 'publish'             ,'posts_per_page' => -1              ,'meta_query' => array(                   array(                         'key' => 'some_key',                          'value' => $value_array,                          'compare' => 'IN',                        )                    )                 );                 $query->query_vars = $args;


title: Extra Editing Box in WP Dashboard

text: So I am trying to add an extra box in the WP post dashboard. In this box I will add a piece of HTML code. This code created the box in the WordPress area:               $woo_metaboxes[] = array (  "name" => "brand",                                 "label" => __( 'Brand', 'woothemes' ),                                 "type" => "textarea",                                 "desc" => __( 'Enter brand code now.', 'woothemes' ) );      Now, I have to pass a function in the the functions.php file, which I did like this:               if ( ! function_exists( 'canvas_get_brand' ) ) {      function canvas_get_brand() {          ….     …          <div class="post-brand">     <?php echo $brand; ?>     </div><!-- /.post-brand -->     <?php     }     } // End canvas_get_brand()      I tried my best, but I am not able to find a way out to add the right code to get this "dynamic content" box to work. What should I do next? How do I add/pass an argument? I am using canvas theme, which has a pretty nice hooks feature. Any help is highly appreciated.


title: Inserting data into `post meta` table?

text: How would I be able to insert data into the post meta table? I know how querying and wpdb works but I have no idea how I can just insert it into the table. I have these two fields I want to insert ID and Title where Title should become a new post in my Custom Post type Company and ID should be the Content of it. I unfortunately have no idea how to do this. EDIT: I'm not sure if it HAS to be the post meta table but as long as a new Custom post type post appears. Thanks in advance!


title: register_post_type "You are not allowed to edit this post."

text: I am creating my own post type, here are my capabilities:               'capabilities' => array(           'publish_posts'      => 'publish_review'     )      Basically, if I use this - no body can publish or send for review, not even an admin. I have a custom user capability called **"publish_review"** which I set up using the plugin User Role Editor. If I add:               'edit_post'         => 'edit_review',      To the capabilities and give an Admin access to the publish_review and edit_review capability they can Publish posts providing they have access to edit_review. If I give an Author access to edit_review only, they can submit things for Review but cnanot publish them. They can ALSO edit anybody elses posts of this type. What am I doing wrong? I basically want to limit so that only Admin and Editors can publish this post type, and Authors and Contributors have to Send it for Review.


title: Limit the number of plugins that a blogowner on a multisite can see (as can be done with the themes)

text: In a Wordpress multisite setup it is possible to enable some or even all themes for a specific site. Enabling all themes for a site might be overwhelming to a blogowner, especially when you have dozens of themes installed in your network. So I usually enable one or two themes and enable others by request. ![enter image description here](http://i.stack.imgur.com/lBbDM.png) When it comes to plugins this cannot be done. You install a plugin, choose either network activation or activate on bloglevel. The blogowner can see all the plugins that are available. And like most of us, I've got a load of plugins on my network. I would like to have him see only a few, not all plugins. Is there a way, somehow similar to themes, to restrict or limit the number of plugins that the blogowner can see? I've tried the Multisite Plugin Manager, but that didn't work for me. In what direction should I look to solve or achieve this?


title: JQuery problem display

text: Hy i have a small problem with NivonoSlider. This is my site - http://bit.ly/1iRSwcf When i check on a checkbox it display the archive base a custom field, in my example by color. The problem is: i get a white screen in slider.. the images is not loading. This only ocurs when i click on checkbox. The script is taken from this link - http://www.advancedcustomfields.com/resources/tutorials/creating-wp-archive- custom-field-filter/ i'm stuck.. How can i solve this problem? I want to filter the archive by custom field... can be done otherwise? This is wath i have. For the custom field i use in function.php               add_action('pre_get_posts', 'my_pre_get_posts');     function my_pre_get_posts( $query )     {         // validate         if( is_admin() )         {             return;         }         // get original meta query         $meta_query = $query->get('meta_query');             // allow the url to alter the query             // eg: http://www.website.com/events?location=melbourne             // eg: http://www.website.com/events?location=sydney             if(!empty($_GET['culoare']) )             {                       $culoare = explode(',', $_GET['culoare']);                    //Add our meta query to the original meta queries                 $meta_query[] = array(                     'key'       => 'culoare',                     'value'     => $culoare,                     'compare'   => 'IN',                 );             }         // update the meta query args         $query->set('meta_query', $meta_query);         // always return         return;     }      In my theme i use this code to retrive the checkbox.               <div id="search-culoare">     <?php      $field = get_field_object('culoare');     $values = explode(',', $_GET['culoare']);     ?>        <ul>             <?php foreach( $field['choices'] as $choice_value => $choice_label ): ?>             <li>             <input type="checkbox" value="<?php echo $choice_value; ?>"              <?php if( in_array($choice_value, $values) ): ?> checked="checked"<?php endif; ?> />             <?php echo $choice_label; ?>             </li>     <?php endforeach; ?>        </ul>     </div>          <script type="text/javascript">     (function($) {       $('#search-culoare').on('change', 'input[type="checkbox"]', function(){             // vars             var $ul = $(this).closest('ul'),                 vals = [];             $ul.find('input:checked').each(function(){                 vals.push( $(this).val() );             });             vals = vals.join(",");             window.location.replace('<?php echo home_url('produse'); ?>/?culoare=' + vals);             console.log( vals );         });     })(jQuery);      </script>


title: Multiple authors for single post without plugin

text: I'm new to using WordPress and so, apologies in advance if this seems like a very basic question. I want to have multiple authors for single post. I had seen Co-Author. But I don't have to use plugin at all.


title: Auto Linking Words But Only One Time

text: I highly need a piece of code which will replace a simple word with a hypertext link, using str_replace method. And fortunately I found this code below, but the problem is that it repeats the link with all matching keywords, whereas I want to add the link only once and forget other matching keywords. For example, if it sees "nursery rhymes", replace it with a hypertext link, but do not add the link again with "nursery rhymes", "rhymes" or "poems" keywords on same page. One URL only one time. I also heard that it's probably not possible with str_replace, but possible with preg_replace, which could limit the occurrence of replacements. Please help. I am not very familiar with PHP or coding, so please use complete code, so I can simply copy and paste in my functions.php. Here is the code I am using:               function wp_affiliate_links($text) {         $replace = array(             ' nursery rhymes ' => ' nursery rhymes ',             ' poems ' => ' poems ',             ' rhymes ' => ' rhymes ',         );         $text = str_replace(array_keys($replace), $replace, $text);         return $text;     }     add_filter('the_content', 'wp_affiliate_links');     add_filter('the_excerpt', 'wp_affiliate_links');


title: Show custom field from custom taxanomy term on custom post type

text:
I need to show a list of custom taxanomy terms assigned to the current post type with a name and a custom field. (Created with Advanced Custom Fields) Currently I use the following code, to show a list of the custom taxanomy terms assigned to the current post:               echo '
';     echo get_the_term_list( $post->ID, 'taxanomy-name', '
', ',

', '
' );     echo '
';      Allthough I want to show a custom field from each taxanomy term along with the name. The code for showing the custom field on each taxanomy term page template is:               the_field('custom-field-name', 'taxanomy-name_ID');      My question is, how do i show the custom field, along with the custom taxanomy term name on the list? Example:

       Taxanomy Term Name 1

       Taxanomy Term Name 2

      I hope you can help me.. It's been bugging me for hours. Thanks!


title: What's the URL to my blogs (from my home page - which is a "page")

text: How do I add a link under my home page banner to my blog summary page. My default page is a "page", not a "post". http://nealwalters.com on 3.0.4


title: How to correctly display category's slug as a class?

text:
I want to display category's slug as a class. I try to code and put this into functions.php               add_filter('the_category', 'my_custom_get_the_category_list');          function my_custom__get_the_category_list($thelist, $post_id = false ) {         global $wp_rewrite;         $categories = get_the_category( $post_id );              foreach ( $categories as $category ) {             $thelist = str_replace('rel="', 'class="category-'.$category->category_nicename.'" rel="', $thelist);         }         return $thelist;     }      But there is something wrong. I use `get_the_category_list()` in category.php Then every category displays the same class.

Editorial

Business

National

      Where did I do wrong?


title: How to set multiple `orderby` in query argument?

text: I am trying to fetch pages by multiple ordering. `menu_order` in descending and `title` in ascending. Following is the argument:               $args = array(      'post_type' => 'page',      'posts_per_page' => 20,      'orderby' => array( 'menu_order' => 'DESC', 'title' => 'ASC' ),      );      But it is not ordering as I expecting and gives following warning. `Warning: urldecode() expects parameter 1 to be string, array given in /var/www/html/staging.dev/public_html/wp-includes/query.php on line 2634` I found a ticket in trac regarding multiple `orderby`. I studied the discussion and followed as in the discussion but could not solve the issue. Ticket Link


title: WP 3.1 & Sorting Admin Post List

text: I am stuck on two issues in trying to get my custom post type for events to function correctly in the admin area. 1st) I have upgraded to wordpress 3.1 after which the code (below) which was working fine on wordpress 3.0 no longer shows any results and I can't figure out what might have messed this up. Essentially, in the code below I had the admin area sorting all posts by the event data/time.               // SET A CUSTOM SORT ORDER FOR EVENTS        function set_event_list_admin_order($wp_query) {         if (is_admin()) {               // GET THE POST TYPE FROM THE QUERY             $todaysDate = time();             $post_type = $wp_query->query['post_type'];               if ( $post_type == 'events') {                 // 'meta_key' VALUE CAN BE ANY CUSTOM FIELD                   $wp_query->set('meta_key', '_mbcombined_datetime');                 // 'meta_compare' VALUE CAN BE ANY POST STATUS                   $wp_query->set('meta_compare', '>=');                 // 'meta_value' VALUE CAN BE ANY POST STATUS                   $wp_query->set('meta_value', '$todaysDate');                 // 'orderby' VALUE CAN BE ANY COLUMN NAME                   $wp_query->set('orderby', 'meta_value');                 // 'order' VALUE CAN BE ASC or DESC                   $wp_query->set('order', 'ASC');                 // 'post_status' VALUE CAN BE ANY POST STATUS                   $wp_query->set('post_status', 'publish,pending,draft,future,private');             }         }        }        add_filter('pre_get_posts', 'set_event_list_admin_order');        2nd) I have not been able to figure out what code I would need to add so that a checkbox is added above the list (by the filter by area) which let's a user check/uncheck "past events". Essentially, all I would like to do here is extend the code I have above so that by default it does not show any events where the date is older than tomorrows date. However, I do need to provide the checkbox option to "include past events" which should auto-reload the list. Any thoughts on this?


title: What flash slideshow player can read an rss feed as a source?

text: i would like to add a flash slideshow to my wordpress site, but do not want to manually add the pictures. I currently use nextgen to manage my galleries. I have a page set up that shows the most recent pictures, and there is an rss feed available for this. (http://rapscallion.eu/category/gallery/) What flash slideshow can use this rss feed as input? It would be beneficial if it had a wordpress plugin and some documentation?


title: How to add CSS style sheet dynamically in wordpress

text: When certain conditions are met (e.g. post vs. page or a category is tagged, etc) I would like to load an additional CSS file. This file would, in theory, change link colors. Or perhaps change the background color. Cosmetic changes. My thinking was to add code to functions.php, however, I don't think this is actually adding the CSS page. Even (even though right now there is no conditional, it should always just add this new page). Help?                /*       * register with hook 'wp_print_styles'       */       add_action('wp_print_styles', 'add_my_stylesheet');          /*      * Enqueue style-file, if it exists.      */          function add_my_stylesheet() {         $myStyleUrl = WP_THEME_URL . '/newStyle.css';         $myStyleFile = WP_THEME_URL . '/newStyle.css';         if ( file_exists($myStyleFile) ) {             wp_register_style('myStyleSheets', $myStyleUrl);             wp_enqueue_style( 'myStyleSheets');         }          }      Thank you


title: How to remove tag cloud from taxonomy admin edit page?

text: On the page where one adds/removes/modifies taxonomies, what would I need to add to my functions.php file to remove the tag cloud?


title: How can I show custom field according to taxonomy?

text: How I can show custom fields in my theme according to category? For example in Laptop category show some custom fields and in Motherboard category show another fields.


title: handling templates and widgets for custom content types

text: I have created a custom content type (and taxonomy) for my theme that will mostly replace the default post type. I know as for singles, i can create a template single-customtype.php to handle this but what about for everything else? what about http://mywebsite.com/posttype (is my only option forcing my theme user to create a page and select a template?) what about search, 404, archive and widgets? Would i have to customize them all. I can tell i am missing something huge here but i cant put my finger on it


title: Error: call_user_func_array() expects parameter 1 to be a valid callback

text: I have issue after upgrading my wordpress to 3.6 see below for errors which displays on wordpress admin panel not on front of website. Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘regis_options’ not found or invalid function name in wp- includes/plugin.php on line 406 Warning: Cannot modify header information – headers already sent by (output started at wp-includes/plugin.php:406) in wp-includes/option.php on line 571 Warning: Cannot modify header information – headers already sent by (output started at wp-includes/plugin.php:406) in wp-includes/option.php on line 572


title: Post Formats in the context of the Database 'Save Post' function

text: I am trying to pick up an in-depth understanding of how post-formats relate to posts 'in the database' - i.e. what meta information when compiled together constitutes a post format. And yes, I do mean a post format (NOT a post type). All of the documentation I can find assumes a starting point where post_format is selected from the meta box on the 'New Post' page. I'm working with a plugin (wootumblog) which uses a custom 'save_post' function, so need to understand more about how this actually works. I see several tables involved including *wp_terms* (where the post_format slug is referenced against term_id) and *wp_term_relationships* (where the term_id is referenced against the post_id or object_id as the column is named) but I'm unclear as to whether wp_postmeta needs to be updated or are these two 'terms' tables sufficient for wordpress to work with? I basically have a problem integrating the wootumblog and wpmu sitewide tags plugins together, and suspect this may be caused by the different protocols they use to save a post. This seems a pretty barren area for documentation, so if someone speaks the post format lingo, it would be really useful to outline how it all works at a 'data' level.


title: Anything I can add to functions.php to make text widgets accept PHP?

text: Is there a way I can make text widgets accept PHP? Perhaps something I can add in to functions.php? I'm redesigning my site, and I was wondering why I didn't use widgets at all in my current design, but then I realized it was because I use a lot of PHP in there. For example, one of the "widgets" is a tabbed content area, so I've got the HTML and JavaScript shell for the tabs, but then inside the tabs, I've got PHP calls for the most popular posts, the most recent posts, and the most recent comments. I can't do that with existing widgets. Obviously I could use a plugin, but I'm trying to go light on plugins where possible. Is there something I can just add to functions.php?


title: Display Search Result Count

text: Until now I have been using below code to get the number of results when someone searches and to display that count.               <?php /* Search Count */ $allsearch =& new WP_Query("s=$s&showposts=-1"); $count = $allsearch->post_count; echo $count . ' '; wp_reset_query(); ?>      But this does not seem like valid code. It shows below error: Deprecated: Assigning the return value of new by reference is deprecated Can anyone please suggest the proper way in which I get get the search count. The above code is placed in the heading of my index.php file of theme within a conditional statement to display different heading based on what type of page a user is on.


title: Run W3 Total Cache Flush Function with Crontab

text: Ok. I'm really stumped on this one. Basically, I need to call a function for the Wordpress plugin W3 Total Cache as part of a cron job in crontab. I'd like to automatically clear the entire page cache nightly. Here's the code that works fine within wordpress that I need to call:               if (function_exists('w3tc_pgcache_flush')) {     w3tc_pgcache_flush();     }       I'm currently using the following script:               #!/usr/bin/php          <?php          define('DOING_AJAX', true);     define('WP_USE_THEMES', false);     $_SERVER = array(         "HTTP_HOST" => "http://example.com",         "SERVER_NAME" => "http://example.com",         "REQUEST_URI" => "/",         "REQUEST_METHOD" => "GET"     );     require_once('/path-to-file/wp-load.php');          wp_mail('email@example.com', 'Automatic email', 'Hello, this is an automatically scheduled email from WordPress.');          if (function_exists('w3tc_pgcache_flush')) {     w3tc_pgcache_flush();     }           ?>      and the command line:               php -q /path-to-file/flushtest.php      I used the wp_mail function to test and make sure I'm getting something. The script is working fine except that the page cache is never flushed. I get the email and there aren't any errors in the log either. Any ideas? Thanks for your help.


title: How do I change discussion settings for all blogs in multisite?

text: I have a multisite with subdirectories. I want to change the discussion setting so that all comments will be automatically approved. If there will be need for moderation they will be deleted later. Is there a way to set this option globally and not per blog ?


title: Download all Wordpress.com available themes, somewhere?

text: I am looking for a website, or a way to find and download all Wordpress.com available themes for my WPMU website. I have searched for some on http://wordpress.org/extend/themes/ but they don't seem to be there. So do you know any repo or list with those themes listed and links to download them?


title: Get the post attached to a image attachment

text: Assuming I know the image attachment ID, how can I get the post permalink to which is attached (if any) ?


title: Recommendations for an In-Depth WordPress Book?

text: > **Possible Duplicate:**   >  Definitive list of WordPress books I've been plugging away with WordPress for some years now. In that time, I've never really taken time to fully understand the platform. It powers my site, and that's been enough. But I feel I need to know more about the system to get the most use out of it. Please suggest any books that cover WP in some depth. I don't necessarily need WordPress 101, but I am particularly interested in making use of WP's extensibility, as well as building themes.


title: Count posts in custom taxonomy

text: Is there a way to count all published posts from a custom taxonomy? While looking around I found this snippet but I didn’t manage to get it to work …               global $wpdb;     $query = "             SELECT COUNT( DISTINCT cat_posts.ID ) AS post_count             FROM wp_term_taxonomy AS cat_term_taxonomy INNER JOIN wp_terms AS cat_terms ON             cat_term_taxonomy.term_id = cat_terms.term_id             INNER JOIN wp_term_relationships AS cat_term_relationships              ON cat_term_taxonomy.term_taxonomy_id = cat_term_relationships.term_taxonomy_id             INNER JOIN wp_posts AS cat_posts              ON cat_term_relationships.object_id = cat_posts.ID             WHERE cat_posts.post_status = 'publish'              AND cat_posts.post_type = 'post'              AND cat_term_taxonomy.taxonomy = 'YOUR-CUSTOM-TAXONOMY'              AND cat_terms.slug IN ('TERM-SLUG-1, TERM-SLUG-2')         ";     return $wpdb->get_var($query);


title: Saving widget options from class method

text: I have a widget class (derived from WP_Widget) that has a method (called via ajax) to update part of its options(the elements order) without the user to click "Save", to set the handler I do from the constructor:               add_action('wp_ajax_bgw_update_order', array(&$this, 'update_order'));      The `update_order` method does something similar to this question but it does not save the new options. My code:               public function update_order() {         if (!is_admin()) die('Not an admin');         if (!isset($_REQUEST['nonce']) ||             !wp_verify_nonce($_REQUEST['nonce'], 'section-order-nonce'))              die('Invalid Nonce');         $sections = $this->sections;         $new_order = $_POST['section'];         $new_sections = array();              foreach($new_order as $v) {             if (isset($sections[$v])) {                 $new_sections[$v] = $sections[$v];             }         }         $this->sections = $new_sections;         $settings = $this->get_settings();         $settings[$this->number]['sections_order'] = $new_sections;         $this->save_settings($settings);         print_r($this->get_settings());         die();     }      My `update` function does the usual stuff:               public function update( $new_instance, $old_instance ) {         $instance = array();         $instance['username'] = strip_tags($new_instance['username']);         $instance['count'] = strip_tags($new_instance['count']);         // [...]         return $instance;     }      When I log `$settings` from `update_order` it has the right value:               Array     (         [3] => Array             (                 [username] => username                 [count] => 0                 [title] => GitHub                 [skip_forks] => 1                 [show_octocat] => 1                 [sections_order] => Array                     (                         [1] => Activity                         [0] => Repositories                     )                  )          )      The `update` method doesn't get called and when I hit the "Save" button `$instance` (logged from the `form` method) doesn't have a `sections_order` key. I come to the conclusion that `save_settings` doesn't do what I think it does. How can I save the options from the `update_order` method? What I'm trying to achieve is to save `sections_order` without the user to click the "Save" button.


title: Links not opening as they should. Custom WP plugin

text:
I am working on review plugin for my wordpress blog, and I have small problems. First this is the Plugin code:               add_action( 'init', 'create_devicemondo_review' );          function create_devicemondo_review() {         register_post_type( 'review',             array(                 'labels' => array(                     'name' => 'DeviceMondo Reviews',                     'singular_name' => 'DeviceMondo Review',                     'add_new' => 'Add New',                     'add_new_item' => 'Add New Product Review',                     'edit' => 'Edit',                     'edit_item' => 'Edit Product Review',                     'new_item' => 'New Product Review',                     'view' => 'View',                     'view_item' => 'View Product Review',                     'search_items' => 'Search Product Reviews',                     'not_found' => 'No Product Reviews found',                     'not_found_in_trash' => 'No Product Reviews found in Trash',                     'parent' => 'Parent Product Review'                 ),                 'public' => true,                 'menu_position' => 15,                 'supports' => array( 'title', 'editor', 'comments', 'thumbnail', 'excerpt', 'custom-fields' ),                 'taxonomies' => array( '' ),                 'menu_icon' => plugins_url( 'images/image.png', __FILE__ ),                 'rewrite' => array( 'slug' => 'review', 'with_front' => false ),                 'has_archive' => true             )         );     }          //Creating Meta Box Fields for Custom Post Types     add_action( 'admin_init', 'my_admin' );          function my_admin() {         add_meta_box( 'product_review_meta_box',             'Product Review Details',             'display_product_review_meta_box',             'review', 'normal', 'high'         );     }               //Implementation of the display_product_review_meta_box Function     function display_product_review_meta_box( $review ) {         // Retrieve current product type and product rating based on review ID         $product_choice = esc_html( get_post_meta( $review->ID, 'product_choice', true ) );         $product_type = esc_html( get_post_meta( $review->ID, 'product_type', true ) );         $product_rating = intval( get_post_meta( $review->ID, 'product_rating', true ) );         ?>

                 Editor Choice	                 <input type="text" size="80" name="product_review_choice" value="<?php echo $product_choice; ?>" />

                 Product Type	                 <input type="text" size="80" name="product_review_type" value="<?php echo $product_type; ?>" />

                 Product Rating	                                      <select style="width: 100px" name="product_review_rating">                     <?php                     // Generate all items of drop-down list                     for ( $rating = 5; $rating >= 1; $rating -- ) {                     ?>                         <option value="<?php echo $rating; ?>" <?php echo selected( $rating, $product_rating ); ?>>                         <?php echo $rating; ?> stars <?php } ?>                     </select>

         <?php     }          //Registering a Save Post Function     add_action( 'save_post', 'add_product_review_fields', 10, 3 );               //Implementation of the add_product_review_fields Function     function add_product_review_fields( $product_review_id, $product_review ) {         // Check post type for product reviews         if ( $product_review->post_type == 'review' ) {             // Store data in post meta table if present in post data             if ( isset( $_POST['product_review_choice'] ) && $_POST['product_review_choice'] != '' ) {                 update_post_meta( $product_review_id, 'product_choice', $_POST['product_review_choice'] );             }             if ( isset( $_POST['product_review_type'] ) && $_POST['product_review_type'] != '' ) {                 update_post_meta( $product_review_id, 'product_type', $_POST['product_review_type'] );             }             if ( isset( $_POST['product_review_rating'] ) && $_POST['product_review_rating'] != '' ) {                 update_post_meta( $product_review_id, 'product_rating', $_POST['product_review_rating'] );             }         }     }               //Register a Function to Force the Dedicated Template     add_filter( 'template_include', 'include_template_function', 1 );               //Implementation of the function     function include_template_function( $template_path ) {         if ( get_post_type() == 'review' ) {             if ( is_single() ) {                 // checks if the file exists in the theme first,                 // otherwise serve the file from the plugin                 if ( $theme_file = locate_template( array ( 'single-review.php' ) ) ) {                     $template_path = $theme_file;                 } else {                     $template_path = plugin_dir_path( __FILE__ ) . '/single-review.php';                 }             }         }         return $template_path;     }      now the plugin works just fine and I have created a page with template single- review.php from my template folder. This page shows the list of all reviews I have published using this plugin. This is the code for that template:

              <?php         $mypost = array( 'post_type' => 'review', 'posts_per_page' => 1,);         $loop = new WP_Query( $mypost );         ?>         <?php while ( $loop->have_posts() ) : $loop->the_post();?>             <article class="brd-bottom" id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
                         <?php the_post_thumbnail( array( 100, 100 ) ); ?>

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

                     <?php                     $nb_stars = intval( get_post_meta( get_the_ID(), 'product_rating', true ) );                     for ( $star_counter = 1; $star_counter <= 5; $star_counter++ ) {                         if ( $star_counter <= $nb_stars ) {                             echo '';                         } else {                             echo '';                         }                     }                     ?>
                     <?php                     $key = 'product_choice';                     $themeta = get_post_meta($post->ID, $key, TRUE);                     if($themeta != '') {                     echo '
Editor Choice
';                     }                     ?>

<?php the_terms( $post->ID, 'device_reviews_device_brand' ,  ' ' ); ?> <?php the_excerpt(); ?>

         <?php endwhile; ?>

      now the page which uses single-review.php template also shows all results BUT the link which I added `<a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>` does not shows the content on its page. It shows the list of all reviews again. I hope someone understand what I am trying to solve, and if you want I can provide you with link to test page I have.


title: next_post_link on custom taxonomy

text: I want to use `next_post_link` and `prev_post_link` to return only the next post in my custom taxonomy of a custom post type. I have a custom post type called "work_posts" which has the taxonomy "work_categories" assigned. The category I want to show is called 'all'. I looked up `get_adjacent_post` in the "link-template.php" which has a few filters which should make it possible to make such a query but my SQL is not good enough to make the right query. The hooks are:   * `get_{$adjacent}_post_join`   * `get_{$adjacent}_post_where`   * `get_{$adjacent}_post_sort` if I log a query in the join hook I get:               INNER JOIN wp_term_relationships AS tr      ON p.ID = tr.object_id      INNER JOIN wp_term_taxonomy tt      ON tr.term_taxonomy_id = tt.term_taxonomy_id      AND tt.taxonomy = 'category'      AND tt.term_id IN (3)      how do I modify this to only show posts from my custom taxonomy?


title: How to make a image-size selected by default in Media upload - WP v3.5

text: Bare with me. I want to have a custom image size selected by default in the Media upload popup page. In Wordpress v3.4.2 and prior, this elegant code worked fine:               function my_insert_custom_image_sizes( $sizes ) {         // get the custom image sizes         global $_wp_additional_image_sizes;         // if there are none, just return the built-in sizes         if ( empty( $_wp_additional_image_sizes ) )             return $sizes;              // add all the custom sizes to the built-in sizes         foreach ( $_wp_additional_image_sizes as $id => $data ) {             // take the size ID (e.g., 'my-name'), replace hyphens with spaces,             // and capitalise the first letter of each word             if ( !isset($sizes[$id]) )                 $sizes[$id] = ucfirst( str_replace( '-', ' ', $id ) );         }              return $sizes;     }               // Which custom image size selected by default     function my_set_default_image_size () {           return 'custom-image-size-2';     }               function custom_image_setup () {         add_theme_support( 'post-thumbnails' );         add_image_size( 'custom-image-size-1', 160, 9999 ); //  columned         add_image_size( 'custom-image-size-2', 300, 9999 ); //  medium         add_image_size( 'custom-image-size-3', 578, 190, true ); //  cropped         add_filter( 'image_size_names_choose', 'my_insert_custom_image_sizes' );         add_filter( 'pre_option_image_default_size', 'my_set_default_image_size' );     }          add_action( 'after_setup_theme', 'custom_image_setup' );      So, `my_insert_custom_image_sizes` adds the custom images to the media page and `my_set_default_image_size` should select the `custom-image-size-2` size. This code stopped working with the Wordpress 3.5 version. Do you know how I can accomplish this in v3.5?


title: Display three different levels of navigation from wp_nav_menu separately?

text: I have a three level nav setup using Wordpress menu creator. Structure: A   —1   ——Y   ——Z   —2   —3   B   C I wish to display each level of the navigation alone, in different areas of the page. With current items highlighted. On pages A, B or C I want to display: A B C   (I can use wp_nav_menu with depth=1 for this) On pages 1*, 2 or 3 I want to display: A B C and 1 2 3   On pages 1*, Y or Z I want to display: A B C, 1 2 3 and Y Z Are there any easy ways of displaying the second and third level navs for the currently selected menu item? The important thing is that I need to be able to display each "level" menu individually. Thanks


title: Archive Page Not Found on Custom Post Type

text: I created a custom post type with a taxonomy defined, but I am having trouble getting an archive page to show up.   1. I get a 404 page not found. The individual post shows up but nothing on archives page.  functions php.               function create_post_type() {           register_post_type( 'my_properties',               array(                   'labels' => array(                       'name' => __( 'Commercial Properties' ),                       'singular_name' => __( 'My Property' )                   ),               'public' => true,               'menu_position' => 5,               'rewrite' => array('slug' => 'Myproperties')               )           );       }            add_action( 'init', 'create_post_type' );           function property_taxonomy() {          register_taxonomy(           'properties',           'my_properties',           array(               'hierarchical' => true,               'label' => 'Category',               'query_var' => true,           )       );       }            add_action( 'init', 'property_taxonomy' );        I have tried: • Creating an **archive-my_properties.php** (should the page be named after the registration or the slug? • Resaved permalinks • Flushed Rewrite rules


title: custom comment fields on CPT

text:
I want to create few comments custom fields for my CPT and remove the default ones. I will have just two custom fields more exactly 2 radio inputs. Here is my code:               function debate_comment_fields( $fields ) {           if( is_singular( 'debate' ) ) {               $fields['url'] = '';          $fields['author'] = '';          $fields['email'] = '';                   $fields['first'] = '
' .                           __( 'HTML5' ) .                           '' .                           '<input id="first" name="category" type="radio" value="'.get_post_meta($post->ID, 'agree', true).'" />
';                   $fields['second'] = '
' .                             __( 'FLASH' ) .                             '' .                           '<input id="second" name="category" type="radio" value="'.get_post_meta($post->ID, 'disagree', true).'" />
';              return $fields;               }     }      add_filter('comment_form_default_fields','debate_comment_fields');        The problem is that on my default blog posts the url, author and email fields are removed also and I'm expecting to see them there because I've added `if( is_singular( 'debate' ) ) {` And if I submit a comment inside my CPT I get: `ERROR: please fill the required fields (name, email).` It seems that it's still asking me for those fields. What's wrong with my code? Thanks!


title: What is the best way to mimic a search query within a plugin

text: I'm in the process of building a Wordpress plugin. I wish to mimic WP's default search functionality but in the form of a 'live search'. I have my JS setup to grab the query string (i.e what would be `/?s=search- term`) & am passing it via AJAX to my function. But now I have to process the query to get the list of posts & pages. But I've read that it's not right to simply use `query_post` from the WP documentation. So my question is, **what is the correct approach to yield the same search results as if the default search form was submitted?** Please can someone provide a code snippet or a link to a detailed article which clarifies this for me. Thanks & please pardon my nativity!


title: How do i manually place a widget code

text: is there a way that i can place a certain widget any where on the site. For example: I'm using the text widget in my sidebar, for the title i put youtube, and i placed the youtube embed code in it. But i want that widget to go at the top of the site how do i make this possible, while still using the widgets menu, but not show up in the sidebar, but wherever i place it? If it's not possible, does anyone know of a youtube sidebar widget, one that can let you place the widget code anywhere on the site and also do it from the widgets menu.


title: Updating Wordpress - the best approach (updating wp core, plugins and db)

text: What is the best approach (steps) to update Wordpress when I have to update all of the following:   1. wp core   2. plugins   3. database I came across this post http://codex.wordpress.org/Updating_WordPress However, it doesn't involve db update on top of wp core. Should I update the db after wp code and plugins or before? Db contains settings for plugins, so I'm a bit confused when it's the best to update it. Would really appreciate any tips. Thank you, Dasha


title: How to show the taxonomy assigned to a post in the table (where all the posts are displayed) of the custom post type?

text: Right now I use the following code to create a custom post type and assign a taxonomy to it:               // === CUSTOM TAXONOMIES === //     add_action('init', 'my_custom_taxonomies', 0);          function my_custom_taxonomies() {      register_taxonomy(       'section',  // internal name = machine-readable taxonomy name       'static_content',  // object type = post, page, link, or custom post-type       array(        'hierarchical' => true,        'labels' => array(         'name' => __( 'Section' ),         'singular_name' => __( 'Section' ),         'add_new_item' => 'Add New Section',         'edit_item' => 'Edit Section',         'new_item' => 'New Section',         'search_items' => 'Search Section',         'not_found' => 'No Sections found',         'not_found_in_trash' => 'No Sections found in trash',         'all_items' => __( 'All Sections' ),        ),        'query_var' => true, // enable taxonomy-specific querying        'rewrite' => array( 'slug' => 'section' ), // pretty permalinks for your taxonomy?       )      );      wp_insert_term('Footer', 'section');      wp_insert_term('Header', 'section');      wp_insert_term('Front Page Intro', 'section');      wp_insert_term('Front Page Content', 'section');     }          // === CUSTOM POST TYPES === //     add_action( 'init', 'create_my_post_types' );          function create_my_post_types() {      register_post_type( 'static_content',       array(        'labels' => array(         'name' => __( 'Static Content' ),         'singular_name' => __( 'Static Content' ),         'add_new_item' => 'Add New Static Content',         'edit_item' => 'Edit Static Content',         'new_item' => 'New Static Content',         'search_items' => 'Search Static Content',         'not_found' => 'No Static Content found',         'not_found_in_trash' => 'No Static Content found in trash',        ),        '_builtin' => false,        'public' => true,        'hierarchical' => false,        'taxonomies' => array( 'section'),        'supports' => array(         'title',         'editor',         'excerpt'        ),        'rewrite' => array( 'slug' => 'static_content', 'with_front' => false )       )      );     }      When I click the menu of the custom post type (in this case "Static Content"), I see in the table/column (where all the posts are displayed) the following information: Title, Author and Date. I would like to show the taxonomy assigned to that post (in this case the "Section".) How do I do that?


title: Problem with widgets

text: I am using the theme 3Grey. It is widget enabled. There are few widgets that are hard coded in the theme. These widgets donot appear in the sidebar in the widgets page. If i try adding new widgets the old ones get deleted. Is this ths normal case. Or is there any problem here.


title: visually sort ordering "custom post types" for end users

text: Now with those custom post types and other bits of content that don't necessarily need to be organized chronologically by date, for example: the client has a 100 T-Shirts as custom post type "SHIRT" and he wants to set their appearance order. What approach you suggest taking for letting the editor/admin of the site SORT their order?


title: Passing two values wordpress dropdown category

text: I have been following this guide on how i can pass two values to filter the post instead of one in wordpress category drop-down. The objective here is once the user selects a location and then selects a price. The problem with my code is it redirects me to the home page and displays a "Page not found" in the browsers tab Here is the tutorial i'm trying to follow - https://spruce.it/noise/two-category-dropdown-search-filter-in-wordpress/ I have this code on my **project-page.php** which is a custom page.               <div class="filter_container">                 <form method="get" action="<?php bloginfo('template_url');?>/filter/" id="findfood">                        <?php wp_dropdown_categories('show_option_none=Select Location&hide_empty=1&child_of=23&orderby=name&name=manila'); ?>                  <?php wp_dropdown_categories('show_option_none=Select Price&hide_empty=1&child_of=32&orderby=name&name=1m-3m&hierarchical=1'); ?>                  <input type="submit" value="Search"/>                  </form>     </div>      Here is the code for my **category.php**               <?php     if (($_GET['manila'] != -1) && ($_GET['1m-3m'] != -1)):     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     query_posts(        array(           'orderby' => 'date',           'order' => 'DESC',           'paged' => $paged,           'posts_per_page' => 6,           'category__and' => array(              $_GET['1m-3m'],              $_GET['manila']           ),          )     );     ?>             <?php else:        if ($_GET['manila'] != -1){           header('Location:'.get_category_link($_GET['manila']));        } elseif ($_GET['1m-3m'] != -1){           header('Location:'.get_category_link($_GET['1m-3m']));        } else{           wp_redirect(home_url());        }     endif;?>


title: How to customize wp_link_pages()

text: Does anyone know how to customize `wp_link_pages()` so that `<!--nextpage-->` will show like `"<< previous"` and `"next >>"` links instead of `"Pages: 1 2 3 "`? Note:- i used `"<!--nextpage-->"` in my Wordpress tinymce editor for pagebreaks between long pages.


title: Wordpress - show number of comments for each post in widget

text: I have installed a plugin that lets me put a PHP code into the widget - basically, what I want to do is to create a "recent posts" area, where you can see a cover of the post (featured image's thumbnail), title and number of comments for them. So far I managed to create a code that works - minus the comments. I looked at few different things, like get_comments_number, comments_number, wp_count_comments - but so far I can't get this to work. Here's current code:               <?php     $recent_posts = wp_get_recent_posts(array('numberposts' => 3));     ?>          <ul>     <?php foreach($recent_posts as $post) : ?>     <li>         <a href="<?php echo get_permalink($post['ID']) ?>">         <?php echo get_the_post_thumbnail($post['ID'], 'thumbnail'); ?>         <?php echo $post['post_title'] ?>         </a> -  //here I want to show the number of comments     </li>     <?php endforeach; ?>     </ul>         Edit: did it myself :D somehow my PHP stopped being saved and after a couple of more tries I managed to find a way. Added this and it seems to work:               <?php echo get_comments_number($post['ID']); ?>


title: How do i hide all comments from logged out users

text: Is there a way to remove published comments so they're hidden for logged out users?


title: Youtube shortcode

text: I'm trying to make this shortcode work but without any success. All attempts gives me a white square.                 function youtube($atts) {         extract(shortcode_atts(array(         "value" => 'https://www.youtube.com/watch?v=EhWopzlRwZ8',         "width" => '475',         "height" => '350',         "name"=> 'movie',         "allowFullScreen" => 'true',         "allowScriptAccess"=>'always',         ), $atts));         return '<object style="height: '.$height.'px; width: '.$width.'px"><param name="'.$name.'" value="'.$value.'"><param name="allowFullScreen" value="'.$allowFullScreen.'"></param><param name="allowScriptAccess" value="'.$allowScriptAccess.'"></param><embed src="'.$value.'" type="application/x-shockwave-flash" allowfullscreen="'.$allowFullScreen.'" allowScriptAccess="'.$allowScriptAccess.'" width="'.$width.'" height="'.$height.'"></embed></object>';         }         add_shortcode("youtube", "youtube");


title: How to validation for sanitize_URL?

text: Like sanitize_email validation is options available but sanitize_url options is available .if options is not available then how can i do this . http://i.imgur.com/WPYdkTb.png


title: textarea_name is not working with wp_editor

text:
I used to use a normal textarea and tried to change wp_editor on front-end.
<textarea name="post_content" rows="10" cols="20" placeholder="Briefly describe yourself. please do not put your email or phone number"><?php echo get_the_content($resume_id); ?></textarea>
                It works fine and I tried to change to wp_editor.               <?php     $post = get_post( $resume_id, OBJECT, 'edit' );     $content = $post->post_content;     $editor_id = 'editpost';     $settings=array('textarea_name' => 'post_content');     wp_editor( $content, $editor_id, $settings );          ?>      On next step, get the value like this.               $post_content = $_POST['post_content'];      when I use a normal textarea, it works fine. but It's not working with wp- editor. I have tried on Edit page, the value gets not updated content. Let's say the original content is "123" and updated "12345" and hit update button.                $post_content = $_POST['post_content'];      it gets "123" only. Did i missed something?


title: How to handle this problem related to the publishing date of imported posts?

text: I have the following situation that I have to handle: I imported some posts from an old custom blog (not WordPress, a custom blog made using ASP). I exported in CSV format the content of the table containing posts in the old blog and then I used a plugin named **Import CSV file** to import the old posts (that was into the CSV file) into classics WordPress posts. To do it this plugin combine the CSV file fields to the Wordpress **posts** database table. So the posts are imported as unpublished posts. The posts of old blog have a date which was associated to the **posts_modified** field of the **posts** table of the WP database. The posts are correctly imported as unpublished posts and the problem is that when I go to publish a post the value of **post_date** field is changed to the actual publishing date. The problem is that I imported some hundreds of posts and I need to have that, for each post, the **post_date** value is the same of the imported **posts_modified** value (otherwise this creates problems when I go to display the posts). So how can I handle this situation? Can I create a query that, for eache record into the **posts** table of the WP database set the value of the **post_date** using the value of the **posts_modified** ? Or exist some other solutions?


title: How to change the title (name) color of new custom widgets in backend

text: I created a few custom widgets. The following part of the code set up the title (name) and description. How can i include a class for the widget title (name) to change the color of the name that appears in the Backend UI ?               // Creating the widget         class ppg_widget extends WP_Widget {             function __construct() {        parent::__construct(        // Base ID of your widget        'ppg_widget',              // Widget name will appear in UI        __('Popular Posts', 'ppg_widget_domain'),              // Widget description        array( 'description' => __( 'Displays popular posts', 'ppg_widget_domain' ), )         );        }


title: Why jquery option is not working when pass value using wp_localize_script?

text: 0 down vote favorite I am developing a wordpress plugin and i am facing a problem when pass value to jquery using wp_localize_script . This is my code               function newsbox_load_custom_script() {          $newsbox_parameters = array(       'newsPerPage' => 4 ,       'newsTickerInterval' => 2500     );     wp_enqueue_script('newsbox-custom-script', plugins_url( '/scripts/custom.js', __FILE__ ),'', '1.0.1', true);     wp_localize_script('newsbox-custom-script', 'newsbox_parameters',$newsbox_parameters);     }     add_action('wp_enqueue_scripts', 'newsbox_load_custom_script');      and this is jquery code               jQuery(document).ready(function(){            jQuery(".news_list").bootstrapNews({          newsPerPage: newsbox_parameters.newsPerPage,          autoplay: true,          pauseOnHover: true,          navigation: false,          direction: 'down',          newsTickerInterval: newsbox_parameters.newsTickerInterval,          onToDo: function () {             //console.log(this);          }       });     });      If i write jquery like               jQuery(document).ready(function(){            jQuery(".news_list").bootstrapNews({          newsPerPage: 4,          autoplay: true,          pauseOnHover: true,          navigation: false,          direction: 'down',          newsTickerInterval: 2500,          onToDo: function () {             //console.log(this);          }       });     });      Then it work perfectly. http://digitalsensebd.com/newsbox/ But if i pass value using wp_localize_script, it is not working http://digitalsensebd.com/newsbox_plugin/?page_id=4 Please tell me the solution


title: Cannot save widgets in custom sidebars

text:
I'm working on a child theme of the Toolset Bootstrap Theme. I need to create a custom sidebar, so I registered the new sidebar in my child theme's function.php file:               function wpbootstrap_register_newsidebar() {          /* Register the new sidebar. */     register_sidebar(         array(             'id' => 'sidebar-999',             'name' => __( 'Home sidebar', 'wpbootstrap' ),             'description' => __( 'This sidebar will display only on the homepage.', 'wpbootstrap' ),             'before_widget' => '',             'after_widget' => '',             'before_title' => '
',             'after_title' => '
'         )     );     } add_action( 'widgets_init', 'wpbootstrap_register_newsidebar' );      I can see the new sidebar in the admin screen, drag widgets into it, add a title, reorder them but if I reload the page all of the widget disappear from the sidebar. The parent theme already has 3 built-in widgetized areas, which work just fine: I can add and save widgets in those areas. Also if I switch to a default theme, like Twenty Fourteen, and try to register a custom sidebar using the same code pasted above, I get a fully functional custom sidebar area. So apparently my code is not the problem. I tried to post the question on the parent theme's vendor support forum, but haven't heard from them yet, so I thought to ask to the wider WP community just in case someone is experiencing a similar problem. I'm not a WP guru and I don't know much about how custom widgetized area are created and stored inside WP environment, but if someone can point me to the right direction I'd be more than happy to learn some more about it. Unfortunately I'm working on a local development version of a website, so I cannot provide any testing URL.


title: How to save meta box check box values and show them on a post?

text: I added this codes on my child theme **functions.php**               add_action( 'add_meta_boxes', 'cd_meta_box_add' ); function cd_meta_box_add() {         add_meta_box( 'my-meta-box-id', 'My First Meta Box', 'metabox_function_call', 'post', 'normal', 'high' ); }          function metabox_function_call() {  global $post;         $values = get_post_custom( $post->ID );            ?>              <p>             <input type="checkbox" id="my_meta_box_check" name="my_meta_box_check" />             <label for="my_meta_box_check">Check this</label>         </p>         <?php    } ?>      Now a meta box named 'my first meta box' with a check box appears at the bottom of the editor when I add a post. How can I save this


title: Post types translation

text:
I try to translate post types names (Post, Page and Attachment). I have the following code:               function create_skip_post_types_box () {             $post_types = get_post_types(array('public'=>true), 'names' );             $opt = $this->_get_option();             $skip_types = is_array(@$opt['skip_post_types']) ? @$opt['skip_post_types'] : array();                  foreach ($post_types as $tid=>$type) {                 $checked = in_array($type, $skip_types) ? 'checked="checked"' : '';                 echo                     "<input type='hidden' name='wdpv[skip_post_types][{$type}]' value='0' />" . // Override for checkbox                     "<input {$checked} type='checkbox' name='wdpv[skip_post_types][{$type}]' id='skip_post_types-{$tid}' value='{$type}' /> " .                     "" . ucfirst($type) . "" .                 "
";             }         }      I tried to use ucfirst(__($type,'textdomain')) but it didn't work. I know that for user roles we can use translate_user_role function, but what about post types? Thank you!


title: Decrease white space between sidebar widget title and graphic

text: I am new to all of this, so sorry if this has been discussed. I am looking for a way to decrease the white space between my sidebar widgets, especially between the titles and then the pic. ie. "my latest pins, the six pics, & the pinterest logo". blog.clothandpatina.com - using twenty twelve Thank you for any help you can give. Tammy


title: Adding an image to a non existing post

text: I am building a frontend posting mechanism. Everything is working fine besides the image uploader. I am using Wordpress Wysiwyg editor using `<?php wp_editor ?>`. When I click on the Add media button (which is part of the editor), the image is actually being uploaded to the previous post, because the current one is not existing yet. Anyone has any idea how to solve this? Nevo


title: Do not display post images on front page

text: I have decided that for all pages where multiple posts are shown (e.g. front, category, tag pages), that post images should not be shown. Instead, featured images, if specified, should be shown next to each post. Right now, featured images are working fine for posts. However, when multiple posts are displayed (e.g. on the front page, category pages), images should be stripped from the posts. When a single post is displayed, the images should display as well. I'm assuming that this has something to do with `add_filter()` and a regex `str_replace()` on the post, but this would affect the post no matter where it's displayed. Reply


title: How to get multiple loop in category.php, my scripts becomes madness

text:
I am trying to develop a `category.php` page for my new theme and the loop which I’ve developed shows all posts of my blog and really bad too. I'm not an expert in WordPress theme development and getting mad because of this thing. I need to show the most recent posts of the selected category, big and different and others with another style. This is the relevant code:               <?php $categories = get_categories( array ('orderby' => 'count', 'order' => 'desc' ) ); ?>     <?php foreach ($categories as $category) : ?>       <?php query_posts( array ( 'category_name' => $category->slug, 'showposts' => '5') ); ?>
<?php single_cat_title(); ?>
       <?php if ( have_posts() ): ?>
       <?php $i = 0; ?>       <?php while ( have_posts() ) : ?>         <?php bm_ignorePost($post->ID); ?>         <?php the_post(); ?>
           <a<?php if ( $i == 0 ) : ?> class="first"<?php endif; ?><?php $i++; ?> href="<?php the_permalink(); ?>">             <?php the_post_thumbnail( array(151,151)  ); ?>
       <?php endwhile; ?>

<a href="/category/<?php echo $category->slug; ?>">More »
       <?php endif; ?>     <?php endforeach; ?>      My recent question but didn't get a reply on the wordpress.org forum.


title: Extra fields on categories that is available via the WP-API?

text: I want my posts to belong to a taxonomy with a couple of extra fields such as `category_icon`, `category_quick_facts` etc. I want this taxonomy (with all of its fields) to be available via the WP-API. How do I set this up? (I would prefer a solution without plugins but as long as the solution works with the WP-API, it is much appreciated.)


title: Custom post Type Pagination help

text:
i'm wondering how to add pagination like 1,2,3.. on my custom posts listing page. Below is my custom post template which lists all my custom posts,                <?php while ( $loop->have_posts() ) : $loop->the_post();?>                 <?php $postid = get_the_ID(); ?>                     <?php  echo '
'; ?>                         <?php echo esc_html( get_post_meta( $postid, 'wpcf-member-name', true ) ); ?>	                         <?php echo esc_html( get_post_meta( $postid, 'wpcf-chief-executive', true ) ); ?>	                         <?php echo esc_html( get_post_meta( $postid, 'wpcf-telephone', true ) ); ?>	                         <?php echo esc_html( get_post_meta( $postid, 'wpcf-fax', true ) ); ?>	                         <?php echo esc_html( get_post_meta( $postid, 'wpcf-email', true ) ); ?>	                         <?php echo esc_html( get_post_meta( $postid, 'wpcf-website', true ) ); ?>
                 <?php endwhile; ?>      Is there any wordpress default function available for this ? If not can you guide me what's the best way to do this ?


title: Custom post type is showing custom home page, not archive page

text:
I have a custom post type set up (two, actually) that are not displaying properly. I am hoping that it is the same issue with both post types. Here is my code for one of the post types (portfolio). The second is quite similar.               <?php     add_action('init', 'ccd_portfolio');          function ccd_portfolio() {              $labels = array(             'name' => _x('Portfolio', 'post type general name'),             'singular_name' => _x('Project', 'post type singular name'),             'add_new' => _x('Add New', 'ccd_portfolio item'),             'add_new_item' => __('Add New Project'),             'edit_item' => __('Edit Project'),             'new_item' => __('New Project'),             'view_item' => __('View Project'),             'search_items' => __('Search Projects'),             'not_found' =>  __('Nothing found'),             'not_found_in_trash' => __('Nothing found in Trash'),             'parent_item_colon' => ''         );              $args = array(             'labels' => $labels,             'public' => true,             'publicly_queryable' => true,             'show_ui' => true,             'query_var' => true,             'menu_icon' => get_stylesheet_directory_uri() . '/images/icons/plugins/portfolio.png',             'capability_type' => 'post',             'hierarchical' => false,             'menu_position' => null,             'supports' => array('title', 'editor', 'excerpt', 'author'),             'can_export' => true,             'show_in_menu' => true,             'has_archive' => true,             'rewrite' => array('slug' => 'work')           );               register_post_type( 'portfolio' , $args );         flush_rewrite_rules();     }          add_action("admin_init", "ccdport_admin_init");          function ccdport_admin_init(){       add_meta_box("mb_ccdport_details", "Project Details", "ccdport_details", "portfolio", "normal", "high");       add_meta_box("mb_ccdport_client", "Client", "ccdport_client", "portfolio", "side", "high");     }          add_action( 'admin_enqueue_scripts', 'ccdport_add_datepicker' );     function ccdport_add_datepicker(){       wp_enqueue_script( 'jquery-ui-datepicker' );       wp_enqueue_style('jquery-datepicker-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css');     }     function ccdport_details(){       global $post;       $custom = get_post_custom($post->ID);       $preview_url = $custom['preview_url'][0];       $start_date = $custom['start_date'][0];       $end_date = $custom['end_date'][0];     ?>
Preview URL: http://         <input type="text" size="35" name="preview_url" value="<?php echo $preview_url; ?>" />

Start date:         <input id="startDate" type="text" size="15" class="DatePicker" name="start_date" value="<?php echo $start_date; ?>" />           End date:         <input id="endDate" type="text" size="15" class="DatePicker" name="end_date" value="<?php echo $end_date; ?>" />
              <?php     }          function ccdport_client(){       global $post;       $custom = get_post_custom($post->ID);       $client = $custom['project_client'][0];       $name = $custom['client_name'][0];       $args = array(         'post_type' => 'clients',         'posts_per_page' => -1,         'orderby' => 'name',         'order' => 'ASC'       );     ?>
Client name
       <input type="text" name="client_name" value="<?php echo $name; ?>" />
Organisation
     <?php       $query = new WP_Query( $args );       if ( $query->have_posts() ){         echo '<select name="project_client">';         while ( $query->have_posts() ){           $query->the_post();           $slug = $post->post_name;           echo '<option value="'.$slug.'" '.selected($slug, $client).'>'.get_the_title().' ('.$slug.')</option>';         }         echo '</select>';       }       else { echo '
There are currently no clients registered
'; }     }          add_action('save_post', 'ccdport_save_details');          function ccdport_save_details(){       global $post;            update_post_meta($post->ID, "client_name", $_POST["client_name"]);       update_post_meta($post->ID, "project_client", $_POST["project_client"]);       update_post_meta($post->ID, "portfolio", $_POST["portfolio"]);       update_post_meta($post->ID, "preview_url", $_POST["preview_url"]);     }     ?>      Each post type is included in a separate file, and called to functions.php with an include command. These are showing up in the admin area perfectly, posts are being saved perfectly, etc. However, the theme files (archive- portfolio.php and single-portfolio.php) are not loading. Instead, my custom home page is being displayed. I don't know what the issue would be. I have flushed the rewrite rules with each post type, and removing that does nothing either. I have only recently started with custom post types, so any assistance would be extremely helpful. I have had a look through the other answers and they don't seem to be helpful in my situation. I've tried resaving my permalinks, to no avail. I've tried changing `'has_archive' => true` to `'has_archive' => 'portfolio'`, nothing. Is there something I have missed? More than likely something glaringly obvious? **[UPDATE]** For anyone viewing this page, I have solved the issue. After a conversation with deflime, deactivating and reactivating plugins, commenting and uncommenting, I now have my site working as intended. I have a couple of custom post types in my functions.php file. Each one is in its own .php file to make them easier for me to manage and included in functions.php. However, I had a few issues with them, which was resolved. I had a space at the top of the page when I included more than one .php file. That was solved a short while ago, but as a temporary fix, I encased the pages in a `if ( is_admin() )` function. I wasn't aware that would also affect the template pages as well. Thanks to deflime for the help, I wouldn't have tried more things had it not been for you. Thank you. I shall repost this a little later, but since the question has been open for less than 8 hours and I have a reputation here of less than 10, I can not update it just yet.


title: Using AJAX and PHP to load next post object

text: After looking through the jQuery documentation and many stackexchange community forums, I am still faced with this problem. Taking little bits from here and there have helped me get this far, but I am stuck where I am now. Im using an ajax request to try and load the next post after the one that is currently displayed. The only issue I run into is when I try to execute the method included in my php file:               <?php          echo getnext();          function getnext(){               $post = get_post($_POST['id']);          $prevPost = get_previous_post();          return $prevPost->post_content;                    }     ?>      I can echo the POST variable that is being passed in fine, but once I try to actually call the method I get a 500 internal Server Error. My AJAX request looks like this:                     setTimeout(function (){          $currid = $('#post_id').val();          $.post("wp-content/themes/stargazer/populate.php",                 {                     "id":$currid                 },                 function(data){                     //$("#academiccontent").html(data);                     alert (data);                 });          $('#academiccontent').animate({ 'opacity': 1 });           }, 1000);      Any help would be greatly appreciated, Ive been stuck on this for a long while now. Thanks!!


title: Prevent submission of widget form

text: How can I prevent submission of a widget form? The following doesn't work for me. And preventing `submit` won't work because Wordpress uses Ajax for those forms.               jQuery(document).ready(function($) {       $(document).on('click', '.widget-control-save', function(event){         console.log('happens');         event.preventDefault();         event.stopPropagation();       });     });      What I'm trying to do is implement JS validation for the fields (since there is no way I know of to do so in backend) and for that I need a way to prevent this part of core WP: https://core.trac.wordpress.org/browser/tags/3.9.1/src/wp- admin/js/widgets.js#L60 I know jQuery is loaded and that the selector works. The `console.log` line is executed. But the widget is still being saved.


title: editor style css and page template with and without sidebar

text: I have two page templates in my custom theme. Full width template and Default template. Full width template does not have side bar and is of width 980px. While default template is having sidebar on right side and is of 700px width for content. I have used editor-style.css to provide content width of 980px. Problem is when user select default template content in editor is 980px wide, which i want to make 700px. When user selects full width template content area in editor should be 980px wide. As this is part of editor-style.css, i am not able to make it conditional based on template selection. Can any one provide a hook or way to change content width in editor based on template selection. I also prefer JS solution , but am not able to find tinymce setting for that. Thanks in advance for any help......


title: How to add chunk of php, html, and sql code to variable an append to $content

text:
I am creating a plugin (my first) which allows the site admin to display the most used post tags over the last X number of days. This plugin is an evolution of the WP Development question here - Display list of most used tags in the last 30 days. Forgive me for not knowing the proper jargon. I have most of the leg-work completed with the admin menu, etc, the only thing I have left is to actually display the results. The following snippet of code works when I drop it into the single.php file.

<?php echo $rpt_options['heading_tags']; ?>
     <?php $wpdb->show_errors(); ?>      <?php     global $rpt_options;     $rpt_days = $rpt_options['number_days'];     global $wpdb;     $rpt_term_ids = $wpdb->get_col("         SELECT term_id FROM $wpdb->term_taxonomy         INNER JOIN $wpdb->term_relationships ON $wpdb->term_taxonomy.term_taxonomy_id=$wpdb->term_relationships.term_taxonomy_id         INNER JOIN $wpdb->posts ON $wpdb->posts.ID = $wpdb->term_relationships.object_id         WHERE DATE_SUB(CURDATE(), INTERVAL $rpt_days DAY) <= $wpdb->posts.post_date");          if(count($rpt_term_ids) > 0){            $rpt_tags = get_tags(array(         'orderby' => 'count',         'order'   => 'DESC',         'number'  => $rpt_options['number_tags'],         'include' => $rpt_term_ids,       ));     foreach ( (array) $rpt_tags as $rpt_tag ) {     echo 'term_id) . '" rel="tag">' . $rpt_tag->name . '';     }     }     ?>      ![http://i.imgur.com/UzzXPFk.png](http://i.stack.imgur.com/Hdia3.png) I'm stuck at converting this code to a variable to append to `$content`. Right now, I only have a very simply display function, to test that the `number_days` and `number_tags` settings will display the values entered into the settings page. They do.               function rpt_display_content ($content){          global $rpt_options;          if(is_single()){                  $rpt_display = '
' . $rpt_options['rpt_tags_days'] . $rpt_options['rpt_tags_number'] . '
';                  $content .= $rpt_display;     }          return $content;     }     add_filter('the_content', 'rpt_display_content');


title: Loop through categories and create tab for each

text:
I'm trying to create a page that holds all categories of my custom post type as tabs, with a tab content. I am able to display all the category names as tabs, but i need to run a query in each tab content area to the corresponding category. So when I click on tab named "1" the tab content area should only show posts from the category belonging to the tab named "1". My code so far:                 <?php     echo '
';           $args = array(      'hide_empty'=> 1,      'orderby' => 'name',      'order' => 'ASC'      );          $categories = get_categories($args);            foreach($categories as $category) {               echo '
name.'" role="tab" data-toggle="tab">' .               $category->name.'
';         $cat_name = $category->name;              }          echo '
';         echo '
';           foreach($categories as $category) {              echo '
name.'">';                       ?>           <?php                $the_query = new WP_Query(array(           'post_type' => 'acme_product',           'posts_per_page' => 100,           'category_name' => $category->slug             ));           while ( $the_query->have_posts() ) :           $the_query->the_post();          ?>
<?php the_title(); ?>
                             <?php          endwhile;         wp_reset_postdata();        ?>                      <?php }          echo '
';          ?>      The problems is that each content area displays all post of every category. The html ouput:

Audi

Skoda

fffffffffffff

qqqqqqqqqqqqqqqqqqq

      Any suggestions?


title: Problem with WordPress 4.0 and $wp_query

text: On my website I have a logo area that is controlled by a function that determines which page the user is on and loads the specific content depending on the `$page_id` value. Since WordPress 4.0 there are parts of my site that don't work correctly. > Notice: Undefined property: WP_Query::$queried_object in > /myhost/mysite.com/html/wp-includes/query.php on line 3946 My functions file has this function call in it, which I believe is throwing it off. This is the call that is causing an issue:               $page_id = (isset($wp_query->queried_object_id)) ? $wp_query->queried_object_id : false; $parent_id = isset($wp_query->queried_object->post_parent) ? $wp_query->queried_object->post_parent : false;      I tried using `$wp_query->queried_object->ID` instead of `$wp_query->queried_object_id` but didn't make a difference. Could someone out there shed some light on this issue? I believe this happened since the WordPress 4.0 update and some other functions with the `$wp_query` call have the same error message. Anyone out there know what could be wrong? Thanks


title: Is there any way to recover deleted menu from database sql backup

text: i accidently deleted my main menu but i have a .sql database backup file and i want to recover my menu from this file. Is it possible? Thanks.


title: Pagination on author page

text: I created a custom query inside author.php, and I would like to add pagination. The problem is that the result is 404 error everytime.               $args = array(         'post_type' => 'wpost',         'author' => $user['ID'],         'posts_per_page' => 100     );          $args['paged'] = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;          // The Query     $the_query = new WP_Query( $args );     $temp_query = $wp_query;     $wp_query   = NULL;     $wp_query   = $the_query;          if ( $the_query->have_posts() ) {         while ( $the_query->have_posts() ) {             ....         }     }          previous_posts_link( 'Go Back' );     next_posts_link( 'View More', $the_query->max_num_pages );          wp_reset_postdata();     $wp_query = NULL;     $wp_query = $temp_query;      I can't find the problem. This works on other page templates. I appreciate your help.


title: Create Post tabs in single-{content-type}.php with Custom Field values

text: My requirement is exactly similar to Tabbed Post. I have Advanced Custom Fields (ACF) plugin to store data. So pulling up the requirement from the wordpress support thread: > Movie Summary | Synopsis | Screens | Trailer | Comments | Add your Review Movie summary is the_content(), Synopsis is the_excerpt(), Screens and Trailers are custom field values. I want to know how I can split the content i.e. Summary, Synopsis, Screens, Trailers into Tabs which will reload the page. I do not want to change the tabs using javascript and specifically want to reload page every time. A working example would be: Example Thanks in advance.


title: Page Links To Plugin Issue

text: I am using Page Links to WordPress Plugin for Linking WordPress Page to External Link. However, Its not working for my site. I am not using actual links just for example, My page permalink : http://website.com/SURVEY It should link to : http://website2.com/survey/657679 But when I put my page link on browser address bar, the address getting changed to http://website.comhttp/website2.com/survey/657679 I ensured there is http:// in link editor. Any help to fix it is appreciated. Thanks


title: static page with buton that opens collect email form

text: I am PHP programmer, but I am not familiar with WP yet (I do understand some basic things). I have static page and I have to place a DOWNLOAD button on this page. Click on this button will allow user to download some document. But before user is allowed to download anything, div.popup appears where user is asked to fill in and submit email address. I have about 5 buttons on page with different download files. All should act the same (ask email before download is allowed). Can you, please, guide me how to properly achieve this in WP: 1) how to properly add such kind of button on static page on wp-admin part Can I add something like this in wp-admin page editor? Or shoudl I create some short_code thet will create this? 2) how to create div.popup with form before user is allowed to download I can create invisible div on the page and add some jquery when button is pressed. But how to submit this form? Maybe I can use ajax to send email and allow download. But what is the best opetion - where to place this code? I can do this on pure PHP page, but I do not understand this in WP.


title: Controller functionality - if user is not logged in send them to specific page (not wp_login)

text: This sounds dead bang simple, but I just can't figure it out. I want the following functionality: _If user is not logged in and they try to access anywhere on the site (including the homepage) - send them to a specific page._ I tried, adding the following but received a "not redirecting properly" message:               if (!is_user_logged_in() ) {      wp_redirect ('/public' );      exit;      }      I guess if I can add a clause to the if statement saying and the page I am accessing is not the public page, but I'm not quite sure how to that properly. Any plugins that I see out there redirect to the wordpress login screen. Any help is greatly appreciated! Thanks, MG