title: The loop starting at a certain ID

text:
Is it possible to start the loop from a certain post ID? I would like to get all the post starting at a certain ID, decendingly. To explain, I have to make sum assumptions first. Assume that my WordPress database has 20 posts. Obviously, each post will have an ID, and assume that the IDs for those posts posts range from 1, to 20. Also assume that when we load the posts through the loop, we are using everything by default. So, the loop will retrieve records/posts from 20 to 1. If we have a range restriction of 10, then page 1 will retrieve 20 to 11, and page 2 will retrieve 10 to 1. Now, back to my question. Assume I would like to recieve records 17 to 8. Can I pass 17 to the loop somehow, and retrieve the 10 records from 17 down to 8? Is this possible? Here are some lines of code to help understand the issue:               <?php          $args = array(             'post_type'          => 'post',             'post_status'        => 'publish',             'category_name'      => 'news',             'posts_per_page'     => 10,                  'ID_VARIABLE_HERE'   => 17 // I would like to be able to pass the ID, and the loop should return 10 posts (as defined in the posts_per_page), descendingly, starting at 17.               );                        $custom_query = new WP_Query($args);          ?>            <?php if ($custom_query->have_posts()): while ($custom_query->have_posts()) : $custom_query->the_post() ; ?>

<?php the_post_thumbnail(); ?>

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

<?php the_excerpt(); ?>

          <?php endwhile; else: ?>
<?php _e('No contents exist.'); ?>
     <?php endif; ?>      As you can see, I would like to pass an argument, in the `$args`, that will have the ID value (17 in the example above). Read the code comment above for details of what is needed. Is it possible? If not via an argument in `$args`, what is another way of doing that? Thanks.


title: How to implement WordPress plugin update that modifies the database?

text: I develop a WordPress plugin, which has several database tables of its own. The plugin creates these tables when activated, and removes them when deleted/uninstalled. I have to implement an update process of the plugin which updates plugin's code as well as tables structure. The simplest case would be to add a new column to one of the tables. The more complex case would be to create a new tables structure and update the content accordingly. How would you recommend to solve this problem? Is there any built-in WordPress functions that may help?


title: widget that will do shortcodes that user inputs

text:
I have this widget that im working on and it allows the user to input a shortcode and it will display it in the sidebar. But its not working right. I can input the short code but it has no output. Also it seams to strip the [] and if you include size=35, the 35 is stripped after you hit the save button. Here is part of the code:                    //Set Shortcode 1 title         $sc1title = apply_filters( 'Shortcode 1 Title', $instance['sc1title'] );              //Display Shortcode 1 title         if ( ! empty( $sc1title ) )             echo $args['before_sc1title'] . "
$sc1title
" . $args['after_sc1title'];              //Do Shortcode 1         //echo do_shortcode('sc1');         //echo do_shortcode($this->shortcodes[$instance['sc1']]);         echo do_shortcode('[sc1]');          echo "
";              //Set Shortcode 2 title         $sc2title = apply_filters( 'Shortcode 2 Title', $instance['sc2title'] );              //Display Shortcode 2 title         if ( ! empty( $sc2title ) )             echo $args['before_sc1title'] . "
$sc2title
" . $args['after_sc1title'];              //Do Shortcode 1         //echo do_shortcode('sc2');         echo do_shortcode($this->shortcodes[$instance['sc2']]);               echo $args['after_widget'];                        // Display after widget code         echo $after_widget;     }          // Update the widget settings.     public function update( $new_instance, $old_instance ) {         $instance['title'] = strip_tags( stripslashes($new_instance['title']) );         $instance['mtitle'] = strip_tags( stripslashes($new_instance['mtitle']) );         $instance['nav_menu'] = (int) $new_instance['nav_menu'];         $instance['sc1title'] = strip_tags( stripslashes($new_instance['sc1title']) );         $instance['sc1'] = strip_tags( stripslashes($new_instance['sc1']) );         $instance['sc2title'] = strip_tags( stripslashes($new_instance['sc2title']) );         $instance['sc2'] = strip_tags( stripslashes($new_instance['sc2']) );         return $instance;          }          // Displays the form on the widget page     public function form( $instance ) {         $title = isset( $instance['title'] ) ? $instance['title'] : '';         $nav_menu = isset( $instance['nav_menu'] ) ? $instance['nav_menu'] : '';         $mtitle = isset( $instance['mtitle'] ) ? $instance['mtitle'] : '';         $sc1title = isset( $instance['sc1title'] ) ? $instance['sc1title'] : '';         $sc1 = isset( $instance['sc1'] ) ? $instance['sc1'] : '';         $sc2title = isset( $instance['sc2title'] ) ? $instance['sc2title'] : '';         $sc2 = isset( $instance['sc2'] ) ? $instance['sc2'] : '';              // Get menus         $menus = wp_get_nav_menus( array( 'orderby' => 'name' ) );              // If no menus exists, direct the user to go and create some.         if ( !$menus ) {             echo '
'. sprintf( __('No menus have been created yet. Create some.'), admin_url('nav-menus.php') ) .'
';             return;         }         ?>
             <label for="<?php echo $this->get_field_id( 'title' ); ?>"><?php _e( 'Title:', 'wpspprofwid' ); ?>             <input type="text" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $title; ?>" />

             <label for="<?php echo $this->get_field_id( 'mtitle' ); ?>"><?php _e( 'Menu Title:' ); ?>             <input type="text" class="widefat" id="<?php echo $this->get_field_id('mtitle'); ?>" name="<?php echo $this->get_field_name('mtitle'); ?>" value="<?php echo $mtitle; ?>" />

             <label for="<?php echo $this->get_field_id( 'nav_menu' ); ?>"><?php _e( 'Select Menu:' ); ?>             <select id="<?php echo $this->get_field_id( 'nav_menu' ); ?>" name="<?php echo $this->get_field_name('nav_menu'); ?>">         <?php             foreach ( $menus as $menu ) {                 echo '<option value="' . $menu->term_id . '"'                     . selected( $nav_menu, $menu->term_id, false )                     . '>'. $menu->name . '</option>';             }         ?>             </select>

             <label for="<?php echo $this->get_field_id( 'sc1title' ); ?>"><?php _e( 'Shortcode 1 Title:' ); ?>             <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc1title'); ?>" name="<?php echo $this->get_field_name('sc1title'); ?>" value="<?php echo $sc1title; ?>" />

             <label for="<?php echo $this->get_field_id( 'sc1' ); ?>"><?php _e( 'Shortcode 1:' ); ?>             <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc1'); ?>" name="<?php echo $this->get_field_name('sc1'); ?>" value="<?php echo $sc1; ?>" />

             <label for="<?php echo $this->get_field_id( 'sc1title' ); ?>"><?php _e( 'Shortcode 2 Title:' ); ?>             <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc2title'); ?>" name="<?php echo $this->get_field_name('sc2title'); ?>" value="<?php echo $sc2title; ?>" />

             <label for="<?php echo $this->get_field_id( 'sc2' ); ?>"><?php _e( 'Shortcode 2:' ); ?>             <input type="text" class="widefat" id="<?php echo $this->get_field_id('sc2'); ?>" name="<?php echo $this->get_field_name('sc2'); ?>" value="<?php echo $sc2; ?>" />


title: Echo text if field under user_meta is empty with get_users()

text:
With get_users() I am listing users and their information. I've a custom field in the database, people_lists_class.               <?php         $blogusers = get_users('role=contributor&orderby=display_name');         foreach ($blogusers as $user) {             echo              '
' .                  'ID, $author_nicename) . '">' .             '
' .             get_avatar($user->ID, 50) .             '
' .             '' .                       /* \/ \/ \/ Look at this: \/ \/ \/ */             'ID, $author_nicename) . '">' .             '
' .             $user->display_name . ', ' . get_user_meta($user->ID, 'people_lists_class', true) .             '
' .             '' .             /* /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ */                  '
' .             get_user_meta($user->ID, 'people_lists_title', true) .             '
' .                  '
' .             get_user_meta($user->ID, 'description', true) .             '
' .                  'ID, $author_nicename) . '">' .             '
' .             ' View articles by ' . $user->display_name .             '
' .             '' .                  '

' .             '
';         }     ?>      To separate 'people_list_class' from 'display_name' I have a comma. But I only want the comma to show if the user have something written in the "people_lists_class"-field. Can I somehow integrate the following piece of code to accomplish this?               <?php if ( !empty( $user->people_lists_class ) ) {         echo ', ';     }     else {         echo '';     }     ?>


title: Wordpress search results

text: I have installed Job Manager and managed to filter the search to only display jobs (i.e. post_type = jobman_job) and it works ok however, when displaying the search results, it only shows the title - it does not pull the short description (the "excerpt") like the normal search does. Can anyone give me some direction on how to make the search display the job content?


title: How to Show featured image in google search?

text: I am interested to show featured image in google with post link. Is it possible? I have searched a lot regarding this but haven't found anything yet. Any help in this regard will be appreciated.


title: Load post attached images on a single page site with fancybox

text: I'm trying to make a single page site that will display posts as thumbnails in some part. Then if a thumbnail is clicked, I want all the images contained in this post to be loaded with fancybox while the user is staying on the home. I'm loading the first image on my template with this   `<a href="<?php the_permalink() ?>"><?php the_post_thumbnail(); ?></a>`.   And post images are just created in the editor this way   `<a href="blabla/image.jpg"><img src="blabla/image.jpg" /></a>` . When I click the thumbnail, the browser follows the permalink. So I'm stuck with 2 different approaches now.   1. Loading `the_content` of the post and then hiding all the images BUT the first...   2. Keeping on with `the_post_thumbnail();` and then write something that will find the post ID, and then will display the rest of the attached images. I'm aiming for the 2nd one, but I'm a very novice WP dev so don't know how to write the "find ID" function... Anyone can help? BTW Fancybox is running OK, I can open images.


title: Display not found page 404 on specific Post Type

text: Here is my case, I'm making some experiments with post types, basically I created a post type called Slider where the featured image is will display in the slide. Now, when user type something like domain.com/slider/slide1, or try to reach the slider post, I want to display a not found page instead of the single page, or the index in case I dont have the post single page. Is it possible to achieve? **Solved!** Thanks to Saif Bechan, I could solve my problem, Basically I used this function                add_action('template_redirect', 'my_template_redirect');      function my_template_redirect() {      global $wp_query, $post;      if(is_singular('Slider'))       {           $wp_query->set_404();        }      }      Where Slider is the Post Type name,


title: how to allow unregistred users to view normal posts

text: If an unregistered user/stranger try to view a post it says > "You must be registered or logged in to view the post". http://testandverification.com/events/dvclub-august-2012-on-sv-uvm/ We have a category (for private posts) to allow only some registered users to access some posts. Even though posts are not included in that category, it shows the above message. > How to allow unregistered users/strangers to view public posts? I did the following on my test server. **I disabled all the plugins and switched my theme to twentyeleven.** > In that twentyeleven theme everything is fine - stranger can able to access > posts. **When I switch the theme to our custom theme and without enabling the plugins, the issue re-occurs.** Then I thought that the problem is not with plugin so I tried to compare the theme code with an early release and found that it is the same as before. > I loaded a old DB backup in the test server and I was surprised that it > worked correctly! > > When I tried to recreate the missing posts between the old DB and current > DB, I got the same problem. > > It is strange and I felt happy when I traced the problem in the DB and now I > have lost the confidence of tracing the bug.


title: Modifying search results based on post_type

text: Is there an easy way to highlight search results based on post_type? I am using Job Manager plugin and when a site search is performed, I want to simply add a note e.g. (Job) next to the Job Results.


title: How to set up sub-categories for author pages?

text: I am setting up Wordpress for a school. They want to enable teachers to have their own section of the site where they can create posts in different categories (assignments, events, etc). I know that Wordpress supports multiple authors and that I can show posts by those authors out of the box by going to `http://domain.com/authors/{username}`. However, instead of just showing all of the posts from different categories in one loop, I would like to allow the user to view posts by category and they can choose from a link menu. ![alt text](http://i.stack.imgur.com/R5sLg.png) Can anyone point me in the right direction on how to do this? Is there a way to create a url that would filter posts by author AND category?


title: How to Reference/Echo Variable from Another PHP Function

text:
I have successfully set up a PHP function for my blog posts to create a shortcode to automatically display/style an iFrame tag for a YouTube video, as well as pull in the duration and view count immediately underneath. I am now looking to display JUST the view count and duration values for the video on the home/list pages (via loop.php) but having difficulty determining the appropriate PHP code to do this. Here is the function that I've been using successfully for the post view:               add_shortcode('yt', 'getYoutubeDetails');          function getYoutubeDetails($atts) {         extract(shortcode_atts(array(         'video' => ''         ), $atts));              // Get YouTube data via the API         $JSON = file_get_contents("https://gdata.youtube.com/feeds/api/videos?q=$video&alt=json");         $JSON_Data = json_decode($JSON);         $views = $JSON_Data->{'feed'}->{'entry'}[0]->{'yt$statistics'}->{'viewCount'};         $views = number_format($views);         $duration = $JSON_Data->{'feed'}->{'entry'}[0]->{'media$group'}->{'yt$duration'}->{'seconds'};                   echo "";         echo "Views: $views
Duration: ";         echo sec2hms($duration);         echo "

";         }      Within my post content, I tag my videos as [yt video="VIDEOID"]. I was hoping I could get the specific attribute for views/duration by using: `<?php echo GetYoutubeDetails($views) ?>` in loop.php, but that doesn't seem to work. Is there a way to structure this to pull in a specific attribute within the function? Would it be able to leverage the value being passed into the video attribute of the shortcode that's already in the post content? I'd prefer to tap into the existing shortcode already in the post content (so I'm not having to maintain it two or more different places). However, if there isn't a way to echo the value of an existing function for a particular post in loop.php, I was thinking it may need to get handled via a custom field somehow. Any suggestions for how to tackle this issue?


title: Show shortcode without executing it

text: I am trying to display code in my WordPress page and it isn't working. Everything I read says that you should be able to just use `pre` tag with code tag and it would be good but when I try to display a shortcode, it renders the shortcode rather than displaying the code. The codex says that using `pre` and code would work but it isn't for me. Has anyone had this issue? Am I missing something in `functions.php` that makes this work?


title: How to print [embed] code in wordpress

text: I would like to print the following code in wordpress.               [embed]http://www.youtube.com/watch?v=9bZkp7q19f0[/embed]      But every time I use that code in the wordpress editor, it automatically embeds the video. Is there a way to print it. I've tried `pre` and the answer mentioned here http://wordpress.stackexchange.com/a/64616/5074 But its still not working.


title: Escaping a shortcode so it displays as-is

text: > **Possible Duplicate:**   >  Show shortcode without executing it I've created a plugin that uses a custom shortcode to allow the user to easily split their post into columns. The problem is, when writing about how to use the shortcode in the plugin documentation on my website, WordPress interprets the shortcode and starts applying to to my content. I don't want this, rather I want the shortcode to display exactly as written. How can I do this?


title: Displaying category archive of custom post types

text: I am woefully late to the party on Custom Post Types and only started using them quite recently, so apologies if my questions seems idiotic, but I can't seem to find an answer to my question. I've set up a custom post type called **actors** with a couple of custom field values, and (crucially), I'm using _standard_ categories to separate these actors into **men** , **women** and **children** listings:               'taxonomies' => array('category', 'post_tag')      ...since I thought that would be a much cleaner and neater way of... well, categorizing the actors. However, I'm completely stumped at how to actually display these categories in any way, shape or form. I have a custom `archive-actors.php` file which displays _all_ of the actors, but I want to be able to filter them by category; e.g. only display the **men**. However if I guess at a standard URL like `mysite.com/category/actors/men` I just get > Sorry, but there aren't any posts in the Men category yet. The same thing happens if I just try `mysite.com/category/men` \- in neither case is it using the `archive-actors.php` template, either. Can anyone help clear away my fog of dull-mindedness and point me in the right direction so I can filter out these pesky actors? **Edit:** As @mrwweb alludes to below (and I forgot to mention I had tried), the following can be added to the `functions.php` file:               function query_post_type($query) {         $post_types = get_post_types();              if ( is_category() || is_tag()) {                  $post_type = get_query_var('actors');                  if ( $post_type ) {                 $post_type = $post_type;             } else {                 $post_type = $post_types;             }                  $query->set('post_type', $post_type);                  return $query;         }     }          add_filter('pre_get_posts', 'query_post_type');      ...as referenced here which _does_ work, insofar as it will display my categorised custom post types on the regular `archive.php` page, but doesn't utilise my `archive-actors.php`, which is key.


title: bbpress plug-ins and buddypress

text: Is it possible to use the standalone bbpress plug-ins with a buddypress site - using bbpress forums site-wide and disabling the buddypress forums. I need to add moderation. I have decided not to use buddypress forums.


title: Detect Post Type when publish_post is ran

text: I currently have WordPress build an `XML Sitemap` everytime a `POST` or `PAGE` is `PUBLISHED` by using this Action...               add_action("publish_post", "create_news_sitemap");      I am not doing the same process but for a `News Sitemap` which has different criteria. Such as it can only show post that are no older then 48 hours. I have my code working but I would like to optimize it slightly. So when `add_action("publish_post", "create_news_sitemap");` is ran, I would like to ONLY run a function is it is a Custom Post Type named `news` that is Publishing a post. Is this something that is possible? when the `publish_post` action is ran, can I detect which POST_TYPE is setting it into action?


title: Passing settings to multiple WYSIWYG editors

text: I am trying to create multiple wysiwyg editors on the same page using a loop. I am trying to pass settings to each editor to change their look of them. I'm not sure what I am doing wrong. I am assigning each of them their own ID.                   $repeatable_fields = get_post_meta($post->ID, 'repeatable_fields', true);              <?php             if ( $repeatable_fields ) :                 // set a variable so we can append it to each row                 $num = 0;                 // echo 'we have repeatable fields!';                      foreach ( $repeatable_fields as $field ) {                 // add one to the variable each time we loop through                 $num++;                                   $titleContent = $field['select'];                         $titleSettings = array(                             'media_buttons' => false,                             'textarea_name' => 'select[]',                             'editor_css' => '<style>.mceToolbar, tr.mceFirst { height:10px; background:transparent; } .mceContentBody { font-size:22px; } .wp-editor-tabs, tr.mceLast { display:none; }.mceIframeContainer { height:30px; }</style>',                             'editor_class' => 'title_tinymce_editor',                             'tinymce' => array(                                 'theme_advanced_buttons1' => "mffsmartlink,unmffsmartlink,mffsmartlinker_info",                                 'theme_advanced_buttons2' => "",                                 'theme_advanced_buttons3' => ""                             )                         );                         wp_editor($titleContent, 'movie_title-'.$num, $titleSettings);                      ?>         }     endif;      All of this is only affecting the first instance. All of the others are not receiving specific settings, such as many of the css styles,


title: How to add post count to wp_nav_menu?

text: Is it possible to add post count to menu links using wp_nav_menu? For example:-                   Apple (3)         ball (6)         cat (2)


title: Taxonomy as checkboxes

text:
So I'm trying to get Wordpress to display the categories as a series of select boxes in a custom meta box and am using some examples from this tutorial, but when I go to save the selection it generates additional categories in the form of the intended selections ID. It also fails to save more than one selection.                   <?php                   // Add the Meta Box         function add_custom_meta_box() {             add_meta_box(                 'custom_meta_box', // $id                 'Custom Meta Box', // $title                  'show_custom_meta_box', // $callback                 'products', // $page                 'normal', // $context                 'high'); // $priority         }         add_action('add_meta_boxes', 'add_custom_meta_box');                               // Field Array           $prefix = 'custom_';           $custom_meta_fields = array(             array(                 'label' => 'Category',                 'id'    => 'category',                 'type'  => 'tax_checkbox'             ) );                          // The Callback           function show_custom_meta_box() {           global $custom_meta_fields, $post;           // Use nonce for verification           echo '<input type="hidden" name="custom_meta_box_nonce" value="'.wp_create_nonce(basename(__FILE__)).'" />';                  // Begin the field table and loop             echo '
';             foreach ($custom_meta_fields as $field) {                 // get value of this field if it exists for this post                 $meta = get_post_meta($post->ID, $field['id'], true);                 // begin a table row with                 echo '
                         '.$field['label'].'	                         ';                         switch($field['type']) {                    case 'tax_checkbox':               $terms = get_terms($field['id'],'get=all' );     $post_terms = wp_get_object_terms( get_the_ID(), $field['id'] );          $taxonomy = get_taxonomy( $field['id'] );          $checked = $post_terms ? $taxonomy->hierarchical ? $post_terms[0]->term_id : $post_terms[0]->slug : null;          foreach ( $terms as $term ) {                                     $term_value = $taxonomy->hierarchical ? $term->term_id : $term->slug;                                     echo '<input type="checkbox" value="' . $term_value . '" name="' . $field['id'] . '[]" id="term-' . $term_value . '"' . checked( $checked, $term_value, false ) . ' /> ' . $term->name . '
';                                 }                                 echo '' . $field['desc'] . ' Manage ' . $taxonomy->label . '';                             break;                                                  } //end switch                 echo '
';             } // end foreach             echo '
'; // end table           }                        // Save the Data         function save_custom_meta($post_id) {             global $custom_meta_fields;                  // verify nonce             if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))                  return $post_id;             // check autosave             if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)                 return $post_id;             // check permissions             if ('page' == $_POST['post_type']) {                 if (!current_user_can('edit_page', $post_id))                     return $post_id;                 } elseif (!current_user_can('edit_post', $post_id)) {                     return $post_id;             }                  // loop through fields and save the data             foreach ($custom_meta_fields as $field) {                       if($field['type'] == 'tax_select') continue;                         if( in_array( $field['type'], array( 'tax_checkboxes' ) ) ) {                             // save taxonomies                             if ( isset( $_POST[$field['id']] ) ) {                                 $term = $_POST[$field['id']];                                 wp_set_object_terms( $post_id, $term, $field['id'] );                             }                         }                              else {                           $old = get_post_meta($post_id, $field['id'], true);                 $new = $_POST[$field['id']];                 if ($new && $new != $old) {                     update_post_meta($post_id, $field['id'], $new);                 } elseif ('' == $new && $old) {                     delete_post_meta($post_id, $field['id'], $old);                 }             } } // end foreach                  // save taxonomies             $post = get_post($post_id);             $category = $_POST['category'];             wp_set_object_terms( $post_id, $category, 'category' );         }         add_action('save_post', 'save_custom_meta');                          ?>


title: check if a draft has been moved there from publish to draft

text: I am writing a plugin, part of the functionality does functions on hook: publish_to_draft I then later want to re-publish that post and trigger specific functionality to see if it has previously been published. i.e. draft_to_publish Now whilst I already have functionality for this, what I can't tell is the difference between a post that is just a draft going to publish or a previously published post that has been moved back to draft. This is important because it is used for integration and I need to run that functionality on that action. Can I use the_date() for this? Cheers Dan


title: Installing word press on a raspberry pi

text: I am following instructions out of the raspberry pi book to install word press. I have done almost everything but I guess I need to run the mysql configuration script. It tells me to run a file called setup-mysql the command is this.               sudo bash setup-mysql -n wordpress localhost      The error I was that there was no file so i went to the directory and found that it was setup-mysql.gz. So I tried gunzip and I get the error that it is not in gz format. Please help so that I can get this working.


title: Hide input field when second input field is in focus

text:
I'm trying to create a sidebar where there are two inputs side by side: Search|Subscribe. When the user clicks on one input (Search, for example), I want the second (Subscribe) to disappear so the other input can grow to fill the space. My guess is that this is not possible with pure CSS, so will it require jQuery? If it does require jQeury, does anyone have any tips on the basics for what's needed to flip between the two fields? I know next to nothing about jQuery. The CSS already grows the fields to fill the width, I just need to figure out how to display:none for the non-selected field. Thanks in advance for any help. Inputs:               <form role="search" method="get" id="searchform" action="<?php echo home_url('/'); ?>">

                 <input type="subscribe" value="" name="subscribe" id="subscribe" placeholder="<?php _e('SUBSCRIBE', 'reverie'); ?>"> <input type="search" value="" name="s" id="s" placeholder="<?php _e('SEARCH', 'reverie'); ?>">

     </form>      CSS:               input[type="search"], input[type="subscribe"] {         -webkit-appearance: textfield;         -webkit-box-sizing: content-box;             outline: none;         border: none;         background: none;         display: inline;         width: 70px;         font-size:14px;         font-weight:500;         -webkit-transition: all .5s;         -moz-transition: all .5s;         transition: all .5s;     }          input[type=search]:focus, input[type=subscribe]:focus {         border-bottom: 3px solid #bcbbab;         width: 100%;         background: none;     }


title: Create custom fields on a post

text: I want to have a very specific post "type". I would like to get rid of the title and content box, and add a "Name" field and an "Age" custom field. This way when I go to create a new post, it's like creating a new "person" With their name and age. I'm trying to do this, so that I can hopefully use a JSON api plugin so that I can feed this into a JSON api for myself. Any suggestions?


title: Change query variable for wordpress search

text: When we do a search in wordpress the url appears like this:               http://example.com?s=hello      But I am using s= query variable for another purpose. so I wish to change default wordpress s= to search=. The updated code should not work of s= for wordpress search, instead it should only support search=. I tried a code snippet from http://demand.cr/2011/08/how-to-replace-the- default-search-query-parameter-in-wordpress/. It works but it accepts both s= and search=. I need it to work only for search=


title: Add tags to long page that is broken up into subpages?

text: I have a long document that I am publishing as a page and splitting into sub- pages using page breaks `<!--nextpage-->`. I am trying to find out if it is possible somehow to add tags to these sub- pages. I can't seem to find a plugin or a tutorial out there on this subject. Any help?


title: Dropdown menu on click change

text: Im working on a website where I need to create a submenu that shows only the parent pages. When I click on one of the parents it has to show the children from that parent.   Here is the menu hierarchy I used this widget plugin: Subpages Extended for showing the parents and children:   * Parent     * Parent1 from parent       * Child1 from parent1       * Child2 from parent1     * Parent2 from parent       * Child1 from parent2       * Child2 from parent2 Could you explain me or give an example/tutorial on how to do it? Thanks..


title: Site 'Categories': save an admin global setting with post metadata

text: In WPMU, we are using Site Categories (with Sitewide Tags), but for the life of me I can't see how the category of the sub-site (say, departments in a school) to which each blog belongs ends up in the posts. (Well, it doesn't. I've listed out the metadata from the database and checked the post data, categories (...), terms, and tags also. Site Categories puts nothing there.) It's probably not supposed to, but the problem I'm solving is giving posts collected to the main site an icon corresponding to the category of the site it was blogged under. The Types plugin does this, but the category would be visible and selectable for each post the blogger posts. Instead, this value should be set to the site category once when the site is created and never seen by the bloggers. How do I do this? I could settle for saving an extra category with all posts on a site, but as I see it if a plugin does this it would have to have different settings on each site.


title: WordPress replacing all line breaks in comments with "rn"

text:
This concerns a problem at my blog. My provider recently required me to upgrade from PHP 5.2 to PHP 5.4. This in turn required me to update WordPress. Ever since the dual update, all line breaks in comments are rendering as "rn", so that if you type this:               Hi

     Hello      what gets rendered is               HirnHello      If I edit comments to repair them, all of the line breaks I enter are converted back to "rn" as soon as I hit "save". A temporary rollback to PHP 5.2 had no effect on this problem. I briefly thought I could solve the problem by updating my theme (K2). This did not solve the problem and created a slew of new (unrelated) problems, so I've rolled back that update. Browsing around this site, I see a few scattered references to this and similar problems, but no indication that it's ever been common and nothing that appears to be a solution. Can someone guess what's causing this, and even better, how to fix it? **Update** : I found a file called `wp-comments-post.php`, which contains the following line:               $comment_content = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;      I wrapped the `trim($_POST['comment'])` inside a `nl2br()`, and this helped a bit. Instead of rendering as               HirnHello      it now renders as               Hi
     rn
     rnHello      (or something like that; I might have forgotten how many `rn`'s show up). This is progress, but I'd still like to get rid of the `rn`'s. Presumably I can use `str_replace`? But I am an amateur and am not sure of the syntax. My first few guesses didn't work. Meanwhile, I still want to know why this problem arose in the first place.


title: How to redirect users to custom lostpassword page?

text: How to redirect users to custom lostpassword page when they click on the Error: Lost your password?. Because I set a redirect for `wp-login.php` to my custom login page. when a user click on Error: Lost your password? it requests for `wp-login.php` and then automatically redirects to custom login page. I know the function is present on `wp-login.php` file but I don't know what changes shall I make to make this possible. Please help. I have also renamed wp-login.php.


title: how redirect users to custom login page when "login to reply" is clicked?

text: I am building my website on Wordpress and I have created my custom login page.But for a post when an user comments and other nonlogged see the comment with along with a line down "Login to reply".And when the user clicks on that"Login" from "Login to reply" it redirects to wp-login.php.So how to redirect users to custom login page when "login to reply" for a post is clicked on wordpress instead of wp-login.php.


title: Wordpress 3.8.1 Multisite blog slug problem

text: Just installed Wordpress 3.8.1 multisite but can't remove the /blog/ slug. I've tried all suggestions for older versions of Wordpress (including the solutions to the question posted on this site 6 months ago regarding removing from root) to no avail. Anybody know how to fix this or if it's possible to fix? I need two sites for a dual language website. Could a solution be to just create 3 sites and use the root site as an interface to the other sites, or should I use an alternative CMS?


title: Custom Query - show first post twice?

text:
In a custom query, is there a way to show the first post twice? I want to show the first post in a certain format at the top of my query, then again right under it along with my other posts (maybe a little redundant). I've tried just pulling the post then showing it like, but when I call `the_post` it seems to remove it from my overall array of objects. **Simplified Version**               <?php if($test->have_posts()) : $test->the_post(); ?>
<?php the_title(); ?>
     <?php endif; ?>           <?php if($test->have_posts()) : ?>         <?php while($test->have_posts()) : $test->the_post(); ?>
<?php the_title(); ?>
         <?php endwhile; ?>     <?php endif; ?>      I've also tried to get into the array but I'm not sure how:               $post = $test->WP_Query[0];      How can I show my post, without 2 queries or modifying the original custom query?


title: Get posts by list of post IDs ordered by those IDs?

text: I am going to make a "favourite" posts box, but the article id's are stored in another DB so I only get an array of IDs (which **are** relevant to the WP DB). I think it could be done with `get_posts()` or simply just with `WP_Query`, however as I am surfing through the codex I cant find solution to my problem - you can obviously select posts by multiple tags, authors,... but I cant find something similar for just IDs. I wouldnt even mind if the posts werent ordered. Mainly I just want to get a bunch of posts in one (WP)Query providing only posts' ids. Any Ideas? Thanks :)


title: Let Users Filter Posts by Custom Fields

text: I'm using the Advanced Custom Fields plugin to add custom fields to my posts, but was wondering what is the best way to go about creating a filter box for the user to filter through posts. ![enter image description here](http://i.stack.imgur.com/syJ59.jpg) I've been using the `pre_get_posts` action in WordPress to alter the meta query like so `http://www.website.com/cars?type=saloon,couple,SUV`. But I've found that when I start using multiple queries the website begins to hang and it's pretty slow. Does anyone know if there's a better way to do this. I simply want my users to be able to filter through cars with relative ease. Am I going about this the wrong way? Any help is appreciated. Thanks in advance!


title: Best Way to Redirect Category to Page and Hide Category

text: I have a category archive page at: http://mysite.com/news It displays an archive of items from the category 'news-article' I'd like to redirect any requests for http://mysite.com/category/news-article to http://mysite.com/news (so that the former is never directly accessible). Is there a best practice? Should I put a 301 Redirect in my .htaccess file (or use a plugin to do the same)? Or should I use `wp_safe_redirect`? If yes, which action hook should I use? As in:               add_action( 'WHICH_ACTION_HOOK??', 'adam_redirect_news' );     function adam_redirect_news () {         if ( is_category( 'news-article' ) ) {                  wp_safe_redirect( 'http://mysite.com/news' );             exit;         }     }


title: Alternatives to DISALLOW_FILE_EDIT wp-config Constant? It Breaks Some Plugins

text: ### The Problem I first noticed this with the plugin Quick-Cache, which activates without problem, but doesn't shows up anywhere. Its menu it's simply not there. Found why, and became aware of the conflict, in the forums. Problem is that the plugin does all the capability checking using `edit_plugins`, removed by the constant... Now I found that the plugin Search and Replace also bugs with the constant.   ![enter image description here](http://i.stack.imgur.com/wAUCF.png) ### The solution I just added this information to the Codex. And would like to search for alternatives to enabling DISALLOW_FILE_EDIT. Filtering the `map_meta_cap`, obviously, doesn't works.   What I can think of is removing the submenu item, the action link and, case someone lands in `/plugin-editor.php` by a direct URL, make the editor window read-only. I already assembled this code and will post as an answer, but would be glad to know this community opinion and other possible approaches.


title: Additional .htaccess rules based on wp page

text: I've created a page in the dashboard called Authors, created a new template- authors.php with completely own logic. It works well, going to website.com/authors/ I see a list of all authors, specifying the URL I can get to their details, for instance: `example.com/authors/?name=George`. I can also switch profile pictures: `example.com/authors/?name=George&pic=1`, `example.com/authors/?name=George&pic=2` etc (default is 1). I'm trying for half a day get user-friendly URLs been working but can't figure out a correct way... I'd like to achieve this kind of links: `example.com/authors/George` and `website.com/authors/George/2`. Tried even a really basic code in the `functions.php`, but it doesn't work:               add_rewrite_rule('^qwerty', 'index.php/authors/', 'top');      `example.com/qwerty` displays 404.


title: Front-End Post Submission

text: I am trying to add a form where users can submit post from front-end. I am Following this tutorial: http:// wpshout.com/wordpress-submit-posts-from- frontend/ What I am doing is adding this code to one of my page-template. The form shows up alright but when I click on the submit button it gives me " **Page not found error** " Many of the commenter saying it is not working. Can anyone point me to the right direction? Is the code incomplete?has flaws? Am I doing something wrong? Thanks Towfiq I.


title: Show related (archive) month and year to post

text: I want to show the related (archive) month and year for a post next to its contents, i.e. "Archived in January 2012". Any help / directions is greatly appreciated.


title: Apply the_content filter to a custom field with multiple values

text: I have a custom meta box set up that allows users to paste the Youtube URL of a video so that it can be embedded into a post/page. The meta box can be repeated so that a user can add as few or as many URL's as they wish so I'm using this code snippet to display each as a list item;               <?php         $video = get_post_meta($post->ID, 'youtube-url');         foreach ($video as $vid) {             echo '<li>'.$vid.'</li>';         }     ?>      Is there a way that I can run `the_content` filter on each individual list item so that I can make use of oEmbed that is shipped with Wordpress? Or perhaps there's a more efficient way...


title: Pagination go to first page if i'm on last post

text: I have a custom post type and used get_next_post() and get_previous_post() to create a simple pagination. However i need to create a pagination loop (if that is the correct term). If i'm on the first post i need to browse back to the last post and if i'm on the last post i need to browse to the first post. Is there a simple way to do this that i haven't seen but Google, this site and the codex has not been very helpfull :/ The current code i have is. I've tried to use wp_list_pages and other functions but with little luck.               $next_post = get_next_post();     $prev_post = get_previous_post();     $nav = array(         "next_post" => array(             "url"       => get_permalink($next_post->ID),             "id"        => $next_post->ID,             "titill"    => get_field("vinstri_titill", $next_post->ID)." - ".get_field("vinstri_undirtitill", $next_post->ID)         ),         "prev_post" => array(             "url"       => get_permalink($prev_post->ID),             "id"        => $prev_post->ID,             "titill"    => get_field("vinstri_titill", $prev_post->ID)." - ".get_field("vinstri_undirtitill", $prev_post->ID)         ),     );


title: Function to add class to <form> element?

text: I'm using the Sidebar Login script by Mike Jolley, I would like to add a class of "clearfix" to the element tag. I have been unable to find a solution to this so far. I'd also like to understand any solution given, so if you would like to briefly explain how the function works I'd be very grateful.


title: Refresh page using Cron after any post is published

text: I would like to refresh page after any post(custom post type) is published, how do I refresh page using the Cron after any post is published? Can anybody tell me in which direction should I go? I ve'been trying to google that info, but it seems that nobody were ever interested or it seems as impossible.


title: Why archive page can't show full content?

text: I use "insert more tag" insert more tag for a post. It works fine, at front page show excerpt, at single page show full content. but at archive page show excerpt, I want show full content here. Here is the code in archive page.               <?php query_posts('cat=1&paged='.get_query_var('paged'));?>      <?php if (have_posts()) : while (have_posts()) : the_post();?>     <div <?php post_class() ?> id="post-<?php the_ID(); ?>">           <?php the_content(); ?>     .........      no idea what's the rule for show full content or excerpt.


title: How do I display page content next to a contact form, rather than under it?

text: Using a stock wordpress theme and contact form 7. Lots of room on the form's right but it insists on putting everything underneath it.


title: Custom Post Type Template based on Taxonomy

text: I have a custom post type, Vehicles. Vehicles have a custom taxonomy, new or used. Naturally the vehicle pages use single-vehicles.php but I would like to differentiate between new and used vehicles by somehow using different templates automatically based on whether they're new or used. For example, the New vehicles don't have certain attributes (Mileage, Year etc) as they're not relevant, so I would like to remove that from their template. If this is possible, that would be great. If not I'd really appreciate any alternative ways around it.


title: How do I create a template page to show 3 blog posts?

text: I have a blog theme that I created which shows one post per page. To do this I simply set up `single.php` the way I wanted, and I have some code that links the 'blog' item in the nav to the latest blog post, and it all works fine. Yay. Now the client wants to see 3 posts per page, so I created a new `template- blog.php` file, and then created a page a `/blog` to display three posts in a row. My `template-blog.php` file starts with The Loop:                   if ( have_posts() ) {             while ( have_posts() ) {                 the_post();       Yet it never actually gets any posts, so the page at `/blog` displays a blank blog post. How can I get Wordpress to give this template 3 blog posts? I tried just upping the # of blog posts per page in Settings/Reading to 3, but that did nothing. Then I set my "Posts" page (also in Settings/Reading) to the Blog template, and now it uses the `content.php` file to display one blog post (poorly) and completely ignores my `template-blog.php` file. I didn't even know about the `content.php` file before this?! I _think_ the answer is that I probably shouldn't be using a `template- blog.php` file at all, and instead I should be changing some other file(s) to display three posts at once. I can work on editing `content.php` so it displays one single post correctly, but the rest of the page design still needs to be there (like the special header I have for the blog, etc, currently in `template-blog.php`). How?


title: Using a switch statement in Wordpress

text:
I've got a piece of text in a div that I want to change on each page of my website. At the moment I'm not sure what function I should be using to do this. Here's what I have so far...               <?php     $page = is_page();     switch ($page){     case 'home':     $content = 'How much money....';     break;     case 'about':     $content = 'We design....';     break;     case 'services':     $content = 'At the....';     break;     case 'blog':     $content = 'Find out whats....';     break;     case 'portfolio':     $content = 'Unique, Beautiful....';     break;     case 'contact':     $content = 'Get in touch to....';     break;     case 'privacy-policy':     $content = 'How much money....';     break;     case 'terms-and-conditions':     $content = 'How much....';     break;           }          echo '
'.$content.'
';     ?>      This code only seems to be picking up the first case for every page. Anyone know how I can get it to run through the switch completely? Many thanks in advance!!


title: Replace Post-Title with variable

text: I want to set a custom post-title with a custom-field meta in my Wordpress Theme. The user will add a new post to the post-type. When they do they will only see the "Title", "URL", and "Publish" metas. I want to eliminate the "Title" and only show the "URL" and "Publish" meta. When the user pastes the URL I have a variable set to grab the custom title from the URL. **Question:** Am I able to use this variable to generate the post-title? Something like:               $postid = get_the_ID();          add_post_meta( $postid, 'youtubetitle', $videotitle );          add_filter( 'the_title', 'my_replace_post_title', 100, 2);          function my_replace_post_title( $title, $id ){           if (is_feed())            return $title; // You don't modify the title if it is a feed             // To change the title to the value of your metafield, first get the value of the metafield         $new_youtube_title = get_post_meta( $id, 'youtubetitle', $single );             // $new_youtube_title becomes the new title        return $new_youtube_title;      }      The code above displays (no title) on all my videos when this is used, instead of pulling the $videotitle variable.


title: Create a page Meta Box listing all blog users

text: I have a custom post type where each post can only be seen on the frontend by one specific user. I have figured out how to make an archive template where only posts with the meta _allowed_user = user_ID are queried. But now I gotta create a meta box that lists all users (pretty much like the author box) so the publisher can choose who is allowed to see the post...


title: How to get template drop down menu in page-attributes of custom post type?

text: When I register my custom post type, I set this:               'hierarchical'   => true,     'supports'       => array( 'title','author', 'page-attributes' ),      So, I am supose to see 'order', 'templates', 'parents' in Attributes box when create new post. But, I don't see the 'templates' drop down showing up. Anything else I should do to enable the choice of 'templates' ?


title: Another "Sent Headers" Error w/ Missing Temporary Folder

text: I'm having the common media upload problem where images will fail uploading and send the error. However, this problem seems to have popped up with a change I've made recently because my WordPress site had been running for a few weeks and had no previous trouble with uploading media. It just recently acted up on me and sent me these error messages: * * * Warning: File upload error - unable to create a temporary file in Unknown on line 0 Warning: Cannot modify header information - headers already sent in /MYPATH/wp-admin/async-upload.php on line 26 “test-image.jpg” has failed to upload due to an error Missing a temporary folder. * * * I've made sure that my wp_config file didn't get any blank spaces appended to it, checked my "uploads" folder and set permissions to 777 and also checked the file "async-upload.php" and line 26 had this line: header('Content-Type: text/plain; charset=' . get_option('blog_charset')); I'm a bit confused on why all media uploading was fine and randomly started pushing this error. Is this something that may fall back on my host?


title: Specified file failed upload test. Error When Uploading Image From Front-end

text: This is my code:               $file_return = wp_handle_upload($_FILES['my-photo'], array('test_form' => FALSE));          if(isset($file_return['error']) || isset($file_return['upload_error_handler'])) {         echo "And so it DIED...";         print_r($file_return);         die;     }      Why is not uploading to the uploads dir and why is it throwing a "Specified file failed upload test."?


title: Permalinks set to /%postname%/ but still have links being indexed in the form ?p=x

text: I have a site that has pages being indexed in Google in the form...               site.com/?p=1     site.com/?category_name=uncategorized     site.com/?author=1     site.com/?m=201103      And since the permalinks of the site have been set to postname since the site was created, I'm trying to determine how these links are being created and where I might be able to find the source file that created the link index. I realize its possible that the site was indexed prior to the permalink update, but just trying to determine if there is a script I'm not aware of that might be accessible to a search engine spider. Any insights?


title: How do I remove quantcast from my sites?

text: When I use ghostery on chrome, it finds Quantcast, wordpress stats and google analytics on my sites (nathanblack.com and knuckletattoos.com). I have jetpack and google analytics installed, but where is quantcast coming from and how do I remove it?


title: stdClass::$labels /wp-includes/general-template.php undefined

text:
In my `<title>` tags I am getting `undefined` on a custom taxonomy in a custom post type and im struggling to find a way to set it.               <title>
     Notice:  Undefined property: stdClass::$labels in /www/public_html/lib/wp-includes/general-template.php on line 658

     Notice:  Trying to get property of non-object in /www/public_html/lib/wp-includes/general-template.php on line 658
     {custom_taxonomy_term} - {sitename}</title>      The URL called is: `http://domain.com/{custom_post_type}/{custom_taxonomy}/{custom_taxonomy_term}/` The theme page serving it is: `archive-{custom_post_type}.php` Its not getting the custom post type to me for the archive page so its firing a notice of it being blank. Not sure if there is a way I can force it or if I should be using a different theme page. Im using this to filter by taxonomies terms on custom post types. The function in `general-template.php` is `post_type_archive_title` when applying filter `post_type_archive_title` to `$post_type_obj->labels->name;` which is the undefined part. I would like the title to be something along the lines of `{custom_term} - {custom_taxonomy} - {custom_post_type} - {sitename}`. Edit: In the header.php I am using the usual `<title><?php wp_title( '' ); ?></title>` and have disabled Wordpress SEO plugin with same issue still. Using custom rewrites on the taxonomy terms with `rewrite => false` on the `register_taxonomy`:               add_rewrite_rule(              '{custom_post_type}/{custom_taxonomy}/([^/]+)/?$',             'index.php?post_type={custom_post_type}&{custom_taxonomy}=$matches[1]',             'top');


title: XML-RPC and $wpdb

text: Is it possible to use wordpress **xml-rpc** and **$wpdb** ? I need to send some params and get answer in real time ... In this link: http://codex.wordpress.org/XML-RPC_WordPress_API/ I just found some info, but is there any example with $wpdb ? Please any help ? UPDATE: I found some more info with methods: http://codex.wordpress.org/XML- RPC_Extending#Actions how to implement this for full functioning ?


title: Get a total count for all comments and display result

text: I would like to find out the number of comments in total I have and display the number on my website.


title: custom field suit new post with in custom fields

text: how can i use Custom Field Suite (CFS) https://uproot.us/ to create new posts in post type. what am trying to do is create a music albums using post then create new post based off the tracks in the album. i want to manage the track in the album post but have each track in the album as a new post type.


title: How to Force HTTPS on a WordPress and remove HTTPS from permalinks

text: I have recently secured SSL certificates for my website and I would like to force HTTPS for all visitors. And i want to remove HTTPS From permalinks Like this               <link rel="canonical" href="http://www.mysite.com/archive/ID/" />      anyone suggest me plz


title: Sub posts and non unique post_name

text: I'm trying to create sub-posts like this: /post/info/ /post2/info/ Using wp_insert_post() and I have almost succeeded. I'm setting post_parent to the parent post ID and the post_type needs to be "attachment". But! The problem is that the post_name needs to be unique so the sub page needs to be info, info2 etc and that's not what I want. So when settings the post_name to the same I'm getting all sub pages on one page when visiting /post/info/ and /post2/info/. Anyone knows if it's possible to accomplish this?


title: Plugins in WP_Options but not Active

text: Just completed a WordPress host migration. I had to disable plugins by deleting them in the WP_Options table. I have just added the correct plugins back into the db. However, the plugins are not active on the page. My question is, what do I need to do now to activate the plugins so that they are in working order on the page again? Thanks in advance.


title: How to block action if post is "dirty"?

text: For a plugin I'm working, I've added a button that needs to be either disabled or show a warning if the current editing post is dirty, that is, if anything has been modified and not saved. Looking at what's in /wp-includes/js/autosave.js, I've found that:               window.onbeforeunload = function(){         var editor = typeof(tinymce) != 'undefined' ? tinymce.activeEditor : false, compareString;              if ( editor && ! editor.isHidden() ) {             if ( editor.isDirty() )                 return autosaveL10n.saveAlert;         } else {             if ( fullscreen && fullscreen.settings.visible ) {                 compareString = wp.autosave.getCompareString({                     post_title: $('#wp-fullscreen-title').val() || '',                     content: $('#wp_mce_fullscreen').val() || '',                     excerpt: $('#excerpt').val() || ''                 });             } else {                 compareString = wp.autosave.getCompareString();             }                  if ( compareString != autosaveLast )                 return autosaveL10n.saveAlert;         }     };      (look at the declaration of 'editor' in second line of that code) I've tried to blindly copy that line and put it in my javascript that handle the 'click' event of this button, but the 'editor' variable is set to null, because, I suppose, 'tinymce' is not instantiated yet. The way I'm trying to implement this it's pretty similar to that:               jQuery(document).ready(function ($) {         set_element_as_source_init();         $('#icl_document_set_as_source_of_dropdown').find('a').click(set_element_as_source_open);     });          function set_element_as_source_open() {         var editor = typeof(tinymce) !== 'undefined' ? tinymce.activeEditor : false;              if (editor && !editor.isHidden()) {             if (editor.isDirty()) {                 alert('Please save this post before proceeding.');             }         } else {             // code here ....         }     }      Now, I've the feeling I'm taking the wrong approach, but looking on the web I didn't manage to find any solution for that. Actually I also think that by just checking if tinymce is dirty is not enough: what if I change other post elements, such as the title, taxonomies, custom fields, etc?


title: Loop through posts by each term and exclude duplicate posts assigned to several terms

text:
Okay, i'll try to go a bit more into detail. What i did with this code is getting a list of artists ordered by alphabet. In this list i'm showing all corresponding news posts to this artists term. That functions fine. But if there is a news that is corresponding to more than one of the artists i get the same post under every artist corresponded to the post. And what i wanna achieve is to show this post/news only ones for the first artist that is corresponded to this post. Instead of showing the post several times for every artist in the list. The shown code works for the listing of the artists and showing the corresponding posts beneath. Thanks in advance and sorry for the previous shaky description.               <?php foreach ( $artist_terms as $artist_term ): ?>              <?php $news = get_posts(array (         'numberposts' => 0,          'order' => 'DESC',          'meta_key' => 'date',          'value' => 'date(yyyy-mm-dd)',          'orderby' => 'meta_value',           'post_type' => 'news',          'artist' => $artist_term->slug         ));         ?>              <? if($news): ?>
                 <?php foreach ($news as $post) : ?>
                                    <?php the_post_thumbnail();?>                                 <?php $artist_name = strip_tags (get_the_term_list( get_the_ID(), 'artist')); echo $artist_name; ?>
                            <?php endforeach; ?>
              <?php endif; ?>     <?php endforeach; ?>      alternative to this code i found this one http://wordimpress.com/loop-through- categories-and-display-posts-within/. That does the same but also has no solution for the duplicates.               <?php     /*      * Loop through Categories and Display Posts within      */     $post_type = 'news';          // Get all the taxonomies for this post type     $taxonomies = get_object_taxonomies( array( 'post_type' => $post_type ) );          foreach( $taxonomies as $taxonomy ) :              // Gets every "category" (term) in this taxonomy to get the respective posts         $terms = get_terms( $taxonomy );              foreach( $terms as $term ) : ?>                <?php// echo $term->name; ?>               <?php $ids = array();               $ids[] = get_the_ID();          ?>                  <?php             $args = array(                     'post_type' => $post_type,                     'posts_per_page' => -1,  //show all posts                     'tax_query' => array(                         array(                             'taxonomy' => $taxonomy,                             'field' => 'slug',                             'terms' => $term->slug,                             'post__not_in' => $ids                         )                     )                      );             $posts = new WP_Query($args);                  if( $posts->have_posts() ): while( $posts->have_posts() ) : $posts->the_post(); ?>                      <?php             $args2 = array(                     'post_type' => $post_type,                     'posts_per_page' => -1,  //show all posts                     'tax_query' => array(                         array(                             'taxonomy' => $taxonomy,                             'field' => 'slug',                             'terms' => $term->slug,                             'post__not_in' => $ids                         )                     )                      );             $posts2 = new WP_Query($args2); ?>                                        <?php if(has_post_thumbnail()) { ?>                                 <?php the_post_thumbnail(); ?>
                              <?php }                         /* no post image so show a default img */                         else { ?>                                <img src="<?php bloginfo('template_url'); ?>/assets/img/default-img.png" alt="<?php echo get_the_title(); ?>" title="<?php echo get_the_title(); ?>" width="110" height="110" />                         <?php } ?>
                        <?php  echo get_the_title(); ?>

                       <?php endwhile; endif; ?>              <?php endforeach;          endforeach; ?>


title: publish_post action doesn't work

text: i'm developing a small plugin which will send email to users when a new magazine is published. i made a post type name "magazine" on the theme functions.php. and i wrote a plugin for email subscriptions. code:               function newsletter_sendEmails($post_id)     {         $post = get_post($post_id);              if ($post->post_type == 'magazine')         {             mail( "dor@zuberi.me", "מגזין חדש", "התפרסם מגזין חדש!" );         }     }          add_action('publish_post', 'newsletter_sendEmails');      but from some reason i don't get the email when i publish a new magazine, why is that?


title: How do I reset BackWPup?

text: I recently installed the BackWPup plugin to my site, and it has been working fine, until recently when I changed servers, now it doesn't backup. I'm wondering if this is because I changed servers it perhaps have old information.   Can you tell me if I need to reset BackWPup? If the answer is yes, how do I reset this? Do need to deactivate? Thanks for your help. Annette


title: Use global query parameters in new WP_Query for presenting separate results in tag archive

text:
wp_reset_postdata() does not seem to work here. I'm building a custom tag archive template, which should feature results from different post types in diferent boxes.                   <?php     $query_stringa= $query_string .'&post_type=recomendados';     echo $query_stringa;     $recs = new WP_Query($query_stringa);     while ($recs->have_posts()) : $recs->the_post();      $ids[] = get_the_ID();     the_title();     the_content();     the_tags();     echo get_post_type( get_the_ID() );     echo '
';     endwhile;     wp_reset_query();     ?>          <?php     wp_reset_query();     $query_stringb= $query_string .'&post_type=documentos-iae';     echo $query_stringb;     $recsa = new WP_Query($query_stringb);     while ($recsa->have_posts()) : $recsa->the_post();      $ids[] = get_the_ID();     the_title();     the_content();     the_tags();     echo get_post_type( get_the_ID() );     echo '
';     endwhile;     ?>      A have even abused of wp_reset_query, but the results in both loops are the same (and do not even result from the params of the first one). When I echo both query strings, they seem to be OK (tag=electricidad&post_type=recomendados and tag=electricidad&post_type=documentos-iae) thanks


title: Wp_localize_script from Shortcode

text: I've been trying for hours and tried several answers from here and Google but still no luck.. need help. I am making a shortcode (slider) and trying to execute a javascript file (for the slider's script) using parameters taken from shortcode's attributes.               function slider_default($atts, $content) {         extract(shortcode_atts(array(           "animation" => '',           "animationspeed" => '',         ), $atts));          print_r($animation);     print_r($animationspeed);          //irrelevant               wp_enqueue_script('my-script', get_template_directory_uri() . '/script/' . 'custom-script.js');         wp_localize_script('my-script', 'slider_vars', array(           'animation' => $animation,           'ssspeed' => $animationspeed           )         );      and in custom-script.js (it is loaded, and it is the correct file / address):               var $an = slider_vars.animation;     var $sss = slider_vars.ssspeed;          console.log($an);     console.log($sss);          jQuery(window).load(function() {       jQuery('.flexslider').flexslider({         animation: $an,         slideshowSpeed: $sss,       });     });      but it doesn't work as expected. print_r($animation) and print_r($animationspeed) results are as expected, but console.log($an) and console.log($sss) results are "fade" (without quotation) and blank, respectively. What did I do wrong and in case this is not the correct way to achieve it, any pointers of what should I do? Please help, thanks in advance. Expected results is: animation: "fade", //String: Select your animation type, "fade" or "slide". Either one, just need to be consistent with the vars below and slideshowSpeed: 7000, //Integer: Set the speed of the slideshow cycling, in milliseconds animationSpeed: 600, //Integer: Set the speed of animations, in milliseconds So in code, it should be:               jQuery(window).load(function() {       jQuery('.flexslider').flexslider({         animation: "slide",         slideshowSpeed: 600,       });     });      and the shortcode:               [slider animation=slide slideshowspeed=600][/slider]      Hi guys, thanks and sorry for taking so long, I lost my internet connection after posting. Yes, it was typos, sorry, I've fixed it (I changed around and even trying things out even when it wasn't working :P). It wasn't a typo error, I've tried copy pasting and spelling them out. More comment: Still struggling with my connection (I don't think this is a CDN-loaded problem BTW, am using a local copy now and the slider actually works, just not as expected). For some reason I can't leave a comment ("WordPress Answers requires external JavaScript from another domain, which is blocked or failed to load."), so I will reply here and try to keep up. @Helga: Yes, it shows and the JS file is loaded correctly (view source-d and clicked it) It shows (strangely, twice) like this:               /* <![CDATA[ */     var slider_vars = {"animation":"fade","ssspeed":"5000"};     var slider_vars = {"animation":"fade","ssspeed":"4000"};     /* ]]> */      Not sure why it displayed twice, and not sure why it has two different values (maybe this is why ..?) As for the animation-speed / slideshow speed, I changed things, but I've been consistent with the arrangement, slide - slideshowspeed and fade - animationspeed. Just change the value and the JS file (animationSpeed and slideshowSpeed).


title: Add a subitem to Woocommerce section

text: I want to add a subitem to "Woocommerce" parent item, below "Orders", this subitem is a custom post type. ![enter image description here](http://i.stack.imgur.com/lWAiM.png) I tried to use `(in $args)`:               $args = array('show_in_menu' => 'edit.php?post_type=shop_order');     register_post_type('my_posttype', $args);      But it doesn't work, I tried with another section ex. 'edit.php?anotherpage' and it works. ![enter image description here](http://i.stack.imgur.com/vFuk9.png) Any idea?!


title: How can I structure my pseudo footer nav code with wordpress codex code?

text:
I'm building my first fully custom wordpress theme, and I'm starting to pull hairs out while trying to write the dynamic footer code! I've tried a bunch of codex this and codex that but can't seem to get the right results dynamically. That said, I've coded it manually to give you a preview of the structure I'm looking for, in hopes that you all can help me fix my mess. Here goes...

Parent1

Child1

Child2

Child3

Child4</a

Child5

Parent2

Child1

Child2

Child3

Child4</a

Child5

Blog

Category1

Recent Post

Recent Post 2

Recent Post 3

Category2

Recent Post

Recent Post 2

Recent Post 3

      It's a pretty logical structure:               Parent1         Child1         ...         Child5     Parent2         Child1         ...         Child5     Blog         Category1             Recent Post1             Recent Post2         Category2             Recent Post1             Recent Post2      `Parent1` and `Parent2` are "Pages"; when on them, their top navigation shows as follows: Parent1 | Child1 | Child2 | Child3 | Child4 | Child5 ... as if they were on a child page titled Parent1. When they are on the `Parent1` page, the url is: `example.com/parent1`, when they are on the `child1` of `parent1`, the url is `example.com/parent1/child1`. The page IDs of the parents are '14' and '19' in that order. And Child1-5 are the only children of their parent (ie: both 14 and 19 have their own child1-5).


title: wordpress taxonomy query posts

text: I have categories and sub -categories with same name.. but I want to show only the categories which is on the top level and not in the sub categories               $qry=query_posts( array(          'post_status' => 'publish',         'post_type' => 'custom_post',         'author' => '12;,         'showposts' => 9,         'tax_query' => array(         array(             'taxonomy' => 'custom_cat,             'terms' => 10,             'field' => 'id'         ) ),         'orderby' => 'id',         'order' => 'DESC'     ));      my categories will be like               test       --news       --magzine     news


title: Place a widget side by side rather than on top of each other

text: I am using the GD Star plugin to monitor what people are rating the apps located on my site, http://tablified.com. I want to place the widgets (the ones that tell me which of the apps are top rated) side by side but unfortunately I can only place the widgets on top of each other. Is there any way I can force them to be side by side. Having the widgets stacked doesn't utilize the space and it just makes the page extremely long and look ugly. I am sure that this can be done with any widget but GD Star is what I am using. Any thoughts?


title: Custom admin columns for ALL custom post types

text:
I have the following function which is working perfectly for my 'video' custom post type to display customized columns in the dashboard. I have decided the way my plugin will work is to have custom post types created dynamically so I no longer know the exact name of the custom post type and I would like to apply this filter to all custom post type if possible.                   function populate_columns( $column ) {  // populate the custom columns         if ( 'thumbnail' == $column ) {             $thumb_array = array('post_type' => 'video');         $thumbnails = get_posts($thumb_array);                 if ( has_post_thumbnail($thumbnail->ID)) {                   echo 'ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';  // link thumbnail to edit page                   echo get_the_post_thumbnail($thumbnail->ID, array(100,100));                   echo '';                   }         }         elseif ( 'duration' == $column ) {             $duration_array = array ('post_type'=> 'video');             $duration = get_post_meta( get_the_ID(), '_my_meta_duration', true );             if ($duration != '') {                 echo $duration . ' mins';         }              }     }          add_action( 'manage_video_posts_custom_column', 'populate_columns' );      I have been going over these two examples from the codex page for get_post_types but I have not been able to figure out how to implement the post_types array into my function. The call to get post types returns the registered post types.               <?php $post_types=get_post_types(); ?>      Output a list all registered post types               <?php      $post_types=get_post_types('','names');      foreach ($post_types as $post_type ) {       echo '
'. $post_type. '
';     }     ?>


title: CSV to WordPress posts: do I have to populate each possible field?

text: I'm planning to import Products in a CSV to WooCommerce. We are still working on an Excel, and we are using the main fields that a product has, following the WooCommerce wordings for the Products (post_title, post_excerpt, post_content, sku, regular_price, images). However, we have no columns for ID for example, or comments_status or post_author. My thinking goes that those fields would be auto-populated by WordPress with a kind of "default", but, hence my question, I'm not sure. Do I have to include ALL the fields that a Product (or Post or Page) has, so the import is successful? If so, is it enough to give an ascening ID to the products? (if the last created ID on the site is 35, assign IDs like so: 36, 37, 38, etc). Thanks for your inputs,


title: Adding a tag to wp_nav_menu

text:
I am using wp_nav_menu and I have a need for custom implementation. The default markup is like this:

About

Alumni Board Members

Partners

      I need there to be a span tag before the closing ul like so:
      Any idea how I can accomplish this using a walker or other function?


title: Javascript not defined but included

text:
I am attempting to implement a javascript function within a page. It is implemented correctly in the header and loads correctly:               <?php function forceNumber2() {         wp_enqueue_script( 'forceNumber2',  get_template_directory_uri() . '/js/forceNumber2.js', array( 'jquery' ) );     }     add_action( 'wp_enqueue_scripts', 'forceNumber2' );          function numberWithCommas2() {         wp_enqueue_script( 'numberWithCommas2', get_template_directory_uri() . '/js/numberWithCommas2.js', array( 'jquery' )    );     }     add_action( 'wp_enqueue_scripts', 'numberWithCommas2' );          function addDashes2() {         wp_enqueue_script( 'addDashes2',    get_template_directory_uri() . '/js/addDashes.js', array( 'jquery' )    );     }     add_action( 'wp_enqueue_scripts', 'addDashes2' );?>      However when I implement the call to the JS I get an error in the console with each keystroke "ReferenceError: forceNumber2 is not defined" and "ReferenceError: numberWithCommas2 is not defined" Implementation:               <form method="post" id="adduser" action="<?php the_permalink(); ?>">
                             Update Yearly Income                             $                             <input class="input" name="first-name" type="text" id="first-name" size="25" value="<?php the_author_meta( 'yearly_income', $current_user->ID ); ?>" style='width:198px; text-align:right' onkeypress="return forceNumber2(event);" onkeyup="this.value=numberWithCommas2(this.value);"                         per year

                             <?php echo $referer; ?>                             <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profile'); ?>" />                             <?php wp_nonce_field( 'update-user' ) ?>                             <input name="action" type="hidden" id="action" value="update-user" />
                     </form>      The console is unclear as to why the function is not defined but yet is loaded correctly in the header.


title: How can i put image to come first than the title?

text:
im editing my posts and when i create one, it comes: ## **TITLE** ## **IMG** **CONTENT** and i want it like this: ## **IMG** ## **TITLE** **CONTENT** \------------------got it---------------------------               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>          <?php $pclass = ($wp_query->current_post === 1)  ? 'middle-post-class' : 'first-last-class' ; ?>     <div id="post-style" <?php post_class($pclass); ?> >
<a href="<?php the_permalink() ?>"><?php the_title(); ?>
          <?php the_content(); ?>
      \--------------------end---------------------------- is the any way i can do it? thanks.


title: Show category images on single product page and product overview page

text: I am running a woocommerce shop and I have products which are in multiple categories. I would like to show the category images on the single product pages. And also on the product overview page. I only found how I can show the category image on the product category page:               <?php      if (is_product_category()){     global $wp_query;     // get the query object     $cat = $wp_query->get_queried_object();     // get the thumbnail id user the term_id     $thumbnail_id = get_woocommerce_term_meta( $cat->term_id, 'thumbnail_id', true );     // get the image URL     $image = wp_get_attachment_url( $thumbnail_id );     // print the IMG HTML     echo '<img src="'.$image.'" alt="" width="30" height="30" />';     }?>


title: WordPress mysqli and PDO

text: Does wordpress code base use mysqli or PDO? I know PDO is superior to mysqli but mysqli is not bad neither. Plus from one of the features of what makes PDO is superior to mysqli ( that is being database agnostic ) does not mean much to WordPress as WordPress will always use mysql server. But binding params with data types is something PDO supports but mysqli does not and it's a good thing. My guts tell me that WordPress does use mysqli but I could not see it in the code base yet. My second question is if WordPress is using mysqli, is it because of speed concerns or is it because back in the earlier days (when WP was being developed), PDO wasn't just there yet?


title: problem in sql syntax

text: problem in Mashable Slider Clone plugin when upload it in server > **WordPress database error:** [You have an error in your SQL syntax; check > the manual that corresponds to your MySQL server version for the right > syntax to use near ')' at line 3] SELECT * FROM wp_mash_fields WHERE docid > IN() code for this is               $sql = "SELECT *         FROM $this->flds         WHERE docid IN(".implode(',' , array_keys($r)).")";     $r2 = $this->db->get_results($sql, ARRAY_A);      > **WordPress database error:** [You have an error in your SQL syntax; check > the manual that corresponds to your MySQL server version for the right > syntax to use near 'LIMIT 0,999' at line 3] SELECT SQL_CALC_FOUND_ROWS > DISTINCT wp_mash_documents.* FROM wp_mash_documents WHERE > wp_mash_documents.type='image' ORDER BY wp_mash_documents. LIMIT 0,999; code for this is               function get($type, $page = 0, $limit = 10, $sort = 'modify_time', $ord = 'ASC', $rel = null, $dorder = false, $s = null)     {     $ll = $page * $limit;     $docs = $this->docs;     $flds = $this->flds;     $rels = $this->rels;          $inner = array();     $where = array();     $order = '';     // get ids     $sql = "SELECT SQL_CALC_FOUND_ROWS DISTINCT $docs.*".($dorder? ",$rels.dorder" : "")." FROM $docs";     switch ($sort) {         case "title":         $inner[$flds] = array("$docs.id", "$flds.docid");         $where["$flds.name"] = "='title'";         $order = "$flds.value_text $ord";         if (isset($s)) {             $where["MATCH ($flds.value_text)"] = " AGAINST ('$s')";         }


title: How to paginate attachments in a secondary query as gallery?

text:
I have this code that shows all images attached to my post-type. Is there a way to paginate those? I have like 25 pics and I wan't to avoid scroll as much as I can. Code:
     <?php         $attachments = get_posts( array(         'post_type' => 'attachment',        'post_mime_type'=>'image',        'posts_per_page' => -1,        'post_status' => 'any',        'post_parent' => $post->ID)     );     if ( $attachments ) {     foreach ( $attachments as $attachment ) {         $src = wp_get_attachment_image_src( $attachment->ID, full);              $html = '';         $html .= wp_get_attachment_image( $attachment->ID, 'gallery-thumb') .'';         echo $html;     }     }     ?>
      Thanks!


title: How to store page visit counts?

text: I am working on a project, which requires a page visit count to be shown on the single post. How can I do this in wordpress, I am guessing, that I have to store them in the same wordpress db?


title: Custom WP_Query not working correctly

text:
OK, So I have created a custom WP_Query that gets the post_type `post` and outputs it as a styled list. It works well and outputs the styled list but then underneath it displays all the posts again but in a completely different format (unstyled).               <?php          // get all post types     $args = array (         'post_type'              => 'post',         'post_status'            => 'publish',         'pagination'             => true,         'paged'                  => (get_query_var('paged') ? get_query_var('paged') : 1),         'posts_per_page'         => 20,         'order'                  => 'ASC',         'orderby'                => 'date',     ); ?>     <?php $wp_query = new WP_Query($args); ?>          <?php if ($wp_query->have_posts()): ?>         <?php while($wp_query->have_posts()): $wp_query->the_post() ?>

                     <a href="<?php the_permalink() ?>" class="fancybox">                         <?php the_post_thumbnail('medium'); ?>

<?php the_title() ?>
                     <?php the_excerpt() ?>                                               <a href="<?php the_permalink() ?>" class="btn btn-primary">View full story                     <?php if(get_field('comments_enable') !== false): ?>                         <a href="<?php the_permalink() ?>#disqus_thread" class="btn btn-default"> Comments                     <?php endif; ?>

              <?php endwhile; ?>

                 <?php previous_posts_link(' Previous page'); ?>

                 <?php next_posts_link('Next page '); ?>

          <?php else: ?>
No news right now, please check back later.
          <?php endif; unset($wp_query); wp_reset_postdata(); ?>      This is all in a template partial and called using the `get_template_part()` method. If I assign the WP_Query to a variable other than `$wp_query` it doesn't double up but I need it to be `$wp_query` for the pagination links to work. I am also unsetting `$wp_query` and resetting the post data at the end of the loop. Puzzled and I hope you can help!


title: Plugin menu replaced by another plugin?

text: Sorry if my title is not clear as i'm not sure what i'm asking. Haven't seen this issue in my searches on the stack-exchange sites. Note I am not the author of either plugin. So the issue I am having is that I had a plugin, activating the plugin put that plugins icon/menus directly underneath the POST tab/menus in the left hand navigation in admin which is fine. The issue is that i installed another plugin, which once activated is put right under the posts tab "overwrites" the tab location on the left hand navigation, and thus there is no more icon/menu from the previous plugin. It's as if they both are dedicated to the same array location. Is there a way to fix this situation?


title: Vertical dropdown menus

text:
![menu bar](http://i.imgur.com/emIV7NK.jpg) ![menu bar](http://s24.postimg.org/3zmm9jazn/menu.jpg) I am working on converting an HTML/CSS template to a WP theme on my local machine. I am unable to add vertical drop down sub-menus to the main menu in the theme. The HTML for the menu is:

Home

Eternal Sharing

Eternal Resource

Event Calender

Gallery

FAQ

Blog

Eternal Shoppe

      My code in the functions.php is:               add_action( 'init', 'register_my_menus' );     function register_my_menus() {         register_nav_menus(             array(                 'menu-1' => __( 'Primary Menu' ),             )         );     }?>      The `header.php` code is :
             <?php              wp_nav_menu( array( 'theme_location' => 'menu-1' ) );              ?>       I have also created the menu and sub menus from the dashboard and named the menu there as 'Main_Menu'. But still the submenu is not appearing as a vertical drop down. The same dashboard settings are working perfectly for the TwentyTwelve theme. Kindly advise me.


title: Woocommerce Attributes pulling in wrong data

text: My Problem is very strange - I don't fully understand all the aspects of woocommerce just yet and am still fiddling with things to understand it. I'm trying to pull in the size attributes for each product - I'm succeeding in pulling in the attributes but I'm pulling in all of them for every product. Not the one's I'm adding to the product via the custom field. Example of the attributes that should be pulled in link But I'm pulling all 6 of my created attributes not the one's selected for each product. link The code I'm using to pull in the attributes is the following               <?php              $terms = get_terms('pa_size');             foreach ( $terms as $term ) {             echo "<li>" .$term->name. "</li>";              }      ?>


title: When submitting the form site.com/blog/wp-admin it goes to site.com/wp-admin

text: I have 2 wordpress websites. One at `site.com` and the other at `site.com/blog`. I want to go to administration of `site.com/blog`, but when I point to `site.com/blog/wp-login.php` or `site.com/blog/wp-admin/` and login, it goes to `site.com/wp-login`!!!! (Both wordpresses have the same user/passwords) Please help me stay at when I point the browser to!


title: Trying to create hierarchy between 3-4 custom post types

text: I am trying to think of a way to create a certain hierarchy between several post types. I was looking at `term_taxonomy` table, and its seem to have the capability to achieve that. I have a feature to create custom post type on the fly why you can select a parent from the other post type. those parents will have several uses. they could serve as categories authors or whatever other name the user has gave it. i have several templates that the user can chose from. in those templates this hierarchy comes to life. I know i can do it ugly - with either outside table or custom fields. i was wondering if there's a more "WP way" to achieve this ? Thanks


title: pagination/prev and next page links not showing

text:
I'm having trouble getting my pagination links to work, or even show up. I've tried several variations of the code, but here is what I have in home.php:               <?php get_header(); ?>      <?php get_sidebar(); ?>
         <?php if (have_posts()) : ?>               <?php while (have_posts()) : the_post(); ?>

<a href="" rel="bookmark" title="Permanent Link to                  <?php the_title(); ?>"><?php the_title(); ?>

<?php the_time('F jS, Y') ?>

             <?php the_content('Read the rest of this entry »'); ?>             <img src="<?php bloginfo('template_directory'); ?>/img/dots_small.png" class="divider" alt="post divider">

             <?php                 previous_post_link('« %link');                 next_post_link('%link »');             ?>
         <?php endwhile; ?>               <?php else : ?>
Not Found

Sorry, but you are looking for something that isn't here.
               <?php include (TEMPLATEPATH . "/searchform.php"); ?>           <?php endif; ?>
           <?php get_footer(); ?>


title: BBPress AJAX problem

text: I am using version 2.1.3 and I need ajax function in user profile. Problem is that ajax is running fine when the user is "ADMIN" or user with ID 1(my guesses). When I want to use ajax with another user it just wont work. Through ajax function I get error 404. I guess this is something with user permissions... Can someone help me ? P.S When I installed 2.2 version it working fine. But 2.1.3 has old structure and I need the old one for working. CODE UPDATE:               Click on IT!           I noticed that in function bbp_parse_query which is in bbp-template- functions.php, if I change value of $posts_query->is_404 = false; to $posts_query->is_404 = TRUE; it working but I dont know why ...


title: Use admin options from parent theme in child theme

text: I am creating a child theme for the first time. I have created `style.css` (and imported parent theme's `style.css` in it) and also some new files and additional functions in `functions.php`. Now, I have copied `index.php` from parent theme to child theme However still some of the parent theme's admin options are not being picked up in child theme. Specifically, I get a fatal PHP error that a function is not recognized when I load `index.php` (after setting child theme as the theme to be used by WP).   1. Do I even have to copy `index.php` from parent to child?   2. If I want basically parent's `index.php` to be loaded then do I leave child theme's index.php blank? Or do I import the parent's `index.php` (in the child theme's `index.php`)?   3. There are some admin options added for the child theme (in addition to those in parent theme) – now do I set the admin options (of parent theme) by configuring the parent theme in WP admin?    4. Is it possible to show the admin options pertaining to the parent theme within the child theme's admin options? So that I need not configure the parent theme's options separately from those in the child theme? How do I do this? Also do you recommend this approach (point 4) or the previous approach (separately configuring parent theme's admin options within the parent theme itself (point 3)?


title: Post Thumbnail on Single (if elseif else)

text:
I have the following news articles on the frontpage of a website I'm currently working on: ![Screenshot](http://i.stack.imgur.com/AQpIc.png) For this I'll need to write two simple PHP `if statement`s, which I've already done successfully, but on the `single.php` it gets troublesome for me. On the frontpage I have the following to display the two news articles in the screenshot:
     <?php query_posts('cat=45&posts_per_page=1'); if (have_posts()) : while (have_posts()) : the_post(); ?>
             <article <?php post_class() ?> id="post-<?php the_ID(); ?>">                      <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { echo ""; } ?>
                     System Update                     <a href="<?php the_permalink() ?>">
<?php the_title(); ?>
                     <?php the_time('F j, Y') ?>

     <?php endwhile; endif; ?>          <?php query_posts('cat=1&posts_per_page=1'); if (have_posts()) : while (have_posts()) : the_post(); ?>
                  <article <?php post_class() ?> id="post-<?php the_ID(); ?>">                      <?php if ( has_post_thumbnail() ) { the_post_thumbnail(); } else { echo ""; } ?>
                     Information                     <a href="<?php the_permalink() ?>">
<?php the_title(); ?>
                     <?php the_time('F j, Y') ?>

     <?php endwhile; endif; ?>      Pretty straight forward. However, on the `single.php`-page I get a problem. I have the following:
<?php if ( in_category("1") ) { the_post_thumbnail(); } elseif ( in_category("45") ) { echo ""; } else { echo ""; } ?>
      It's the first time I've ever had to write a statement like this, and I really can't sort it out.


title: Getting the number of nested shortcodes

text: [slider] [img] [img] . . [img] [/slider] Is there a way that I can get the number of nested shortcode in a parent shortcode Thanks


title: How to make comment text field un-required?

text: My requirements are bit different I was able to hide email and website field with filter but what I want to know is there a way to make comment text un- required when I am giving comment without comment text area filled its giving me error that comment is required please guide me how i can make comment text unrequired.                      add_action('pre_comment_on_post', 'dump_comment');            function dump_comment($post_id, $author=null,     $email=null) {            $comcnt = $cmntcount = comments_number( '#0', '#1', '#%' );            $comment = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;            if (!$comment) {            $_POST['comment'] = 'Design' . $comcnt;                  }             }      Updated and working code.                     add_action('pre_comment_on_post', 'dump_comment');           function dump_comment($post_id, $author=null, $email=null) {            $comment = ( isset($_POST['comment']) ) ? trim($_POST['comment']) : null;            if (!$comment) {            $_POST['comment'] = 'Design #' . get_comments_number();                 }             }      making the comment unique everytime. by adding the value of comment count.


title: Major cache but only on wordpress site

text: I have disabled all caching plugins, and i have cleared my browser cache, removed my temp browser files - how come i still not seeing my changes going trough on my wordpress page? I wait 20min they eventually show up but not really a good workflow Any pinpointers - could i set it up in a htaccess file or is it only on the server the magic happens? I checked my dev tools network tab for info about cached elements and everything is new its a 200 Return value on my calles in the browser I even did a flush of the DNS **EDIT** The changes i make is markup changes like adding an extra div and give another an extra class maybe a additional widget box


title: stop blog page from using index.php?

text: I have a static homepage with a custom template I.E hompage.php the blog loop is set to a static page named blogg, it uses the index.php page as a template, there a collection of other pages using the index.php as the default template so i am reluctant to change it. is there anyway to stop the blogg page from using index.php and give the blog page it's own template page such as blogg- template.php? kind regards Chris