title: array of objects to do_action, callback gets singular object?

text: So I was passing an array of objects through an action today, no biggy, and things were working fine. Until I was iterating over one of the arguments to a callback and started getting errors. The only difference was that the passed array to the `do_action` call only had a single object in it. Confused by this, I simply didn't call the action unless the array had a count of over 1 (the action is caching something FYI). Looking into the function definition I found this on line 411 of wp- includes/plugin.php               if ( is_array($arg) && 1 == count($arg) && isset($arg[0]) && is_object($arg[0]) ) // array(&$this)      which is what was causing my array of a single object to become just an object. To me this is really weird, if I pass an array to an action then I expect an array on other side. I'm using WordPress 3.7.1 and am wondering if anyone knows _why_ do_action has this behavior? A ticket or a link to something in the wordpress repository would work as an answer for me. EDIT: Request for code and actions: I create an action within my code like so:               add_action('hs_cache_merchants', array('HoneyCache', 'cacheMerchants'), 10, 1);      It is called like so within a method that retrieves data from the database, where `$merchants` is an array of objects.:               do_action('hs_cache_merchants', $merchants);      And then my callback registered with the add_Action:               public static function cacheMerchants($merchants){         if(!is_array($merchants)){ /* WordPress will convert an array of a single object to just the object. */             $merchants = array($merchants);         }              set_transient(HoneyMerchant::CACHE_CURRENT_MERCHANTS_KEY, $merchants, HoneyMerchant::CACHE_CURRENT_TIME);     }      If I modify my prototype to be               public static function cacheMerchants(Array $merchants){      then I will get the error:                PHP Catchable fatal error:  Argument 1 passed to HoneyCache::cacheMerchants() must be an array, object given      I used print_r in the function that calls `do_action` and noted an array with a single object in it, this only happens if the array has 1 item in it, since that's part of what that `if` in the core checks.


title: LaTeX for WordPress strips codes in loop

text: Installed LaTeX for WordPress and added post: > Some text $$\alpha+\beta\geq\gamma$$ other text. I see that equation in post page, but it stripped in loop. How can I see equation in loop too?


title: Pagination custom query

text: I am trying to make a custom page template that shows the most viewed posts. I can return posts but I am having trouble figuring out how to paginate it. Here is what I have:               $args = array('orderby' => 'meta_value_num', 'meta_key' => 'post_views_count', 'posts_per_page' => 36 );                 $loop = new WP_Query( $args );                 while ( $loop->have_posts() ) : $loop->the_post();      I tried:               $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;                  $args = array('paged' => $paged, 'orderby' => 'meta_value_num', 'meta_key' => 'post_views_count', 'posts_per_page' => 36 );                 $loop = new WP_Query( $args );                 while ( $loop->have_posts() ) : $loop->the_post();      but my pagination still doesn't show up. I am wondering if it has to do with my pagination function or the way I am setting up my query. I just call my pagination function below the query, it all looks like this:               <?php                 $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;                  $args = array('paged' => $paged, 'orderby' => 'meta_value_num', 'meta_key' => 'post_views_count', 'posts_per_page' => 36 );                 $loop = new WP_Query( $args );                 while ( $loop->have_posts() ) : $loop->the_post();?>                     <?php get_template_part( 'content', get_post_format() ); ?>                 <?php endwhile; ?>             <?php wp_reset_postdata(); ?>          <?php pagination(); ?>      This is my pagination function:               if ( ! function_exists( 'pagination' ) ) :         function pagination() {             global $wp_query;                  $big = 999999999; // need an unlikely integer                  echo paginate_links( array(                 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),                 'format' => '?paged=%#%',                 'current' => max( 1, get_query_var('paged') ),                 'total' => $wp_query->max_num_pages,                 'mid_size' => 1,                 'prev_text'    => __('«'),                 'next_text'    => __('»'),                 'type'         => 'list'             ) );         }     endif;      Any help would be greatly appreciated.


title: Change WP-LOGIN and WP-SIGNUP for any request

text: I want to rename `wp-login.php` and `wp-signup.php` for any request I tried this               RewriteRule ^login$ /wp-login.php [L]     RewriteRule ^signup$ /wp-signup.php [L]      but when someone insert a wrong password his redirected from `/login/` to `/wp-login.php` and in the Second page of registration in Multisite is redirect from `/signup/` to `/wp-signup.php`


title: Auto Nofollow attribute in custom field links. How?

text: I have a wordpress network. All the contents in my network are user generated. All posts links are now dofollow. I want to change it to nofollow. My site uses plugin for custom fields. I removed the default description area. So i cannot use the_content function. I use custom fields for all. I tried many auto nofollow plugins. But its not working in my custom fields. Can anyone help me? Is there any function code available? I just want               My Link      to               My Link      Thanks


title: Use Custom Post Type as Custom Field

text: I want to create a custom post type for store that having all store names and it is working. Now I want to fetch the all stores in a select box in every new post of WordPress, then selected store name will used as custom field for that post. I want to save this store name as meta value for this post in `wp_postmeta` table. Every custom post having the post_type='store' so how I write a function to fetch all post by store type.


title: How can I display sticky posts at first in wp_query?

text:
I'm looking for a long time, but I could not find a solution. I'm not a coder. Please help me. Here is my wp_query code;               $my_query = new WP_Query('category_name=animals&showposts=10');     while ($my_query->have_posts()) :          $my_query->the_post();         $do_not_duplicate = $post->ID; ?>
<a href="<?php the_permalink()?>"><?php the_title(); ?>
<?php      endwhile; ?>


title: Post archive pages bringing me to a 404 page

text:
When I try to use `next_posts_link()` and `previous_posts_link()` in my `archive` posts page I got a `404 error` page. I'm using this permalink setting `/%category%/%postname%` and working well for all pages like `site.com/contacts` or posts like `site.com/category/this-is-a- post-tile`. The only problem is in archive posts, for test I've set the number of posts per archive by 1 per page and trying with three articles to change the pages. The paginator is simple this:               <?php get_header(); ?>
         <?php if (have_posts ()) : while (have_posts ()) : the_post(); ?>             <article class="left-icon article" id="post-<?php the_ID(); ?>">                 <a class="permalink" href="<?php echo get_permalink();?>">
<?php the_title(); ?>

<?php echo __('di:').' '.get_the_author();?> / <time datetime="<?php echo get_the_date('Y-m-d H:i:s');?>"><?php echo get_the_date();?></time>

<?php the_excerpt(); ?>

                 <a class="button" href="<?php echo get_permalink();?>"><?php echo __('Continue to article'); ?>

         <?php endwhile; endif; ?>                      <?php             // PAGINATOR             next_posts_link();             previous_posts_link();             ?>
              <?php         // some menu here         ?>          <?php get_footer(); ?>      I'va always had mistakes with permalinks and pages, probably I miss some base concept of `WordPress` about it. How can I do to make it work and let WordPress paginate `blog` pages correctly?


title: Add specifications table for products page

text: I have a WordPress issue that has been keeping me busy for a few days. I'm currently building a website for a client. This website will show products and each product page also has a table with specifications of the product. The specifications will be shown in a table like this: ![http://preview.navinpoeran.com/images/tabel.jpg](http://i.stack.imgur.com/Smkj4.jpg) What would be the best way to implement this in the template, so the client can add data for each product from the back-end? Each product gets its own page of course. For example: iPhone 4S   iPhone 5   etc. (no it's not an Apple-related website, just an example)


title: how to disable user confirmation from administration?

text: I have a multi-site network, on one of the sites the access is restricted to registered users, and only an administrator can create users. I was asked to get rid of the confirmation email sent to new users, and I know you can select an option to add the user without sendind the email. The problem is, that option is only available to super administrators (me) and not regular administrators. Is there a way to add the new users without sending a confirmation email? I can get rid of the email, but I also need to remove the activation link, I need the users to be automatically added. I've looking for hooks but I can't find anything helpful, any ideas?. P.S. Every user is added from the _Add new user_ menu in the backend.


title: How can I add rel="nofollow" attributes on RSS widgets?

text: By default WordPress does not appear to have the option to add `rel="nofollow"` attributes on the RSS widgets.               <li>         <a class="rsswidget" href="http://news.google.com/news/url...">             The 60-Something Entrepreneur         </a>     </li>      How can I make it so my RSS feed links have the `rel="nofollow"` attribute?


title: Sort query_posts for Parent Pages to menue order or the count?

text: thanks to a member here i display my Parent Pages in a 2 column grid with title and excerpt. But for some reason i can't figure out how to sort all 5 Pages by the menu order for example or the order number i assigned. i display them by using query_posts( 'post_type=page&post_parent=0' ); so that the child Pages won't displayed. but i can't figure out how to order them.. Any ideas??? thanks in advance! Dan


title: Somehow adding to "Insert Into URL" posts are contradicting each other

text:
I added a second upload image ( doc_thumb_box ). They both work perfectly independent of each other. But when the second one is added, the first one (doc_uri_box ) no longer pastes the value of the URL into the box. Instead **both** boxes, if there is any content in them, become _blank_. Is there something obvious that is contradicting the other?               public static function doc_thumb_box() {     global $post;          $thumb = get_post_meta( $post->ID, 'upload_image', true );          function my_admin_scripts() {     wp_enqueue_script('media-upload');     wp_enqueue_script('thickbox');     wp_enqueue_script('my-upload');     }          function my_admin_styles() {     wp_enqueue_style('thickbox');     }          if (isset($_GET['page']) && $_GET['page'] == 'my_plugin_page') {     add_action('admin_print_scripts', 'my_admin_scripts');     add_action('admin_print_styles', 'my_admin_styles');     }          echo 'Enter a URL or upload an image for the thumb.';     echo '
';     echo '
';     echo '';     echo '<input id="upload_image" type="text" size="36" name="upload_image" value=" ' . $thumb . '" />';     echo '<input id="upload_image_button" type="button" value="Upload Thumb" />';               echo "\r\n";          }          public static function doc_uri_box() {         global $post;              $uri = get_post_meta( $post->ID, 'wpa_upload_doc', true );         echo "";        echo '
Please provide the abosulte url of the file (including the http://):
';         echo '<input type="text" id="wpa_upload_doc" name="wpa_upload_doc" value="' . $uri . '" size="25" style="width:85%" />';         echo '<input class="button" id="upload_doc_button" type="button" value="Upload Publication" alt="Upload Publication" />';         echo "\r\n";     }      **UPDATE** For the `doc_uri_box()` method, I have found that the `window.send_to_editor` code block is never executed! Strange indeed..


title: Custom Shortcode that includes filtering by tag

text: Within a custom shortcode, how do I filter the posts that come back from get_posts() such that only posts with Tag = "xyz" are returned? Here is what I have in my shortcode currently:               $args = array(         'post_type'         => $type,         'category_name'     => $category,         $type . '_category' => $custom_category,         'numberposts'       => $numb,         'orderby'           => $order_by,         'order'             => $order,         'suppress_filters'  => $suppress_filters     );          $posts = get_posts($args);      Is there something that I should be adding to the $args? Or is there some function I should be calling before/after the get_posts() call?


title: dynamic enquiry form

text: I'm thinking to use **Contact Form 7** to create a simple enquiry form like : name, phone, email. This enquiry form will be displayed on every portfolio page. What I want to do is to retrieve also from the user the page title from where he submitted the enquiry, because I will have more than 50 posts and I don't want to create 50 different forms for each post. Any suggestions on how to achieve this ? Thank you!


title: Declaring a var, placing it in a query and using the output of the query?

text: So i'm wondering if it's possible to declare a `variable` that you'd place in a `query` to then use it in a `update_post_meta` function? This is how I tried to do it. First off I made a connection to another db where the info comes from to than query out the results(Tested in SQL works) like so:                global $newdb;       $newdb = new wpdb('....', '....', '....', '....');       $newdb->show_errors();       $column1  = "member_name";       $column2  = "memberID";       $meta_key = "field_12312ewrwe12312";       $result   = $newdb->get_results("SELECT ".$column1.",".$column2."  FROM members");         $columnq  = $newdb->get_results("SELECT ".$column1." FROM members");       $columnq2 = $newdb->get_results("SELECT ".$column2." FROM members");      Most notably `$columnq` and `$columnq2`. I than used the query strings to fetch the data in a `update_post_meta` function/button and thought this should've worked since blankly putting `$column1` and `$column2` after clicking submit only adds the actual `value` it contains so say I get a new post called `member_name` each time I submit. The code:               <form action="" method="post">         <input type="submit" value="Test" id="submit" name="submit">         <?php              if(isset($_POST['submit'])){             $postargs = array(                 'post_title'   => $columnq,                 'post_status'  => 'draft',                 'post_type'    => 'bedrijf'             );                  $thisid = wp_insert_post ( $postargs, true);                  if ( is_wp_error($thisid) ) {                 return get_error_codes();             } else {                   update_post_meta( $thisid, $meta_key, $columnq2);             }         }            var_dump($columnq);            var_dump($columnq2);         ?>           </form>      P.S. Yes `var_dump` shows the correct information. EDIT: Added the `var_dump`. The information output by the `var_dump` is far to many, instead I will post a piece of both. Columnq:               array(460) { [0]=> object(stdClass)#1026 (1) { ["member_name"]=> string(18) "Some information" }      Columnq2:               array(460) { [0]=> object(stdClass)#1486 (1) { ["memberID"]=> string(1) "0" }       EDIT2: I also placed the `var_dump` into the button itself(Under `update_post_meta`) and it output the exact same and correct information. Yet in the back code it adds only one post which is empty with also `(no title)` as name.


title: Remove [gallery] shortcode altogether

text: I used remove_shortcode('gallery'); ...the gallery is gone, but the shortcode is visible in the text. How do I remove sitewide? I've searched for sql queries, but no solution fixes my specific problem. ![gallery shortcode still visible](http://i.stack.imgur.com/3GWzB.png)


title: How do I show errors after validation with a custom form frontend?

text:
I'm struggling to understand how I should achieve a decent error-handler at frontend (serverside). The code is written in functions.php in a specific theme (if that matters). Down below a custom post type named pupil is created upon submit.               $pupil = new Pupil();     add_shortcode('wppb-register', array($pupil, 'frontEndRegistration'));          //Check if visitor is trying to save a new pupil     $pupil->checkFrontEndRegistration();      In the pupil-class I show (return) this content (form):               //Show public register-form     public function frontEndRegistration($atts, $content="", $errors = null) {             $class_errors = array();              if (is_array($errors) && !empty($errors)) {                  foreach($errors as $key=>$err) {                 if ($err === true) {                     $class_errors[$key] = ' error';                 }             }                    }         $content .= '         <form id="adduser" name="adduser" method="post" action="">' .                 '

'.$this->getRelatedCoursesPupil(null, array('args' => array('fetchContent' => 'returncontent')))         .  '

             Förnamn*	             <input name="first_name" id="first_name" value="" class="regular-text' . $class_errors['first_name'] . '" type="text">

             Efternamn*	             <input name="last_name" id="last_name" value="" class="regular-text' . $class_errors['last_name'] . '" type="text">

             Ålder*	             <input name="age" id="age" value="" class="regular-text" type="text">

             E-post	             <input name="email" id="email" value="" class="regular-text" type="text">

             Telefon hem*	             <input name="homephone" id="homephone" value="" class="regular-text" type="text">

             Mobiltelefon*	             <input name="cellphone" id="cellphone" value="" class="regular-text" type="text">

             Adress	             <input name="adress" id="adress" value="" class="regular-text" type="text">

             Postnr	             <input name="postnr" id="postnr" value="" class="regular-text" type="text">

             Ort	             <input name="ort" id="ort" value="" class="regular-text" type="text">

             Övrigt	             <textarea name="description" id="description" class="description"></textarea>

         <input type="hidden" name="action" value="newpupil-frontend" />         ' . wp_nonce_field( 'newpupil-frontend', 'newpupil-frontend') .               '

         <input type="submit" value="OK" name="addusersub" id="addusersub" />         </form>         ';              return $content;     }      Here I'm doing the actual checking before saving it to database.               //Save pupil     public function checkFrontEndRegistration() {                  if( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "newpupil-frontend") {                      //Required fields                 $errors = array();                 if (!isset($_POST['first_name']) || strlen($_POST['first_name']) == 0) {                     $errors['first_name'] = true;                 }                 if (!isset($_POST['last_name']) || strlen($_POST['last_name']) == 0) {                     $errors['last_name'] = true;                 }                 if (!isset($_POST['age']) || strlen($_POST['age'] == 0)) {                     $errors['age'] = true;                 }                          if (!isset($_POST['homephone']) || strlen($_POST['homephone']) == 0) {                     $errors['homephone'] = true;                 }                  if (!isset($_POST['cellphone']) || strlen($_POST['cellphone']) == 0) {                      $errors['cellphone'] = true;                 }                                 //Add new pupil-cpt into post-table when there are no errors                 if (empty($errors)) {                     //Remove hook temporarily                     remove_action( 'save_post' , 'postsubmitted');                          $pupil = array(                         'post_title'    => 'unregistered',                         'post_status'   => 'private',           // Choose: publish, preview, future, draft, etc.                         'post_type' => 'pupil',                         'post_author' => 5500                                        );                     //save the new post and return its ID                     $post_id = wp_insert_post($pupil);                           //Save everything relevant for this new pupil                     saveform_db($post_id, $_POST, true);        //True says that it's frontend-saving                          //Rehook temporarily removed hook                     add_action( 'save_post' , 'postsubmitted');                 }                 else {                     throw new Exception('Pupils must be entered');                     //$this->frontEndRegistration('', '', $errors);                 }                  }              }      It works fine, but I can't figure out how to show the errors when user hasn't typed in required fields. Instead of `throw new Exception(Pupils must be entered);` I want to show the same `frontendRegistrationform()` but with the errors that are set when there are no value in the required fields. I guess I oould use sessions, but is there any better way?


title: How to make WordPress use protocol indepentent upload files?

text: I am using `FORCE_SSL_ADMIN` in `wp-config.php` so everytime I upload a new image and inserted into the post, it is using SSL version e.g.               <img src="https://www.example.com/wp-content/uploads/2013/01/test.png" ..      My blog is using HTTP in the public side, so how to make the upload path as rotocol independent, e.g.               <img src="//www.example.com/wp-content/uploads/2013/01/test.png" ..


title: Adminstering Large Number of Wordpress Sites

text: I have inherited a situation where our team supports over 100+ separate WordPress installs for various clients. I am looking to make the whole process a bit more efficient. For all of those in a similar situation of managing a large number of Wordpress installs: Are there any tools or techniques that are helpful? The thought of migrating all of these to 3.0.2 by logging in or writing a script from scratch both sound particularly unappealing.


title: Forcing all posts associated with a custom post type to be private

text: Does anyone know of a way to add code to the functions.php file which will automatically force all posts belonging to a custom post type to be "private" and/or "password protected" with a default password set? I am specifically referring to creating a new post or editing an existing post thus ensuring a post belonging to a specific custom post type never changes...


title: register_post_type for Pages?

text: Been reading this site and Wordpress Codex and I see there is a function to enable custom type of pages in Wordpress. How can I do the same to enable for Pages ? Or at least get the options for the posts to appear for placing the posts under Pages ?


title: i want multiple blog, themes and database

text: i am running http://article-stack.com. I want to create a separate blog say help.article-stack.com. Again, it should have 2 portion. One for discussion and another for information. I am planning to install wordpress in 2 more direcotries. Both will have separate database. Tell me is you have some better solution It will be helpful if you can suggest me some free theme for discussion. I am aware with twitter like theme p2. But it is not suitable for me. I want stackexchange type of site. So if someone helps others they must get their credit. It helps to motivate them and others. Thanks in advance


title: Stuck on maintenance mode

text:
I put my site in maintenance mode using this hook in `functions.php`,               function activate_maintenance_mode() {         //If the current user is NOT an 'Administrator' or NOT 'Super Admin' then display Maintenance Page.         if ( !(current_user_can( 'administrator' ) ||  current_user_can( 'super admin' ))) {             //Kill WordPress execution and display HTML maintenance message.              wp_die('
Sitio en mantenimiento

Nuestro sitio esta actualemente en mantenimiento.
Ya volvemos!
', 'mantenimiento');         }     }     //Hooks the 'activate_maintenance_mode' function on to the 'get_header' action.     add_action('get_header', 'activate_maintenance_mode');      and now I can't return back to normal mode. **EDIT:** The problem had to be with W3 Total Cache plugin.


title: Seamless integration between WordPress and BBpress

text: I have a WordPress site at domain.com and a BBPress install at domain.com/subfolder the wp site has a menu item that goes to the forums, and I'd like the header to be the same between the two, so that they can navigate back to the main site. how can I do that? thanks


title: Check if there is an post to be published in future

text: I need to check if there is an post to be published in future. I want to use WP functions, no directly access to database via mysql_query. Has anyone some sample of code?


title: Managing Images for a WordPress Blog: Picasa or Flickr?

text: _( **Moderator's note:** The original title was "Is it good to use picasa web album for images in wordpress blog?")_ Is it good to use Picasa web album for post's images in WordPress blog? What are pros and cons? Which one (Flickr or Picasa) is more suitable for blog post's images?


title: List Posts by Category for a Non-Zero, Non-NULL Custom Field Value?

text:
_( **Moderators note:** The original title was: "Need help identifying and looping through categories where posts have custom field set")_ I need to loop through my categories however I need to limit the categories to those categories that include posts where the custom field of `price != 0` or `null`. What is the best way to handle this? Currently I've got this...
               <?php          $categories=get_categories();     foreach($categories as $category) {       $myColumnCount = 1;     ?>
<a href="<?php bloginfo('url'); ?>/category/<?php     echo($category->slug); ?>"><?php echo($category->name); ?>
          <?php     query_posts('cat='.$category->cat_ID.                 '&posts_per_page=-1&orderby=title&order=ASC');     ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                    <div id="" class="span-1 <?php if ($myColumnCount==6) { echo "last"; } ?> thumb20" >         <a class="thumb" href="<?php the_permalink(); ?>" rel="bookmark" title="Link      to <?php the_title(); ?>" ><?php echo the_post_thumbnail( 'thumbnail' ); ?>
               <?php if ($myColumnCount == 6) {         $myColumnCount=0;     } ?>          <?php $myColumnCount = $myColumnCount+1; ?>          <?php     endwhile;     endif;     echo '
';     ?>     <?php } ?>          <?php $wp_query = $temp_query; ?>


title: File Storage Plugin (For Individual Users)?

text: I have a client who has a Wordpress blog and he'd like to give a small number of clients their own user accounts in which, ideally, they'll be able to access a specific set of files. These files would only be visible to users to whom the files are assigned by the site administrator (for lack of a better word), not all users. In other words, if Bob and Susan both had Wordpress accounts on this site, the site admin would be able to upload a file and assign it to Bob and that Susan would not be able to see. Bob and Susan wouldn't need to add files, just have access to files provided by the site admin. I've Google'd around a bit for a plugin that will allow this, but I'm not finding anything. Does such a plugin exist?


title: Include files in child theme functions file

text: Typically in my theme function file I'll require other files to keep things neat.               require_once("foo.php");      Now working in a child theme I'd like to do that same. I'm adding custom admin options and it seems impossible to include code. I've echoed out the path to make sure I'm calling the right file and it is calling the proper location but nothing inside that file seems to run. The code runs fine if placed inside the child theme functions file.


title: Proper syntax to add boolean in array()

text: Conditional php question... I have an array and need to add an OR boolean to check for an additional category 4. Don't know the syntax to use for adding more category id's. I've tried array('cat' => -9, -4, but that only recognizes first id.               query_posts(              array_merge(                 $wp_query->query,                 array('cat' => -9,                       'ignore_sticky_posts' => 1,                       'post__not_in'  => $sticky,                       'posts_per_page' => get_option('posts_per_page'))


title: How to obtain a group of post meta and assign each meta to other variables?

text: I saved a group of data in post meta, now I need to get the meta and use them as other items. My code not working, please help me correct it, thanks!               $boxes = Array( 'height', 'width' );          foreach ( $boxes as $data ){     $project = get_post_meta($post->ID, $data, true);     }          $item_a = $project->height;     $item_b = $project->width;


title: Plugin: connect to external database without showing password

text: I am creating a WP plugin, which shows information from an external database. The plugin will be distributed, the external database is on my own server. I know the following code will connect to my database:               $newdb = new wpdb($DB_USER, $DB_PASSWORD, $DB_NAME, $DB_HOST);     $newdb->show_errors();      But I do not want to show my password to everyone who downloads the plugin. I searched on Google and many forums, but I could not find a way to do this safely. I hope someone can push me in the right direction.


title: Execute certain function on GET request

text: I am currently designing a plugin which will export some data in admin panel, only when a GET parameter `export=data` is passed. In normal PHP it will do something like:               <?php      if(isset($_GET['export']) && ($_GET['export']=='data')){      abc(); //Execute this function on GET request     }          function abc(){      //function data     }     ?>      Now I want the same thing to happen in my plugin in admin area, assuming the slug of my plugin is '_my-plugin'. So basically I would like to call the function when this URL is visited: `http://myblogaddress.com/wp- admin/admin.php?page=_my-plugin&export=data` Thanks in advance


title: Add rewrite endpoint to author page + pagination

text: I want to add a new endpoint to the author page, so that the URL looks like this: > http://example.com/writer/username/articles So far, I have:   * Changed the author base   * Added a rewrite rule   * Setup the query_vars   * Added the endpoint   * Used template_redirect to use my template Result: 404 Page Not Found (even after flushing the rewrite rules). I can't figure out where the problem is. Also I'd like to add pagination to the endpoint. Below is my code: Changed the author base:               function foo_change_author_base() {         global $wp_rewrite;         $wp_rewrite->author_base = 'writer';     }     add_filter( 'init', 'foo_change_author_base', 0 );      Added a rewrite rule:               function foo_rewrite_rule()     {         add_rewrite_rule( 'writer/([^/]+)/articles(/(.*))?/?$', 'index.php?author_name=$matches[1]&articles=$matches[3]', 'top' );     }     add_action( 'init', 'foo_rewrite_rule' );      Setup query_vars:               function foo_add_vars($vars) {         $vars[] = 'articles';            return $vars;     }     add_filter('query_vars', 'foo_add_vars');      Added the endpoint:               function foo_add_endpoint() {         global $wp_rewrite;         add_rewrite_endpoint( 'articles', EP_AUTHORS | EP_PAGES );     }     add_action( 'init', 'foo_add_endpoint');      And added my template:               function foo_rewrite_template()     {         global $wp_query;              if ( array_key_exists( 'articles', $wp_query->query_vars ) ) {             include (get_template_directory_uri() . '/articles.php');             exit;         }     }     add_action( 'template_redirect', 'foo_rewrite_template' );


title: Dynamically add CSS to the visual editor

text: I created an options page for my theme, where I can manually edit the CSS.   Lets say I change the CSS in the options page for the `<H1>` tag, so it will now change it on the front-end.   What I want to also do is have it change in the visual editor. I have added the function               add_editor_style(style.php);      and in the `style.php` I have it saying in the top               <?php     header('Content-type: text/css');     ?>      so it recognizes the file. But now I can't get the options dynamically... How should I achieve this? EDIT this is in the functions.               add_filter( 'mce_css', 'cnote_visual_css' );     function cnote_visual_css() {         return get_bloginfo('template_directory') . '/cnotethegr8/global-style.php';     }      this is the global stylesheet               <?php     header('Content-type: text/css');     global $shortname;     ?>          h1 { <?php echo(get_option($shortname.'_style_h1')); ?> }      when i echo $shortname nothing shows...


title: How to fake a Wordpress login?

text: As many of you know WPEngine don't support PHP SESSIONS unless the user is logged in. In that case WPEngine start taking consideration of PHP SESSIONS and the software based on hybridauth like Wordpress Social Login or Wordpress Social Invitations will work ok. So my question is : There is a way to fake a Wordpress login?


title: Using pre_get_posts to filter one loop in a multiloop archive

text:
I have a custom-post-type archive (archive-rg_blog.php) with two loops in it. One of the loops I'd like to filter with the below code. It's just a basic loop for all posts, and I just need to set it to return all posts instead of the custom posts it'd return by default. The other loop needs to pull the title and content from a specific custom post. The below seems to be filtering the second loop too, and so that it returns nothing at all.               function blog_filter($query) {       if ( !is_admin() && $query->is_main_query() ) {         if ($query->is_post_type_archive('rg_blog')) {           $query->set('post_type', 'post');         }       }     }     add_action('pre_get_posts','blog_filter');      And this is the loop that returns nothing:               <?php // blog title and description query     $post_id = 4606;     $queried_post = get_post($post_id);     $title = $queried_post->post_title;?>
<?php echo $title;?>
      Edit: Just to clarify, this is what I'm trying to do.               ///loop 1, queries a specific post     ///loop 2, a normal loop filtered with pre_get_posts, which should return all posts.     ///loop 3, also queries a specific post      So I need to add the filter before loop 2, and remove it again before loop 3. I've tried to add the filter into the archive template in the appropriate place, but loop 2 then fails to return all posts. Edit #2: Here's the whole loop in action. It's the SECOND loop that needs to be filtered.               <?php get_header(); ?>          <?php // blog title and description query     $post_id = 4606;     $queried_post = get_post($post_id);     $title = $queried_post->post_title;?>
<?php echo $title;?>
               <?php function blog_filter($query) {       if ( !is_admin() && $query->is_main_query()) {         if ($query->is_post_type_archive('rg_blog')) {           $query->set('post_type', 'post');         }       }     }     add_action('pre_get_posts','blog_filter');?>     <?php $post = $posts[0]; $c=0;?>     <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?>          <?php $c++;     if( !$paged && $c == 1) :?>               <?php else :?>                               <?php endif;?>     <?php endwhile; endif; ?>          <?php remove_action('pre_get_posts','blog_filter');?>                         <?php // blog title and description query     $post_id = 4606;     $queried_post = get_post($post_id);     $title = $queried_post->post_title;?>
<?php echo $title;?>
                     <?php echo $queried_post->post_content;?>     <?php get_footer() ?>


title: WP 3.5 media uploader API set selected item

text: I know how to use the new media uploader in WP 3.5 and integrate it with plugins and themes but I have a problem, say the user selected the image and the frame closed I want when he open it again the image user selected before being selected in the gallery or highlighted. the codex doesn't have any api doc about it               $button.on('click', function(e){         // prevent default behavior         e.preventDefault();         if ( typeof file_frame != 'undefined' ) {             file_frame.close();         }              // create and open new file frame         file_frame = wp.media({             //Title of media manager frame             title: 'Select an Image',             library: {                 type: 'image'             },             button: {                 //Button text                 text: 'Use Image'             },             //Do not allow multiple files, if you want multiple, set true             multiple: false,         });              //callback for selected image         file_frame.on('select', function() {             var selected = [];             if ( is_multiple ) {                 // multiple images selected                 var selection = file_frame.state().get('selection');                 selection.map(function(file) {                     selected.push(file.toJSON());                 });             } else {                 // single image                 selected.push(file_frame.state().get('selection').first().toJSON());             }                  // loop through selected images             for (var i in selected) {                 console.log(selected[i]);             }              });              // open file frame         file_frame.open();     });      can anyone help


title: How to get all post_parents of a post?

text: Unfortunately, $post->post_parent is a single variable and not an array. I want to get all post_parents of a post (especially of an attachment, which is often linked to multiple posts!).


title: What is theme-compat?

text: I have noticed that `wp-includes/theme-compat` directory.   So, what is it?   Is it a theme?


title: How to change tag based on metabox value within $wp_query

text: I have a custom post type called "issue" and a contents page for each issue. I tag all of my articles with each issue by the issue number, so for instance, all articles with Issue 15 are tagged `'issue-15'`. I have a custom post template for contents and I use the following code to call up all issue posts within the same issue number.               $wp_query = new WP_Query( array(          'post_type' => 'issue',         'tag' => 'issue-14',         'posts_per_page' => 50     ) );      Where it says `'issue-14'`, I need that to change based on a custom metabox field called `'issue-number'` which only contains the number of the issue. So if the metabox field is "`12`" I need the tag to be "`issue-12`".


title: How to display posts by current user in a drop down

text: I am trying to write a shortcode that works in conjunction with Contact Form 7 to display the current user that is logged in posts. I have been able to get it to work with regular posts using this code here:               wpcf7_add_shortcode('postdropdown', 'createbox', true);         function createbox(){         global $post;         $args = array('numberposts' => 0);         $myposts = get_posts( $args );         $output = "<select name='cursus' id='cursus' onchange='document.getElementById(\"cursus\").value=this.value;'><option></option>";         foreach ( $myposts as $post ) : setup_postdata($post);             $title = get_the_title();             $output .= "<option value='$title'> $title </option>";                  endforeach;         $output .= "</select>";         return $output;     }      However i am not sure how to go about adapting it for to display only the posts that the currently logged in user posted. Any help and direction on this would be welcome. Thank you :)


title: Problem with wordpress pagination

text: First of all thank you everyone for all the knowledge base i got reading trough stackexchange. For the first time i couldn't find an answer to my problem. The matter is that with this custom query (which has the purpose to search trough the posts with multiple taxonomy fields):               global $wp_query;     $tax_query = array();     $parametri = array(                             'ih_tipo_struttura' =>  array('tipo_struttura','IN'),                             'ih_localita'       =>  array('localita', 'IN'),                             'ih_stelle'         =>  array('stelle', 'IN'),                             'ih_categorie'      =>  array('categorie', 'AND'),                             'ih_servizi'        =>  array('servizi', 'AND')                         );     // Faccio il post dei parametri e li inserisco nella query     foreach ($parametri as $post => $taxonomy) {         if ( isset($_GET[$post]) && !empty($_GET[$post]) ){              $tax_query[] = array(                         'taxonomy'  => $taxonomy[0],                         'field'     => 'slug',                         'terms'     => $_GET[$post],                         'operator'  => $taxonomy[1]                         );          }     }     // Parametri base della query     $args = array(          'post_type' => 'post',         'tax_query' => $tax_query     );     // Parametri paginazione     if ( $pagination ) {         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args['posts_per_page'] = 2;         $args['paged'] = $paged;     } else {         $args[] = array( 'posts_per_page' => 20);   // Se imposto la paginazione a false ritorno i primo 20 risultati     }     // Eseguo la query     $wp_query = new WP_Query( $args );     return $wp_query;      everything works fine until i try to do some pagination. When i pass trough the url some $_GET parameters like:               http://mywebsite/ricerca/?ih_localita%5B%5D=riccione&ih_localita%5B%5D=rimini&ricerca_hotel=true      or               http://mywebsite/ricerca/page/2/?ih_localita=riccione&ih_localita%5B%5D=rimini&ricerca_hotel=true      there's no problem but if try:               http://mywebsite/ricerca/page/2/?ih_localita%5B0%5D=riccione&ih_localita%5B1%5D=rimini&ricerca_hotel=true      wordpress cut off all the search parameters returning the url just like:               http://mywebsite/ricerca/page/2/?ricerca_hotel=true      I'm getting crazy with this so i would really appreciate any help. Thx


title: Breadcrumb NavXT plugin - exclude 'home' page

text: Does anyone know how to exclude the breadcrumb from appearing on the 'home' page only using this plugin? I have currently got it set up in the header template and so it is appearing on every page.


title: Comment Count for each Comment Author

text: In WordPress 3.4.1: I am trying to add the Comment Author's total number of comments beside their info. (name + date/time) in the comment's list. Here is the SQL that I am using:               $count = $wpdb->get_var('SELECT COUNT(comment_ID) FROM '. $wpdb->comments. ' WHERE comment_author_email = "' . get_comment_author_email() .'" ' AND comment_approved = '1' AND comment_type = '');      Basically The Author's email will be checked and the total number of comments will be displayed. But also I want only approved comments to be counted and also I don't want pingbacks/trackbacks to be counted. The above code is returning a syntax error and probably is wrong in terms of logic. Any help is appreciated. thanks.


title: Including two taxonomies in a permalink structure

text: I am trying to get my head around the permalink structures on Wordpress sites, and I'm a bit stuck with what I'm trying to achieve: My current permalink structure: **/%category%/%postname%/** I have a custom-post type called 'city', and I want to create a structure like below: **mydomain.com/asia/china/beijing** So just to explain this structure: **asia** \- This is a term under a taxonomy called **'continent'** **china** \- This is a term under another taxonomy called **'country'** **beijing** \- This is the actual custom-post type post with title **'Beijing'** So I basically have two taxonomies (continent and country) linking to my **'city'** post type. So the way I see it, I need a structure like this: **mydomain.com/(taxonomy-continent)/(taxonomy-country)/(custom-post)** But I cannot seem to figure out how to achieve this with the permalink structure. Any help would be greatly appreciated! Thanks


title: wordpress Search function is not working

text: My wordpress Website Version is 2.8.1,This is the Custom wordpress website done by 2 years ago.[Link Removed... i got Solution][1]Now Search functionality is not working(It was working well earlier.) My Client told **Don't Upgrade the Version**. so here we need to replace the old search function with newer Search function. My **searchform.php**                <form method="get" id="searchform" action="<?php bloginfo('url'); ?>/" style="padding-bottom:30px;">     <input type="search" value="search..." name="s" id="s" class="inputbox" onblur="this.value='search...';" onfocus="if(this.value=='search...') this.value='';" /> <input type="submit" id="searchsubmit" value="" />     </form>      There is no more Files like " **search.php"** . I don't know how to replace the older search function with newer one.So please any one guide me. or any search plugin is do this work. Thanks in advance. This Thread is Closed...


title: How do I reliably find a URL to a script or other file?

text: I have the method below to try and build a URL for a script I wish to load:               class WPSM_SuperMail {              public static function scriptUrl($scriptPath) {             return plugin_dir_url ( __FILE__ ) . '/js/' . $scriptPath;         }     }      However, the `WPSM_SuperMail` class is located in the _code_ sub-folder of my plugin, and this folder is a sibling of my _js_ sub-folder. How can I find my plugin base folder and sub-folders of that without the damned 'code' intrusion?


title: Is there an action_filter hook to add content before the post title?

text: I am looking to add content before the post title but not included in the markup of the title itself so adding to `the_title` doesn't seem to be the right hook for this. Thanks


title: galleria for WordPress not working properly on Mobile devices (responsive)?

text: I am using galleria.io plugin for WordPress to create photo gallery, it works fine and is perfect for my requirement, the only issue is that it creates a huge space between the image and thumbnail when seen on mobile devices - (responsiveness not working) due to the fact that it takes fixed width. I did try working out with @media css but its not the best solution - i hope someone out there has some JS to fix this ? Thanks


title: How can I activate Collapse Menu in WordPress?

text: Inside the WordPress admin dashboard there is a button for making the left side menu collapse (to show just icons and not the icons + text on left side). How can I add jQuery so that it gets automatically collapsed once my plugin opens up. I tried this but it didn't work for me. I want to give a sort of 'full screen' option inside dashboard. Can anyone help me on this? I tried adding this jquery script to make it work, but it didn't work for me:               <script>     jQuery(document).ready(function() {          jQuery("#collapse-menu").click();     });


title: WP-nivo-slider Producing Error "Cannot modify header information - headers already sent by ..."

text: I have installed the wp-nivo-slider and am now getting a list of these errors on my /wp-admin/ page. The error is:               Warning: Cannot modify header information - headers already sent by (output started at /html/wp-content/plugins/wp-nivo-slider/wp-nivo-slider.php:633) in /html/wp-login.php on line 354      Any ideas?


title: how to assign a status/mark to post?

text: I want to mark some posts to include them in a featured content slider. For that purpose, I want to include a check box on the new post page, so that if the checkbox is selected the post is marked as featured. Then I can display all marked posts in the slider. How this can be done? Thanks.


title: Custom Archive Page

text: I want to create a custom archive page. It will look like this: 2011 January February March April May June... (Months) May (Current Month)   * Post 1   * Post 2   * Post 3 ... And clicked one of months (`is_month()` page) it will be look like this : 2011 (Selected Year) January February March April May June... (Months) April (Selected Month)   * Post 1   * Post 2   * Post 3 ... I tried to solve this by using `wp_get_archives();` but it's insufficient for this situation. Anyone got some ideas? Thanks! Wordpress version is 3.1


title: Simple foreach loop help needed in wordpress "the loop"

text:
I need a foreach loop inside "the loop" **This is my current code (index.php) :**               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"  title="<?php get_the_title(); ?>"> <?php the_title(); ?>

Show tags

Popup contents goes here (tags)
     <?php endwhile; ?>     <?php else : ?>     <?php endif; ?>      It lists post title and tags in the index php. I display all my tags in a pop up box. User should click "show tags" link to view the tags. Popup doesn't work correctly when i have more than 1 post. Because i need a unique name for each popup. I mean instead of "modal-from-dom" for all i need like "modal-from- dom-1,modal-from-dom-2,etc" I tried the following code but its not working.               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>      <?php $modalcount = 1; ?>
<a href="<?php the_permalink(); ?>"  title="<?php get_the_title(); ?>"> <?php the_title(); ?>

<a data-backdrop="true" data-controls-modal="modal-from-dom-<?php echo $modalcount; ?>" href="#">Show tags
         <div id="modal-from-dom-<?php echo $modalcount; ?>">Popup contents goes here (tags)
     <?php $modalcount++; ?>         <?php endwhile; ?>         <?php else : ?>         <?php endif; ?>      Can anyone help me?


title: Wordpress comments and Facebook comments

text: I've just installed Wordpress for a travel blog. I want the visitors to be able to comment with their facebook account or sign up as a subscriber to the blog (my mom for example doesn't have facebook). I installed the "Facebook Comments for WordPress" plugin but the problem is that now the visitors can either comment at the Facebook comments or the original comments. I want them to merge so that you comment in one place but you can either login to the blog or login to facebook to comment. Anyone know if this is possible without me needing to develop?


title: Unable to set Custom "Link URL" for Featured Image, and More?

text:
I have an issue that I believe can be solved one of two ways. I am using Featured Images in posts for content on a home page slider. What I would like to have happen is to have the destination links on click to be custom. Not the post or image URL of the post/featured image being used to feed the slider. 1) I thought I might be able to use the Image URL feature on the image itself, but it turns out the Featured Images will not accept a custom URL. It defaults back to the image path. 2) I have tried using a custom Post Meta field, but my attempts to retrieve that meta have been unsuccessful. I have set a Meta Field with the name "slider-url" and have dropped the path to the desired destination page into the field. I am then using the following code in the loop for the slider (from the WP Codex) in an attempt to pull that value into the href="" `<?php echo get_post_meta($post->ID, "slider-url", true); ?>` I am hoping someone might either have a hack for the Featured Image "Image URL" (along with a way to retrieve that URL), or alternately some insight into why my custom post meta might not be working. Thanks in advance for your time and expertise. Cheers! EDIT: Here's the specific block of code. It's contained within the PHP file of the slider plugin.
     <?php          $category = get_option('wpns_category');         $n_slices = get_option('wpns_slices');     ?>     <?php query_posts( 'cat='.$category.'&posts_per_page=$n_slices' ); if( have_posts() ) : while( have_posts() ) : the_post(); ?>         <?php if(has_post_thumbnail()) : ?>         <a href="<?php echo get_post_meta($post->ID, "slider-url", true); ?>" title="<?php the_title(); ?>">              <?php the_post_thumbnail(); ?>                  <?php endif ?>         <?php endwhile; endif;?>         <?php wp_reset_query();?>
      Additionally, here's a screen capture of the post meta field: http://s.sct.io/Bl6O Thanks again!


title: Custom Taxonomy with Custom Post Type Finds No Posts

text: I've created a custom post type named `mfg_ppn` and a custom taxonomy called `mfg_pp`, and they are referenced as `$this->cpt_promotion_news`and `$this->cpt_promotion`in case you were wondering about them. Everything looks good in the admin, and I can easily assign the taxonomy to the custom posts. But when I visit my site using `http://example.com/promotion/company` I do not get any posts, even though there are 12 posts bound to that particular term. Here is my PHP code used for registering the post type:               // Register campaign news:     register_post_type($this->cpt_promotion_news, array(         'labels' => array(             'name' => __('Campaign Posts', $this->plugin_locale),             'singular_name' => __('Promotion Campaign', $this->plugin_locale),             'menu_name' => __('Promotion', $this->plugin_locale),             'all_items' => __('All Campaign Posts', $this->plugin_locale),             'add_new' => __('Add New Post', $this->plugin_locale),             'add_new_item' => __('Add New Campaign Post', $this->plugin_locale),             'edit_item' => __('Edit Post', $this->plugin_locale),             'new_item' => __('New Post', $this->plugin_locale),             'view_item' => __('View Post', $this->plugin_locale),             'search_items' => __('Search Posts', $this->plugin_locale),             'not_found' => __('No posts found', $this->plugin_locale),             'not_found_in_trash' => __('No posts found in trash', $this->plugin_locale),             'parent_item_colon' => __('Post parent:', $this->plugin_locale)         ),         'description' => __('News for a partner promotion campaign.', $this->plugin_locale),         'public' => true,         'exclude_from_search' => true,         'show_in_nav_menus' => true,         'menu_position' => 25,         'show_in_menu' => true,         'map_meta_cap' => true,         'capabilities' => array( 'manage_options' ),         'capability_type' => 'post',         'hierarchical' => false,         'supports' => array( 'title', 'editor', 'thumbnail', 'comments' ),         'taxonomies' => array( $this->cpt_promotion ),         'has_archive' => true,         'rewrite' => array(             'slug' => __('promotion-post', $this->plugin_locale)         )     ));      And here is the code for registering the taxonomy:               // Register promotion campaigns:     register_taxonomy($this->cpt_promotion, $this->cpt_promotion_news, array(         'labels' => array(             'name' => __('Promotion Campaigns', $this->plugin_locale),             'singular_name' => __('Promotion Campaign', $this->plugin_locale),             'menu_name' => __('All Campaigns', $this->plugin_locale),             'all_items' => __('All Campaigns', $this->plugin_locale),             'edit_item' => __('Edit Campaign', $this->plugin_locale),             'view_item' => __('View Campaign', $this->plugin_locale),             'update_item' => __('Update Campaign', $this->plugin_locale),             'add_new_item' => __('Add New Promotion Campaign', $this->plugin_locale),             'new_item_name' => __('New Campaign Name', $this->plugin_locale),             'parent_item' => __('Post parent:', $this->plugin_locale),             'parent_item_colon' => __('Post parent:', $this->plugin_locale),             'search_items' => __('Search Campaigns', $this->plugin_locale),             'add_or_remove_items' => __('Add or Remove Campaigns', $this->plugin_locale)         ),         'public' => true,         'show_ui' => true,         'show_in_nav_menus' => false,         'show_tagcloud' => false,         'show_admin_column' => true,         'hierarchical' => true,         'query_var' => true,         'rewrite' => array(             'slug' => __('promotion', $this->plugin_locale)         )     ));      I have also created a template called `taxonomy-mfg_pp`, which is the name of the taxonomy, but it never outputs any post, even though there are posts. The culprit seems to be that the WP_Query executed only looks for posts, pages and attachments, as seen below:               SELECT SQL_CALC_FOUND_ROWS  qADrathuFrU2_posts.ID FROM qADrathuFrU2_posts  INNER JOIN qADrathuFrU2_term_relationships ON (qADrathuFrU2_posts.ID = qADrathuFrU2_term_relationships.object_id) WHERE 1=1  AND ( qADrathuFrU2_term_relationships.term_taxonomy_id IN (1196) ) AND qADrathuFrU2_posts.post_type IN ('post', 'page', 'attachment') AND (qADrathuFrU2_posts.post_status = 'publish' OR qADrathuFrU2_posts.post_author = 1 AND qADrathuFrU2_posts.post_status = 'private') AND qADrathuFrU2_posts.post_password = ''  GROUP BY qADrathuFrU2_posts.ID ORDER BY qADrathuFrU2_posts.post_date DESC LIMIT 0, 10      Am I doing something wrong and am I going about this the wrong way? Please help me as the deadline is approaching and I just can't seem to get this right! Thanks in advance, Jonathan


title: Custom Post Type & Custom Menu Walker to append custom class for active post types

text:
I have an interesting problem I am trying to solve here regarding a custom nav menu. Essentially, I have created a custom walker class for my nav menu and I have manually added a menu entry directing users to "/articles" which is a custom post type archive page. (BTW, as far as I know there is no way to have these custom post type archive pages included within the left hand selection correct?) Anyway... so, I have added the menu entry by using the custom link dialog box and my custom walker correctly highlights that nav menu entry when you click it/visit the "/articles" page. The problem I am having here is that when you select one of the news items this "/articles" menu link is no longer selected. So the question here is: what would I need to change in my custom walker class (code I am using is included below) to append a class to the menu when your on of those post pages. It would seem to me that this functionality should be built into wordpress for custom post types. For example, the class "current_page_parent" is appended to a parent page if you visit one of the subpages. I thought there would be something like "current_post_parent" or "current_custom_post_parent" but this does not seem to exist as far as I can tell. So team, any idea how I can add this functionality? **My Custom Walker Menu**               // COMPANY - RIGHT MENU - CUSTOM MENU WALKER     class Company_Menu_Bar_Walker extends Walker_Nav_Menu {     function start_el(&$output, $item, $depth, $args) {         global $wp_query;         $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';         $class_names = $value = '';         $classes = empty( $item->classes ) ? array() : (array) $item->classes;         $current_indicators = array('current-menu-item', 'current-menu-parent', 'current_page_item', 'current_page_parent');         $newClasses = array();         foreach($classes as $original_class) {         //check if it's indicating the current page, otherwise we don't need the class             if (in_array($original_class, $current_indicators)) {                 array_push($newClasses, $original_class);             }         }         $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $newClasses), $item ) );         if($class_names!='') $class_names = ' class="'. esc_attr( $class_names ) . '"';         $output .= "\t" . '
';         $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';         $attributes .= ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';         $attributes .= ! empty( $item->xfn )        ? ' rel="'    . esc_attr( $item->xfn        ) .'"' : '';         $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';         if($depth != 0) {         //option to store things like sub-menus         }         $item_output = $args->before;         $item_output .= '';         $item_output .= $args->link_before .apply_filters( 'the_title', $item->title, $item->ID );         $item_output .= '';         $item_output .= $args->after;         $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );     }     }      **Template Code which calls the custom walker***
     select a page     <?php wp_nav_menu( array(     'theme_location'    => 'company-menu',     'container'         => '',      'container_class'   => '',      'container_id'      => '',     'menu_class'        => '',     'menu_id'           => '',     'echo'              => true,     'before'            => '',     'after'             => '',     'link_before'       => '',     'link_after'        => '',     'fallback_cb'       => '',     'items_wrap'        => '
' . "\n" . '%3$s
' . "\n",     'depth'             => 2,     'walker'            => new Company_Menu_Bar_Walker     ));      ?>


title: Yoast's WordPress SEO plugin is not showing the correct snippet

text: I am facing a problem. I am not getting the snippet which YOAST plugin showed me. The snippet in Google search is different from what YOAST is showing. Check out the screenshots (http://imgur.com/a/ko5lQ). Let me know what is the solution of it?


title: Wordpress search not searching pages' content

text: My wordpress site doesnt search for pages' content. I have checked for the existence of the following filter that could prevent search from searching pages but there aint any               add_filter('pre_get_posts','myfunction');       What else could I check for? Any help would be appreciated. Regards, Loveleen


title: 403 Forbidden error when using the wp_login_form function

text: I use the function wp_login_form twice in my site for a simple client login. However, suddenly the problem started and every time I use it I receive this 403 forbidden error. My .htacess looks like so:               # BEGIN WordPress     <IfModule mod_rewrite.c="">     <files async-upload.php="">     SecFilterEngine Off     SecFilterScanPOST Off     </files>     </IfModule>     <IfModule mod_rewrite.c>     RewriteCond %{HTTP_HOST} !^$     RewriteCond %{HTTP_HOST} !^www\. [NC]     RewriteCond %{HTTPS}s ^on(s)|     RewriteRule ^ http%1://www.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]          RewriteCond %{SERVER_PORT} 80      RewriteRule ^(.*)$ https://www.domain.com/$1 [R=301,L]          RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      The problem is weird because if I access it directly without using the form inside the site it works just fine. What am I doing wrong? Thank you.


title: get recent comments of a particular category

text: I am using `get_comments('status=approve&number=5')` to display recent comments in my wordpress sidebar. I need to display the recent comments of a particular category. How to do this?


title: Visual Form Builder - Email Content?

text: Looking for a way to easily edit the email content for VFB Pro ... Reason being, I have a really long form, that gets printed, but all fileds are not alway populated, so when I am printing the email, it is a lot of wasted paper. Would be great to be able to edit so that the email only sends the populated fields. Anyone?


title: Theme title in admin shows full path

text: For some reason my admin panel seems to be a little busted. My themes title (Smashing Themes: Tank) now shows up as the full path of the theme instead of just he title. Kinda weird and a little annoying. It shows up in multiple browsers. ![bug](http://i.stack.imgur.com/obBpA.png)


title: I Need To Display A Specific Product (Called By Meta Field) On It's Current WooCommerce Category Page

text: I am trying to build a little module onto the product-archive template for WooCommerce that will accomplish one goal. I have included custom meta fields on the category editor page so that I can paste in specific product SKUs on that page to have as Featured Products. However, I need to figure out a way to have WooCommerce query the current category of products and list the product that has the same SKU that I have listed in the category meta. in other words... Product Category -> Custom Meta Field (Product Sku) -> On Product Category Page, Display Product With Matching SKU from current category. Is something like this even possible? I have been wracking my brain for hours trying to get this to work. Honestly, it doesn't seem like that crazy of an idea, but there is just nothing available that I can with a bit of guidance in the correct direction.


title: Show language translation for custom page

text: I am using qtranslator plugin for multilingual functionality. It all working. But I want to know how to translate and add language contents for my custom pages, where I am showing data from database, like listing of companies from my custom table. Dynamic data is OK, that's from database. but how to change grid column & other labels here ? Any help please. Thanks in Advance.


title: Will permalinks work if blog is transferred to subdirectory?

text: How should I transfer my WordPress blog from the root of my domain to a sub- directory? If everything including root in an installment of WP 3.2.1 were moved to a sub-directory, would the default permalink structure update to it? e.g. `domain.com/wp-sub` instead of `wp-domain.com`? Also, should I modify any code or settings and, if so, what exactly?


title: How to return an array of posts with the comments template intact for each post

text:
Has anyone run across a way to build a page of posts that includes the comments and discussion form(s) for each post inline with the list? I tried this a few ways today and found it quite difficult. For example the list would be pseudo-code like               POSTS ARRAY     POST[1]     COMMENTS ARRAY      POST[2     COMMENTS ARRAY     ...      One of the ways I tried to accomplish this (which seemed the easiest really) was to use `single.php` as a page template and then just run a manual query_posts in it. I was able to get it to work by calling `comment_form('', the_ID());` instead of `comments_template( 'comments.php', true );` HOWEVER that solution does NOT use my comments template and rather throws this `div` in there with an `id` of "respond" that isn't anywhere in my theme. There is some magic that happens on a page or single that you can't easily override when you try to do it in one big list. Any help would be appreciated and respected.               /*     Template Name: Blog     */     ?>     <?php           get_header();          $args = array(     'category' => '7',     'posts_per_page' => '10',     );     query_posts( $args );          ?>
     <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>         <div id="post-<?php the_ID(); ?>" <?php post_class('post'); ?>>

<a href="<?php the_permalink() ?>" title="<?php        the_title(); ?>" rel="bookmark"><?php the_title(); ?>
                 <?php edit_post_link('Edit this entry','',''); ?>                 <?php if ( has_post_thumbnail() ) { /* loades the post's featured thumbnail, requires Wordpress 3.0+ */ echo '
'; the_post_thumbnail(); echo '
'; } ?>
                     <?php the_content(); ?>                     <?php wp_link_pages('before=
&after=
'); ?>

                     Posted on <?php the_time('F j, Y'); ?> at <?php the_time() ?>

                     <?php the_tags('Tags: ', ', ', ' '); ?>

                     Receive new post updates: <a href="<?php bloginfo('rss2_url'); ?>" rel="nofollow">Entries (RSS)
                     Receive follow up comments updates: <?php comments_rss_link('RSS 2.0'); ?>

                  <?php /* If a user fills out their bio info, it's included here */ ?>
                        <?php          comment_form('', the_ID());         //comments_template( 'comments.php', true ); ?>          <?php endwhile; /* end loop */ ?>


title: can you set a default value to a custom field

text: I'm looking to set a default value to a specific custom field, in case the client doesn't add into the custom field it already has a specific number associated with it. one step deeper, I'd like it so if cat =22 is selected this custom field is automatically added into the post with a default that hopefully the client will add the proper number I think this can be accomplished by a global function but my brain is just not processing this right now


title: How to keep plugin translates after updates?

text: http://wordpress.org/extend/plugins/bbpress/ bbpress' language folder ( wp- content/plugins/bbpress/bbp-languages ) have that warning:               /**      * Do not put custom translations here. They will be deleted on bbPress updates.      *      * Keep custom bbPress translations in /wp-content/languages/      */      Actually this is not a new problem and yes they are right. This is big problem if you are using wordpress plugins with a non-english language. Basically i translated bbpress and created .po and .mo files. Files are working if i put them in their normal wp-content/plugins/bbpress/bbp-languages folder. But as above warning says that will delete when update. But problem is, translating is not working if i put them in wp-content/languages/ folder as suggested in bbpress. I think there must be a hook or something i can activate it but what is best solution for it? Simply i want to keep plugin language files in wp- content/languages/


title: Not showing list if there aren't any categories to display

text:
maybe you can help: Bellow there is a simple code listing my blogs categories. **I need some code that will not display the * _ul** is there aren't any categories to display_*

Categories:

     <? $master_cat = get_category_by_slug('Master');        $master_cat_id = $master_cat->term_id;         $slave_cat = get_category_by_slug('Slave');        $slave_cat_id = $slave_cat->term_id;        wp_list_categories('orderby=name&title_li=&exclude='.$master_cat_id.','.$slave_cat_id.''); ?>
      Ty very much


title: retrieve post data and insert it in seperate static html page without Wordpress

text: I have a blog which runs on Wordpress and inside the Wordpress environment I'm fine and know how to display specific blogposts etc. But beside I want to insert specific Blog-posts in a static HTML Website which doesn't have a CMS and is standalone. Imagine the simplest case of               <body>      <p class="blogpost"> <!-- insert specific blogpost of my blog on static website --> </p>     </body>      is there any possible chance to retrieve a blogpost of Wordpress by PHP without running the site on Wordpress? Any clue how to start with?


title: Pagination doesn't work

text: I created myfile.php with the following content:               global $paged;     if ( get_query_var( 'paged' ) ) {         $paged = get_query_var( 'paged' );     } else if ( get_query_var( 'page' ) ) {         $paged = get_query_var( 'page' );     } else {         $paged = 1;     }          $args = array(         'post_type' => array('my_custom_post_type'),         'paged' => $paged,         'posts_per_page' => 3,         'ignore_sticky_posts' => 1     );          $wp_query = new WP_Query( $args );     var_dump($wp_query);     if($wp_query->have_posts()) :         while($wp_query->have_posts()) : $wp_query->the_post();             // show post         endwhile;     endif;          next_posts_link('Next posts');          wp_reset_query();     wp_reset_postdata();      and:   * when it's set to "Static Front Page" in Settings > Reading it works fine with pagination. I can access http://example.com/page/2   * when Settings > Permalinks is set to "Default Permalinks Structure" it works with http://example.com/?page_id=1234&paged=2   * when Settings > Permalinks is set to any "Custom Structure" the following http://example.com/mypage/page/2 launches 404.php. I have no idea what am I missing here but I just tried every single suggestion from troubleshooting guide on this page: https://codex.wordpress.org/Pagination \- they suggest that "404 - not found" is one of the common problems when the permalinks are set to "Custom Structure" so WP developers are aware of some bug or issue but they don't say how to fix that. My server is WAMP for Windows 7 (PHP 5.4.3, Apache 2.4.2, `mod_rewrite` enabled, custom link structures work great expect pagination when "myfile.php" is used as a page other than "Static Front Page"). My .htaccess when "Custom Permalink Structure" is set to "Post name":               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wp/index.php [L]     </IfModule>          # END WordPress      When I enter http://example.com/mypage/page/2 (doesn't work): `SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.post_name = 'page' AND wp_posts.post_type = 'my_custom_post_type' ORDER BY wp_posts.post_date DESC` When I enter http://example.com/?page_id=1234&paged=2 (works): `SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'my_custom_post_type' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') ORDER BY wp_posts.post_date DESC LIMIT 2, 2`


title: Is it possible to modify default image name suffix?

text: So that, I tried this technique - Modify Default Image Name Suffix but it doesn't work as I need, I have all the images loaded, and I need to regenerate them. And what about the recovery of the images? **EDIT -** What I need is have the image files named as `pic-large.jpg`, pic-medium.jpg, pic-thumbnail.jpg instead of `pic-1024x700.jpg`. I use ImageMagick engine plugin and Additional Image Sizes (zui), in order to create more sizes than the default ones.


title: delete fields from checkout page in woocommerce

text: I use woocommerce in my client site.I use Boutique theme in wordpress.i want to customize checkout page i don't want extra fields in checkout form so i delete the unnecessary fields but when i click on checkout button it show me error that"country field are required" i fill the fields but still it show me error for country,first name and last name field .i try different things but doesn't work .can any one have any solution.


title: BuddyPress - What Table is User Role Stored In?

text: Where in the MySQL tables is the User Role stored for BuddyPress / WordPress? Thanks.


title: custom admin thumbnail for videos, not getting post's id?

text: In the attachments edit page i'm trying to use the selected thumbnail instead of the default icon. 99% of the way there but i can't get the attachment's id into the function. Am i missing something obvious? Help appreciated! Dc.               function set_attachments_icon($icon, $mime = null, $post_id){         $vars = get_defined_vars();         print_r($vars);              echo " ??".$icon."?? ".$post->id.' '.$post_id.'  ?? id not getting picked up?';              $thumb_id = get_post_meta($post->ID,'dsv_thumbnail_id', true);              if($thumb_id!=''){             $image_attributes = wp_get_attachment_image_src( $thumb_id );             $icon =  $image_attributes[0];         }              return $icon;     }          add_filter('wp_mime_type_icon', 'set_attachments_icon');     apply_filters( 'wp_mime_type_icon', $icon, $mime, $post_id );


title: Tell wordpress to show a single page instead of an archive

text: So I have multiple custom parameters in the url, and at some point when the query reaches 3 parameters (e.g. `index.php?post_type=foo&<param-1>=<val-1>&<param-2>=<val-2>&<param-3>=<val-3>`) there can be either one post or none. Instead of displaying archive (`archive- foo.php`) with this one post, I want wordpress to display the post itself (e.g. `single-foo.php`). Of course I can check all of this in the `archive- foo.php` and redirect to a corresponding post from there, but in this case I "waste" the whole query of displaying the archive. So, is there any way to force wordpress load single page when archive contains only one record by manipulating the main query (using a custom function in `functions.php` and attaching it via `add_action('pre_get_posts', '<func- name>')`)? Rough example:               add_action('pre_get_posts', 'custom_func')     function custom_func($query) {         if($query->get('param-1')) {             // Change some $query params, but still show archive             if($query->get('param-2')) {                 // Change some $query params, but still show archive                 if($query->get('param-3')) {                     // There is 1 post or none for sure                     // Alter the query to something like                     $wpdb->query('SELECT * FROM wp_posts WHERE param1=val1 AND param2=val2 ...');                     // force to load a single page with the results passed to $post object                 }             }         }     }


title: No Thumbnails Generated

text: I setup WordPress on my own server and it's up and running...one thing that I have noticed is that WordPress doesn't generate any images I upload. Usually when I upload an image through WordPress it will generate a thumbnail, medium, and large sized image. WordPress installed without error and everything else is working fine. I have tried to rebuild the thumbnails, but that doesn't work :-( Any ideas? Thanks,   Josh


title: Add audio attachment link to RSS

text: This is how I'm adding a featured image to my RSS:               function featuredtoRSS($content) {     global $post;     if ( has_post_thumbnail( $post->ID ) ){     $content = '' . get_the_post_thumbnail( $post->ID, 'topImage', array( 'style' =>  'margin:0 auto; border: 1px solid #555; display:block;' ) ) . '' . $content;     }     return $content;     }          add_filter('the_excerpt_rss', 'featuredtoRSS');     add_filter('the_content_feed', 'featuredtoRSS');      All of my posts have audio attachments (one per post), and I would like to add them to RSS as well. How would I achieve that? Thanks in advance.


title: How can I remove "Proudly powered by WordPress" from twentyeleven without modifying footer.php?

text:
How can I remove "Proudly powered by WordPress" from twentyeleven without modifying footer.php, and without creating a child theme? I'm looking for a php command, such as `add_action`, `remove_action`, `add_filter`, or something of that sort. I'm not looking for CSS to hide the footer. I don't want to modify any of the theme files other than `functions.php` Is this possible? For reference the code in the footer that is creating this is below.
         <?php do_action( 'twentyeleven_credits' ); ?>         <a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyeleven' ) ); ?>"         title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyeleven' ); ?>"         rel="generator">         <?php printf( __( 'Proudly powered by %s', 'twentyeleven' ), 'WordPress' ); ?>


title: wp_insert_post with POST data

text:
I found some code on this site for wp_insert_post and I got it working. I did find the post in the category where I would expect it to be. Then I changed the code example to include information from my form on the page and the code fails. Here is the sample code I got from this site that does work.               <?php if(isset($_POST['new_reservation']) == '1') {         $post_title = "My Post";         //$post_category = 'reservations';              $my_post = array();         $my_post['post_title'] = "My Post";         $my_post['post_content']  = 'This is my post.';         $my_post['post_status']   = 'publish';         $my_post['post_author']   = 1;         $my_post['post_category'] = array(9);               wp_insert_post($my_post);         //update_post_meta($post_id, 'reservations', $customer);          } ?>      so then I changed things to this in order to get the name of the post from the form               <form action="" method="post" name="reservations" id="reservations" enctype="multipart/form-data">

                 <img src="<?php bloginfo('template_directory');?>/images/name.png" alt="name" width="47" height="10" />	                 <img src="<?php bloginfo('template_directory');?>/images/date.png" alt="date" width="43" height="10" />

                 <input type="text" id="name" name="name" />	                          <input type="hidden" name="new_reservation" value="1" />
                 <input type="submit" name="reserveSubmit" id="reserveSubmit" class="button" value="submit"/>  or Clear Form

                    <?php if(isset($_POST['new_reservation']) == '1') {         $post_title = $_POST['name'];         $post_category = 'reservations';              $my_post = array();         $my_post['post_title'] = $post_title;         $my_post['post_content']  = 'This is my post.';         $my_post['post_status']   = 'publish';         $my_post['post_author']   = 1;         $my_post['post_category'] = array(9);// Insert the post into the databasewp_insert_post( $my_post );"                         wp_insert_post($my_post);         //update_post_meta($post_id, 'reservations', $customer);          } ?>      The code fails whenever I try to use the name variable as the name of the post


title: How to recover deleted site in Wordpress Multisite?

text: I went to Network Admin > Sites > clicked on a site and changed the site url for a child site. Now that site is gone altogether and I cannot get it back. What can I do now?


title: Is there an easy way to migrate a site from SiteFinity to WordPress?

text: Has anyone ever migrated a site from SiteFinity to WordPress? I've got a large (1,200+ page) site that I'm transitioning over to WordPress and I'm not looking forward to the content migration. Does anyone know of a tool, trick or plugin to make this easier?


title: Roles for Custom Post Types

text: I created some custom post types, but I would like to hide them in the dashboard from Subscribers, Authors, and Editors (essentially, just allow administrators to access them). Can I do this without installing a plugin?


title: Extending the site search to include a single custom field

text: I have the followign code in my functions.php file               function __adapted_search_function($search, $query) {       if(is_admin() || !$query->is_main_query() || !$query->is_search)         return; //determine if we are modifying the right query            global $wpdb;       $search_term = $query->get('s');       $search = ' AND (';            //point 1       $search .= "($wpdb->posts.post_title LIKE '%$search_term%')";            //need to add an OR between search conditions       $search .= " OR ";            //point 2       $search .= "($wpdb->posts.post_excerpt LIKE '%$search_term%')";            //need to add an OR between search conditions       $search .= " OR ";            //point 3       $search .= "($wpdb->postmeta.meta_key = 'mcb-product' AND $wpdb->postmeta.meta_value LIKE '%$search_term%')";            //add the filter to join, sql will error out without joining the tables to the query       add_filter('posts_join', '__custom_join_tables');                    return $search . ') ';     }          function __custom_join_tables($joins) {       global $wpdb;       $joins = "JOIN $wpdb->postmeta ON ($wpdb->postmeta.post_ID = $wpdb->posts.ID)";       return $joins;     }      Which I was hoping would search only the post title, excerpt and also a single custom field. It works if I remove the join but really need to keep that included, can anyone see where I have gone wrong?


title: show/hide attachments

text: Is there a way to **show/hide** attachments in my case images on a post. What I want is to mark an image as _"hidden"_ and then only show it to the _admin_ and hide hidden images from a normal user I know how to use `wp_query` and `get_posts` to get _attachments_ also how to check if user is an _admin_ just want to know if there is somewhere a field or table where I can store a flag that the attachment is **hidden** or if there is any _"best practice"_ for this. Essentially I have an post with attached images and I display a gallery of the images on a page as a custom post type and I want is to show the “hidden” images to the admin but not to a user lower then admin. Atm. I am using:               $args = array(     'order'         => 'ASC',     'orderby'       => 'menu_order ID',     'post_type'     => 'attachment',     'post_parent'   => $post->ID,     'post_mime_type' => 'image',     'post_status'   => null,     // Change the number of images to show in the gallery below     'numberposts'   => 999,     );     $attachments = get_posts($args);      To retrieve the attachments I tried wp_delete_attachment witch confuses me because according to * _WP documentation: *_ `function wp_delete_attachment( $post_id, $force_delete = false )` it has a parameter that does not permanently delete the attachment > bool $force_delete: Whether to bypass trash and force deletion. Defaults to > false. but when I used it as: `wp_delete_attachment( $item,false );` > `$item` being the id for the attachment it deleted the image from the uploads folder. If the `wp_delete_attachment` function works as intended I would like to know how to query the deleted attachments that are bound to the post. So that the admin user has a chance to "restore" the image Hope someone can help.


title: Is it posible to translate a url prefix?

text: I use a prefix in my url using "add_permastruct" in my functions.php:               www.mydomain.com/the_prefix/my_category/postname      But I would like to translate "the_prefix". For example, if my site is in english, I will use the prefix "articles" and If my site is in german I will use "artikel".               English: www.mydomain.com/en/articles/my_category/postname          German: www.mydomain.com/de/artikel/my_category/postname      Any ideas? I use WPML plugin


title: Making a plugin file accessible via url rewrite?

text: In my WordPress plugin I have a php file that generates some stats about the blog and outputs it as a simple text file. To access WordPress functions I've included this at the top of the file:               define('WP_USE_THEMES', false);     require(dirname(__FILE__) . '/../../../wp-blog-header.php');      Now I'd like to hide the actual URL, since it's in the wp-content/plugins directory and replace it with something nice and short:               http://example.com/wp-content/plugin/data-fetcher/list-data.php          -> rewrite to http://example.com/list-data      I added this to `.htaccess`:               <IfModule mod_rewrite.c>     RewriteEngine on     RewriteBase /     RewriteRule ^list-data$ wp-content/plugins/data-fetcher/list-data.php [L]     </IfModule>      The problem: when I access the short URL, I get a 301 Moved Permanently redirect before I end up on the page. This means that the wp- content/plugins/... URL is revealed in the browser. I suspect that WordPress is initiating this somehow. The rewrite rule works fine for images and plain php files (i.e. without WP includes/require). Is my assumption correct? How can I prevent WordPress from sending the redirect?


title: Creating Multiple Menus in the Thesis Theme?

text: How can I add three menus to the Thesis theme? I want a menu above the header image, one below the header image and one in the footer. A neat step by step instruction like this for Twenty Ten would be like the coolest answer.


title: How to make a share-this window drop when reaching end of post?

text: The following blog of okcupid had this interesting feature that shows a "share this" window only when you reach the end of the post: http://blog.okcupid.com/index.php/what-if-there-were-not-so-many-white-people/ How is it possible to do this? Thanks


title: Different Output for "Every Other" Foreach Statement?

text:
I'm currently using the following code in order to get subcategories in a category page and getting the posts foreach subcategory. In the part where it echos "span-12" (line 14) i want it to echo "span-12 last" for every other subcategory. my code:               <?php  $cats = get_categories('child_of='.get_query_var('cat'));           foreach ($cats as $cat) :          $args = array(     'orderby' => 'title',     'order' => 'ASC',     'posts_per_page' => -1, // max number of post per category     'category__in' => array($cat->term_id)     );     $my_query = new WP_Query($args);               if ($my_query->have_posts()) :          echo '
';         echo '

'.$cat->name.'
';              while ($my_query->have_posts()) : $my_query->the_post(); ?>              <?php /*general loop output; for instance: */ ?>
         <a href="<?php the_permalink() ?>"><?php the_title(); ?>           aired <?php if(!function_exists('how_long_ago')){the_time('F jS, Y'); } else { echo how_long_ago(get_the_time('U')); } ?>

         <?php endwhile; ?>
         <?php else :          echo 'No Posts for '.$cat->name;                         endif;      wp_reset_query();          endforeach; ?>      In this part, (line 14)                echo '
';      i want to echo for every other category foreach, i want it to echo like this                echo '
';      I found some code for adding and checking if it is odd, but that doesn't seem to work for this code.


title: Custom post types and permalinks : What a mess !

text: I know that's a common problem with the custom-post-types, but I'm stuck there. I created a custom-post-type named 'cpt_soins'. I have no page with similar name (singular/plural)... I tried with `'rewrite' => array('slug' => 'nos-soins-et-services');` when I registered my custom post type in order to display a more pretty url than "/?cpt_soins=soins-visage-a-la-rose"... But I'm stuck with a 404 error. I want this ugly permalink: "http://localhost:8888/wordpress/?cpt_soins=soins- visage-a-la-rose" ---> transformed into: "http://localhost:8888/wordpress/nos- soins-et-services/soins-visage-a-la-rose" I know i can use the "add_rewrite_rule() with regex". But I did'nt get working. Could you give me the code please for the functions.php in order to get my permalink ? Thanks a lot


title: Need specific kind of "Poll Voting" for Wordpress

text: I'm designing a website for a client. I don't really know how I got landed with all the backend structure code, but I did. I'm not an awful programmer, but I need something solid to work off, I can't just code my own program. I need a plugin or some code that will automatically place a poll with **three** options to each post. Preferably, the OUTCOME of the poll would be displayed with the excerpt, then the actual poll would be on the full post page. That would be ideal, but I'll take what I can get. I just need a poll that will be attached to each post and work inline. IE: Not something I have to slap on a sidebar. Something that I can add to the index.php file with my loop, and also the single.php file would be excellent. However this might get tricky as the poll results would have to be dynamic to each post. I would also be okay with having to add a shortcode to each post (as there are plug-ins which can add shortcodes to posts by default without anyone being able to see them) but that seems sort of hack and slash to me. Thanks for any help on this. Hope I was clear enough.


title: How can I hide the category term for posts with none set?

text:
I'm trying to hide the word "Category:" from the metadata on the Twenty-Eleven theme's footer, when I don't have one set for a given post (sometimes I will manually remove the "Uncategorized" category, and sometimes I will be using Custom Post Types with Categories I have yet to create). I know how I can do it with my custom post types' versions of "categories" and "tags:"               <?php if (get_the_term_list( $post->ID, 'length' ) != null ) { ?>
Length: <?php echo get_the_term_list( $post->ID, 'length', '', ', ', '' ); ?>
             <?php } ?>          From my understanding, the above conditional says, "If you get the term list and it's got the taxonomy "length," and it's NOT empty, then go ahead and show the list for that term." But for the existing Categories and Tags, how would I do it? I thought about using `has_terms` like so:               if( has_term( 'category' ) != null ) {     //do something     }      But I don't know what the 'something' is! I don't want it to display the categories if there are none (that what it's doing anyway), so should I be adjusting what's already there:               $categories_list = get_the_category_list( __( ', ', 'twentyeleven' ) );      somehow? Thanks for any clarity you can provide!


title: Cron Job variable not accessible

text: I am currently running a cron job on my cPanel to update a variable containing exchange rates, how can I make this variable available to functions and pages in my wordpress site? **My command in cPanel for cron job running every minute:**               php -q /home/username/public_html/cronjob.php      **cronjob.php**               <?php     require('wp-blog-header.php');     $exchangeRates = getExchangeRates();          function getExchangeRates(){     // etc etc     }


title: How to check a post is sticky or not yet?

text: I want to check a post a post is sticky or not to do some function. Thanks all for help ;)


title: Multiple Page Templates & CSS

text: What's the best practice for handling CSS on a theme with multiple page templates? For example: I will have a Full Width page template and a 2-column page template. Is it best to just call out the containers in a single CSS (#fullWidthContainer vs. #twoColumnContainer) Or is it better to have separate CSS files for each page template?


title: Problem with Front-Page.php loading recent posts

text: Hi I this weird problem where i have my custom front-page.php with set page (in Reading Settings) static page. What I want to have is a static page with welcoming message and later 1 recent posts from post-type and 4 recent posts form custom post type. To get static page info I use:               <?php while ( have_posts() ) : the_post(); ?>       <?php get_template_part( 'content', 'page' ); ?>     <?php endwhile; // end of the loop. ?>      Then to get 1 recent posts I use:               <?php         $args = array( 'numberposts' => '1', 'meta_key'=>'_thumbnail_id' );        $recent_posts = wp_get_recent_posts( $args );        foreach($recent_posts as $post) : ?>           <?php get_template_part( 'content', '' ); ?>     <?php endforeach; ?>      And finally, to load 4 custom posts:               <?php         $getPorftolio = new WP_Query( 'post_type=portfolio&posts_per_page=4' );        if ($getPorftolio->have_posts()) {           while ($getPorftolio->have_posts()) {             $getPorftolio->the_post();                  get_template_part( 'content', 'portfolio-index' );           }     } ?>      Of course there are additional mark-up and content- ___ pages work just fine (separately work well). Problem is when it loads, the POST type post (where loads only 1) the info is mixed up. It loads correct title, correct featured image, but categories, tags, meta is empty and excerpt is from static page. As if it mixes where it should load static page info and post info. The biggest mistery - the same page works completely fine on my local WAMP. The test server: http://www.appuilab.com/sandbox/nerijusgood/ **EDIT** : I also added , which did not help at all. Also I have noticed that my tags/categories/post-meta is messed up on my blog (home.php) as well. So I figure maybe the problem is in the template part content.php (in both places this one is loaded). Meta is loaded with the same function in each page (in others it works just fine). Any ideas? I am _still_ bummed ;/