title: How to change the menu color

text:
I need to change the menu color of the wordpress 2011 theme to transparent. this is the header
<?php _e( 'Main menu', 'twentyeleven' ); ?>
                 <?php /* Allow screen readers / text browsers to skip the navigation menu and get right to the good stuff. */ ?>
<a class="assistive-text" href="#content" title="<?php esc_attr_e( 'Skip to primary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to primary content', 'twentyeleven' ); ?>

<a class="assistive-text" href="#secondary" title="<?php esc_attr_e( 'Skip to secondary content', 'twentyeleven' ); ?>"><?php _e( 'Skip to secondary content', 'twentyeleven' ); ?>
                 <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assigned to the primary location is the one used. If one isn't assigned, the menu with the lowest ID is used. */ ?>                 <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>                        As you can see, the menu uses php. I have no clue how to style php. Thanks


title: How can I force oEmbed to display fixed height & width dimensions?

text: I'm trying to explore new ways of embedding videos on to my site as a few of my contributors are having trouble viewing flash embeds when they use the preview function. Ideally it would be easiest to use oEmbed via the [embed] shortcode but i'm running into a problem that I don't seem to be able to find a solution for. I know that you can specify the maximum dimensions of the embed via the Media tab, but that is not what I want to do. Every single photo or video displayed on our site is 560px x 340px for continuity purposes and those are the dimensions I want to force onto the oEmbeds, but I cannot find a way to do it! Looking for help here as Google has been useless!


title: Protecting HTML5 video

text: I shall explain my situation as best I can so you can see where i'm coming from. I'm working on a wordpress site for a sports team, there are loads of teams. We want to put coaching sessions on our site. This is so that all the coaches can see how the sessions should be done as many are parent coaches. The problem is that there are a lot of coaches, in a very tight knit community, often families have kids in rival teams for other districts, so what we want to do is protect our material from either; just being downloaded by our coaches and shared with opposition coaches, or people who shouldn't have access to it in the first place, or people acquiring links to the videos and just accessing the videos themselves and possibly distributing them. There is a lot of movement with players and coaches between local teams. We need to maintain that all the work we are doing stays solely within our club and not allow somebody to leave and takes hours worth of footage and training sessions to a rival club. All the coaching sessions are in private pages, I did start using youtube unlisted videos to stream the videos in, but this is insecure as you can just get the link from the source code and distribute it. I'm now using HTML5 secure video player plugin, my videos are in a folder outside my document root, but it appears I can just right click the video and download it when it's playing in Chrome. This is obviously a problem too. I saw using a CDN may avoid this too, I have got a cloudflare account - I'm a little lost really with how to protect these videos. This is my first real venture with video. Does anybody have any advice in how to protect local HTML5 videos.


title: Efficiently sort only certain categories by custom field

text: I have a site with about 1,000 posts spread out over 70 or 80 categories. Some of these categories require the posts be sorted by a custom field, others not. I've got a working solution by having 60+ category template files defined (e.g. category-123.php, category-124.php) and each of those calls a separate loop file:               get_template_part( 'loop-123', 'category' );      The loop-123 file then runs a new query and sorts it correctly before passing it to the loop:               <?php     $the_query = new WP_Query("cat=123&meta_key=programnumber&orderby=meta_value&order=ASC");     ?>     <?php while ( $the_query->have_posts() ) : $the_query->the_post(); ?>      However, there has to be a more efficient way to do this than to create 60+ file pairs. I'm just not seeing it, though.


title: header_image not working after site copy

text: I did a copy of a production site to a development site, but the header_image doesn't work after the copy. The copy was done by doing a copy&replace of the host in the db dump file. Everything seems to work except that I now only get the default custom header image and not the one that was earlier configured for each site. I have looked into debugging this issue, but it gets complicated. Has anyone experienced this issue and know how to solve it?


title: How to make the link to the category for a post go to corresponding page number in archive?

text:
For instance, I am at http://url.com/single-post and in the post there is a link to the category that navigates to http://url.com/category/page/3/ which is the corresponding archive page that contains the current post. I'm trying to pass a global variable from archive.php to single.php but it is not working:               //archive.php      <?php     echo '$page: '.$page.'
';     global $postCatPagenum;     $postCatPagenum = $page;     echo '$postCatPagenum: '.$postCatPagenum;     ?>          //single.php     <?php     global $postCatPagenum;     echo '$postCatPagenum: '.$postCatPagenum;     ?>      Eventually I would like to make a function like this to run in single.php:               // Persistent category page     function persistant_cat_page() {       global $postCatPagenum;       $category = get_the_category();        if (!$postCatPagenum){           $pageUrl = '';       } else {           $pageUrl = '/page/'.$postCatPagenum;       }       if($category[0]){           echo 'term_id).$pageUrl.'">'.$category[0]->cat_name.'';       }     }      Thanks!


title: Get Posts updated or published within the last x hours

text: Okay, I'm trying to get posts that have been published within the last x amount of time, options being 8, 24 or 72 hours. I have the variables being passed to my featureHandler.php via ajax, then returning the posts, here is how I'm doing it:               $vars = $_GET['vars'];     $time = $vars[0];     $order = $vars[1];          if ($time == 8 ) {         function filter_where($where = '') {                  //posts in the last 8 Hours             $where .= " AND post_date > '".date('Y-m-d H:i:s', strtotime('-8 hours'))."'";             return $where;         }         add_filter('posts_where', 'filter_where', 10, $time);     } elseif ($time == 24) {         function filter_where($where = '') {                  //posts in the last 24 Hours             $where .= " AND post_date > '".date('Y-m-d H:i:s', strtotime('-24 hours'))."'";             return $where;         }         add_filter('posts_where', 'filter_where', 10, $time);     } elseif ($time == 72) {         function filter_where($where = '') {                  //posts in the last 72 Hours             $where .= " AND post_date > '".date('Y-m-d H:i:s', strtotime('-72 hours'))."'";             return $where;         }         add_filter('posts_where', 'filter_where', 10, $time);     }          ?>          <div class="article-wrapper">     <?php          query_posts(array(            'post__not_in' => get_option('sticky_posts'),      ));          $itemCount = 0;          while ( have_posts() ) : the_post();      This is semi working, I think, except that a post I just created, only shows up in 24 or 72, but not in the case that $time==8, why is that? And how can I make this code more efficient? Thank you SINCERELY.


title: filter the_content, custom post type, and wp_query

text: I thought this was going to be quick and easy, but naturally it's turning out to be more complicated. I'm writing a simple plugin that creates a custom post type "Ad", and then puts a random ad at the bottom of posts. So I've created my custom post type - that's easy. Then I created a few ads, and I want to put the featured image from a random ad at the bottom of a post. So I wrote a function to get a random ad's featured image, and then I wrote a function to filter the content and put the ad at the bottom of the post. Here's what I have:               function wpa_choose_ad() {         $args = array(              'post_type' => 'ad',             'posts_per_page' => 1,               'orderby' => 'rand',                          );         $the_query = new WP_Query( $args );              if ( $the_query->have_posts() ) {         while ( $the_query->have_posts() ) : $the_query->the_post();             $the_ad = the_post_thumbnail();         endwhile;         }         wp_reset_postdata();              return $the_ad;     }          function wpa_bottom_ad($content) {         $ad = wpa_choose_ad();              if( is_single() && is_main_query() ) {             $content .= $ad;         }            return $content;     }     add_filter('the_content', 'wpa_bottom_ad');      This puts the ad at the top of the post, and does nothing at the bottom of the post. I think somehow it's running my wp_query at the beginning of the post. What am I doing wrong?


title: Custom message if tag returns empty results

text: Is it possible to return a custom message if the tag search returns empty? On my menu i have a link as: www.domain.com/tag/example I don't want to remove the link but also it's a bit annoying if the user presses on this and he sees a blank page. At least a message "sorry there no results for this tag" would do! many thanks Andy


title: Using multiple line variable inside a function?

text:
I am using the commenting system to all users to add a private note that only they can see to posts and I am using the wordpress comments system to do it. I wrote a function to call the logged in user comments in a shortcode to display on their profile page. I can get this to work without passing it through a variable but it always shows up at the top of the page. I can't seem to call these variables inside the function. All I get is a blank page. Please take a look and tell me what I am doing wrong.               function notes_by_comments() {          global $wpdb;          $current_user = wp_get_current_user();          $note_content = '
Notes
';          $commentQuery = "SELECT * from $wpdb->comments WHERE user_id=$current_user->ID ORDER BY   comment_date DESC LIMIT 0 ,5";          $comments = $wpdb->get_results($commentQuery);     foreach ($comments as $comment) {          $note_content. = '
Note for comment_post_ID). '#comment-'.$comment->comment_ID .'">';     $note_content. = get_the_title($comment->comment_post_ID) . ' -';            if(get_post_type( $comment->comment_post_ID ) === 'for_sale_listings'){      $note_content. =  "Sale Listing";     } elseif (get_post_type( $comment->comment_post_ID ) === 'rental_listings'){     $note_content. = "Rental Listing";     } elseif (get_post_type( $comment->comment_post_ID ) === 'roomate_share'){     $note_content. = "Roommate Share";     }          $note_content. = '
' . $comment->comment_content . '

';          return $note_content;          }      }          add_shortcode('notes', 'notes_by_comments');


title: creating front end image uploader that uploads images as posts

text: there is this website lolhappens similar to 9gag. This is a website built over wordpress. How i am sure of this? check this link . Now to my best of knowledge this is a wordpress website where the images are shown as posts and their thumbnails(a fixed width and variable height) are shown of front page in a recent ones first order. Now here is my question: How did they implement a front end image uploader that ultimately shows that images as a posts.And how can i achieve similar functionality . If there are more than one ways what would probably be the recommended. Is there a plugin that has such functionality out of the box? Secondly is it also possible that the person who uploads the images sees a preview before finally clicking a button to it to the website Thirdly they have to add a minimum number of tags (predefined tags and users cant add their own) and a tick that says it is adult pic or not before they can submit it .


title: issues including a file from a plugin directory

text: I have a processForm.php _in theme directory_ that does what it says. I am trying to **include a file** (which i need in order to run a specific function in processform.php) from a plugin directory and have been unable to do so. As suggested in first solution in this thread I tried :               include( plugin_dir_path( __FILE__ ) . 'test-plugin/needed_file.php');       I was pretty sure this would work but unfortunately it throw a warning like so :               Warning: include(/home2/xxx/public_html/wp-content/themes/xxx/test-plugin/needed_file.php) [function.include]: failed to open stream: No such file or directory       * * * As said earlier the processForm.php lies in the theme directory and I have no issues anywhere else, calling files within the template directory. If this may help, there is alos a constant defined for this particular plugin's path which goes like this :               define('WPFP_PATH', plugins_url() . '/test-plugin');       So in accordance to a solution suggested here, I tried using code below :               include(WPFP_PATH . '/needed_file.php');      Unfortunately it throws three types of warning : First warning :               http:// wrapper is disabled in the server configuration by allow_url_include=0       Second warning :               failed to open stream: no suitable wrapper could be found in....      Third warning :               Failed opening 'http://awesomeness.com/wp-content/plugins/test-plugin/needed_file.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in.....      > So the bottomline is How do I include this file into my processForm.php ( > which is in root of theme directory).


title: one get_posts to return a number of custom posts for each meta value

text: I have setup a custom post 'product' with a custom field `cf_type`. I wish to have one `get_posts` that will return 20 total products, 10 products with `cf_type: fog` and 10 with `cf_type: gof`. Is that possible?               $args = array(         'post_type' => 'product',         'meta_query' => array(             array(                 'key' => 'cf_type',                 'value' => 'fog',   // need to have 10 with value 'fog' and 10 with value 'gof'             )         ),         'numberposts' => 10,         'orderby' => 'modified',         'order' => 'desc'      );     $prodslist = get_posts( $args );`


title: Xili language plugin not showing language flag

text: I just updated my wordpress version to 3.4.2 and I installed xili-language plugin v. 2.8.1   Everything works quite nice except one detail - I have 2 languages pl & english. I uploaded icon for polish flag to _../twentyten-xili/images/flags_ where I have other flags, but wordpress won't show it in navigation menu. Meantime it is showing flag for english. I named file pl_pl.png and it has the same width and height as other flags. What is more curious - I did it on localhost (but with twentyeleven-xili theme) and it worked smoothly.   Any idea? edit: link to plugin http://wordpress.org/extend/plugins/xili-language/


title: Recent Comments from Specific Category Widget

text:
I've been trying to create a sidebar widget to display recent comments from specific category. I'm having difficulties in determining how Wordpress knows from which categories the comments are. I have checked the codex on `get_comments` function but it doesn't seem to allow fetching from specific categories. I've found some hints from Kovshenin's blog, but can't seem to make it work properly, because my try either shows all comments (disregarding the categories) or doesn't show it at all. I'm basing the widget from `Widget_Recent_Comments` (found from `wp- includes/default-widgets.php`). Here is what I have so far. I believe the output is controlled around this area:                   $output = '';         $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Recent Comments' ) : $instance['title'], $instance, $this->id_base );              if ( empty( $instance['number'] ) || ! $number = absint( $instance['number'] ) )             $number = 5;              $category_name = empty( $instance['category_name'] ) ? '' : $instance['category_name'];              $comments = get_comments( apply_filters( 'widget_comments_args', array( 'number' => $number, 'status' => 'approve', 'post_status' => 'publish' ) ) );         $output .= $before_widget;         if ( $title )             $output .= $before_title . $title . $after_title;              $output .= '
';         if ( $comments ) {             foreach ( (array) $comments as $comment) {                 $output .=  '
' . /* translators: comments widget: 1: comment author, 2: post link */ sprintf(_x('%1$s on %2$s', 'widgets'), get_comment_author_link(), 'comment_ID) ) . '">' . get_the_title($comment->comment_post_ID) . '') . '
';             }         }         $output .= '
';         $output .= $after_widget;              echo $output;      And here is the full codes: http://pastebin.com/VH666jty Basically my widgets is similar to the default Recent Comments widget. Only that it has an optional `Display comments only from category/categories: ...`, where user could input by themselves. Leaving it blank will display comments from all category, while putting some category slug, separated by comma (e.g.: `mycategory,othercategory`) will display comments only from those selected categories.


title: Exclude ALL posts from sub categories

text: Need help with a wordpress-task I want ALL the posts from sub categories to be excluded. Example:   * Cake      * Pie        * Apple       * Pear       * Banana If i post a post in Banana, i don't want it to show up in Pie or Cake. I just want posts that are posted in banana to show in banana, not in the top categories. How can i do this? I found a code for it to put in functions.php but and it does the trick with the first category, but not the second.               function fb_filter_child_cats($query) {     $cat = get_term_by('name', $query->query_vars['category_name'], 'category');     $child_cats = (array) get_term_children( &$cat->term_id, 'category' );     // also possible     // $child_cats = (array) get_term_children( get_cat_id($query->query_vars['category_name']), 'category' );     if ( !$query->is_admin )     $query->set( 'category__not_in', array_merge($child_cats) );     return $query;     }     add_filter( 'pre_get_posts', 'fb_filter_child_cats' );


title: Load comments per post on click with AJAX

text: I'm working on a theme that uses a slider to display blog posts. Beneath the slider is a pagination that displays like a timeline, with a date instead of a page number, calling the corresponding blog post. I want to display the comments for each post, but outside the slider. So, I have this code in my header, to get the comments with ajax: :: EDITED (now using **wp-admin/admin-ajax.php** to handle request, as advised below) ::               $(".timeline-entry a").live('click', function(event) {       event.preventDefault();       $.ajax({          url: '<?php echo admin_url('admin-ajax.php'); ?>',          type: 'POST',          action: 'do_ajax',          data: {             'post_id' : '72' //using a post id that I *know* has comments, for testing!          },          dataType: "json",          success: function(myResult) {             alert(myResult);          },          error: function(error) {             alert(error);          }       });     });      In my functions.php:               add_action('wp_ajax_nopriv_do_ajax', 'retrieve_comments');     add_action('wp_ajax_do_ajax', 'retrieve_comments');          function retrieve_comments(){               $myPost = $_REQUEST['post_id'];         $output = get_comments('post_id=' + $myPost);         $output = json_encode($output);                   if(is_array($output)){                      print_r($output);                      }                   else{                      echo $output;                   }                   die;     };       I get `0` in the alert box... so that means the ajax is happening, but something is wrong with my php function, right? Thanks for your help.


title: WBR tag breaking hyperlinks

text: I was investigating the cause of hyperlinks breaking on a friend's website. She copies over her content from email and pastes it in the Wordpress editor. In a few articles, the content between the a tags has wbr in it and that seems to break the hyperlinks. You can find it on http://chandni.org/information- about-awards-scholarships-and-more/ In case it's fixed by the time you see the thread, the copied content               http://www.msrlm.org/mrlif/<wbr />faqenglish.html      what is shown by wordpress               http://www.msrlm.org/mrlif/<wbr>faqenglish.html      I am guessing it's due to the fact that it uses and not . Should I replace the former with the latter? Looking for inputs from people who're familiar with wbr tag.


title: Automatically Assign Parent Terms When A Child Term is Selected

text: I have deep hierarchical taxonomy and I want to have all parent term assigned when I select a child term. I need it for category structure on a online listing/classified site. **CPT name:** `product` **Taxonomy Name:** `product_cat`


title: add_action in functions.php, do_action in plugin?

text: I am trying to set an `add_action` function in my currently active WordPress theme `functions.php` file, for a defined `do_action` function within an activated WordPress plugin. The `add_action` function in my currently active WordPress theme `functions.php` file doesn't work. However, it works if I copy the `add_action` function from my currently active WordPress theme `functions.php` file into the activated WordPress plugin file right before the `do_action` function. Is there a way to do this?


title: Defining a global array in functions.php?

text: I try to create an array of years, which is avaible in my template-files and in at least one other function in the functions.php.               function get_the_years()      {         global $year_arr = range(2001, date('Y'));         return $year_arr;     }      Then I want to use it in a function, which creates a term for every year in the custom taxonomy 'year'.               function create_year_terms() {     foreach($year_arr as $value){            $term = term_exists($value, 'year');             if ($term !== 0 && $term !== null) {                 echo $value . ' category exists!';             }             else { wp_insert_term(                 $value, // the term                  'year', // the taxonomy                 array(                     'description'=> 'The name of a year',                     'slug' => $value )                 );                 echo'term '. $value . ' created';             }         }      } And trying to attach this function to the wp_login hook               add_action('wp_login', 'create_year_terms');      I tried to make my hoeworks and I guess I understand "something" but I'm a bit scared to kill something by putting wrong stuff in my functions.php, so please excuse my question.


title: why when I try to insert an image attachment along with a post does wp_get_attachment_url give me a very wrong file path?

text: I am using a new blog on WPMS (3.0.1, updating is not an option) to aggregate posts (and their featured image) from a few blogs on the same install, and I have to do it programmatically rather than through a pre-made plugin due to firewall restrictions. I've tried several ways of doing it, and feel like this method is most promising. Here's what I've cooked up:               switch_to_blog(oldblognumber);     $zargs  = array( 'numberposts' => 1, 'category_name' => 'featured');     $zlastpost = get_posts( $zargs );     foreach($zlastpost as $post) : setup_postdata($post);         $extrapost = array();         $extrapost['post_title'] = get_the_title();         $extrapost['post_content'] = get_the_content();         $extrapost['comment_status'] = 'closed';         $extrapost['post_status'] = 'publish';         $extrapost['post_date'] = get_the_date( $d = 'Y-m-d H:i:s');         $extrapost['post_category'] = array(80);         $upload_dir = wp_upload_dir();         $oldid = get_the_ID();         $image_url = wp_get_attachment_url(get_post_thumbnail_id($oldid));         $image_data = file_get_contents($image_url);         $filename = basename($image_url);         switch_to_blog(newblognumber);                       $file = $upload_dir['path'] . '/' . $filename; //removed the conditional cuz it was giving me trouble             file_put_contents($file, $image_data);             $post_id = wp_insert_post($extrapost);             $wp_filetype = wp_check_filetype($filename, null );             $attachment = array(                 'post_mime_type' => $wp_filetype['type'],                 'post_title' => sanitize_file_name($filename),                 'post_content' => '',                 'post_status' => 'inherit',             );                               $attach_id = wp_insert_attachment( $attachment, $file, $post_id );             require_once(ABSPATH . 'wp-admin/includes/image.php');             $attach_data = wp_generate_attachment_metadata( $attach_id, $file );             wp_update_attachment_metadata( $attach_id, $attach_data );             set_post_thumbnail( $post_id, $attach_id );                                restore_current_blog();         wp_reset_postdata();     endforeach;     restore_current_blog();      The post insertion works just fine, and it pulls the image alright, but somewhere in there things are getting muddled and it spits out an absurd attachment url: http://myblogs.com/newblog/wp- content/blogs.dir/newblognumber/files//internet/http/wp- content/blogs.dir/oldblognumber/files/year/month/filename.jpg. Likewise, in the loop where I ask for the_post_thumbnail, I get a broken image whose src is http://myblogs.com/newblog/files//internet/http/wp- content/blogs.dir/oldblognumber/files/year/month/filename-200x100.jpg For what it's worth, since I'm using a pre set_post_thumbnail version of WP, I just manually define the function in my newblog's functions.php:               function set_post_thumbnail( $post, $thumbnail_id ) {     $post = get_post( $post );     $thumbnail_id = absint( $thumbnail_id );     if ( $post && $thumbnail_id && get_post( $thumbnail_id ) ) {        $thumbnail_html = wp_get_attachment_image( $thumbnail_id, 'thumbnail' );        if ( ! empty( $thumbnail_html ) ) {            update_post_meta( $post->ID, '_thumbnail_id', $thumbnail_id );            return true;        }     }     return false;     }      I've tried fudging GUIDs and using regular expressions to force urls into submission among other things, but all to no avail. Please let me know if you have any guidance for me! * * * I have also tried an alternate method of setting the post thumbnail of an inserted post, but this simply calls the original file in the oldblog's upload directory, which will not suffice, as I'd like to generate new image sizes for the newblog's Media Library, and I'd prefer to not go through and add them to each of the original oldblogs. Here's that attempt:               switch_to_blog(oldblognumber);     $zargs  = array( 'numberposts' => 1, 'category_name' => 'featured');     $zlastpost = get_posts( $zargs );     foreach($zlastpost as $post) : setup_postdata($post);         $extrapost = array();         $extrapost['post_title'] = get_the_title();         $extrapost['post_content'] = get_the_content();         $extrapost['comment_status'] = 'closed';         $extrapost['post_status'] = 'publish';         $extrapost['post_date'] = get_the_date( $d = 'Y-m-d H:i:s');         $extrapost['post_category'] = array(80);         $oldid = get_the_ID();         $thumbo = get_the_post_thumbnail($oldid);         $filename = wp_get_attachment_url( get_post_thumbnail_id($post->ID) );         switch_to_blog(68);             $post_id = wp_insert_post($extrapost);             $wp_filetype = wp_check_filetype(basename($filename), null );                 $wp_upload_dir = wp_upload_dir();                 $attachment = array(                     'guid' => _wp_relative_upload_path( $filename ),                      'post_mime_type' => $wp_filetype['type'],                     'post_title' => preg_replace('/\.[^.]+$/', '', basename($filename)),                     'post_content' => '',                     'post_status' => 'inherit'                 );                 $attach_id = wp_insert_attachment( $attachment, false, $post_id );                 require_once(ABSPATH . 'wp-admin/includes/image.php');                 $attach_data = wp_generate_attachment_metadata( $attach_id, $filename );                 update_post_meta( $post->ID, '_thumbnail_id', $attachment_id );                 wp_update_attachment_metadata( $attach_id, $attach_data );                 set_post_thumbnail( $post_id, $attach_id);                     restore_current_blog();             wp_reset_postdata();         endforeach;     restore_current_blog();           I've tried feeding a number of things to wp_insert_attachment's $filename parameter, but that doesn't seem to be my answer.


title: WordPress Script Loading/Unloading -- wp_deregister_script('jquery')

text: I have a few questions relating to WordPress loading / unloading up javascript tools. After reading a nicely written response to a question by Pieter Goosen, that got me to do a bit of studying and a clean up of the code I'm using to load up my libraries. This code is from my child-theme's function.php file. I've got a few functions on my site that use the datepicker calendar tools. Additionally there are a few plugins that I'm sure use jQuery.               function jquery_loadup() {             //wp_deregister_script('jquery');    <--- ?H             wp_enqueue_script('jquery');             //wp_enqueue_script('jquery-migrate');             wp_enqueue_script('jquery-ui-core');             wp_enqueue_script('jquery-ui-datepicker');             wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css');     }     add_action('wp_enqueue_scripts','jquery_loadup');      I was under the impression that the line `wp_deregister_script('jquery')` essentially resets/clears all previous 'requests' for the jquery scripts so they don't interfere with one another. That line followed by `wp_enqueue_script('jquery');` should result in a minimal clean load of jQuery via the WordPress commonly used scripts registered handle / script paths system, no? I would think that the deregister call tests for the presence of a previous 'install' for jquery, and if it finds one or more, stops their loading, if none are registered, do nothing. What I'm seeing is that when I use the `wp_deregister_script('jquery')` I'm get an error on the websie `"ReferenceError: jQuery is not defined"`. When this happens, all of my JavaScript functions fail. What the heck? When remarked out, the site functions fine. Questions: Am I missing something? What am I not understanding about the deregister call? Why would I be getting an error message? Note, the line in there for `jquery-migrate` is supposed to be for software using older versions of jQuery. I tested it, but I can't see that it does anything on my site, so I've taken it out to improve download and response times. Question: Is that a bad idea? references:   * Excellent Reply on Script Loading by Pieter Goosen   * WordPress Codex on Enqueue Script


title: Need webcam chat plugin for my client

text: I am developing a website where I need a webcam chat plugin. I have tried many plugins from wordpress.org but none of them worked. Can anyone please suggest me a working plugin. Plugins that did not work:   1. TokBox OpenTok Plugin **Problem** : > In the dashboard,it only pops up once i.e the first time the plugin is used > and still the button to start webcam did not work(Also note that it did not > show up my webcam.) **Resolved:** The problem was with the dashboard. I uploaded the files and it started to work . Thanks 2\. Tinychat** **Problem** : > Was unable to find API for it.   1. VideoWhisper Video Presentation **Problem** : > Keeps on loading and does not work Thanks.


title: How to stop wordpress mangling R syntax '<-'?

text: I have a self-hosted WP install, and have been using codecolorer (and have tried a few others along the way) to highlight R syntax. Looks nice, too. The problem is that R uses a `<-` symbol instead of `=` when assigning objects (on pretty much every single line), and when you switch from 'Visual' to 'HTML' while editing a post it will mangle the code - `<-` becomes `<-`; worse, sections of the code will disappear. It would be possible to use `=` for the 'assign' command but it's not, strictly-speaking, correct. At the moment I have to do all the pretty writing and inserting of images in WYSIWYG 'visual' mode, then switch to HTML just before I post to fix up the R code, and then be careful _never_ to switch back again. Ever. Any fixes for this behaviour? EDIT: examples! Putting this into the Visual editor:               [cc]     lorum <- ipsum     [/cc]      Produces the following in the _final post_ :               lorum <- ipsum      Going back to HTML mode and putting a `<-` code worked _for the final post_ but then I could never switch back to Visual without the `<` being interpreted as part of a tag.


title: Delete post with all files attached to it

text: On my site I have multiple authors, who can add/edit/delete custom posts and upload (attach) images to those posts. The problem is - when they delete their posts, attachments stay on the server. So, I would like to get rid of all files attached to the post when it gets deleted. Can anyone share and example how it's done?


title: Enqueue script only for IE

text: I want to use dd belatedpng so the PNG's on my website appear properly on IE. The script I've always used on non-wordpress websites was               <!--[if lt IE 7 ]>         <script src="js/dd_belatedpng.js"></script>         <script> DD_belatedPNG.fix('img, .ir'); </script>     <![endif]-->      Now that I need to use it on a Wordpress website, I'm trying to find a way of adding script using enqueue script, although I don't like it at all. At the end of the day, the theme is only going to be used on a single website, I'd prefer to hardcode the scripts path. Anyway, is there a way of adding IE conditionals to enqueue script and or register script?


title: Add Column to Term Database

text:
Currently the Term Database has four columns. `term_id` `name` `slug` `term_group`. I would like to add another column called `menu_order`. How can i do this? The outcome i want is to be able to order my custom terms. If anyone knows of a beter way to do this please let me know. So far i already have code that sets up the input box. I just need help trying to order it using the `get_terms()` function.               add_action ( 'section_edit_form_fields', 'create_section_menu_order');     function create_section_menu_order( $tag )      {         //check for existing featured ID         $section_order = get_option( 'section_menu_order' );         $order_id = '';         if ( is_array( $section_order ) && array_key_exists( $tag->term_id, $section_order ) ) {             $order_id = $section_order[$tag->term_id];         }         ?>
                 <?php _e('Order') ?>	                                      <input type="text" name="section_menu_order" id="section_menu_order" size="10" style="width:60px;" maxlength="6" value="<?php echo $order_id; ?>">
                     The order your Sections will show. (Numeric digits only)
         <?php     }          add_action ( 'edited_section', 'save_section_menu_order');     function save_section_menu_order( $term_id )      {         if ( isset( $_POST['section_menu_order'] ) && is_numeric($term_id))          {             $section_menu_order = get_option( 'section_menu_order' ); //load existing category featured option             $section_menu_order[$term_id] = intval( $_POST['section_menu_order'] ); //set featured post ID to proper category ID in options array                update_option( 'section_menu_order', $section_menu_order ); //save the option array         }     }


title: Can I make simple global tooltips in Wordpress?

text: We wish to have ALL external links within a Wordpress site have a simple mouseover tooltip without having to place a title tag or rel or class tag within it. I've tried several methods using the $('a[href=http]') selector but can not for the life of me get anything to work. Here is the code I came up with that does work in a standard HTML page but can't get it to work within Wordpress. In theory this sounds so simple: find all external links and when moused over display this tooltip text...                     ANY help with this would be unbelievably appreciated!


title: Make a menu visible for a single category and it's content

text: I'm working on a site with 3 major sections. Therefore I want to create archives for each section and those archives should be visible only in the category page and it's posts.   At this point, I made the menu visible only for the category page, but when I open a post, the widget is not displayed. How do I create archives for specific categories, and how do I display them in a specific category and its posts?


title: How to add an anonymous function in wordpress hooks by removing create_function

text: Currently I have the code below which I would like to replace `create_function` with some anonymous function. How can this be done?               add_action('widgets_init', create_function('',           'return  register_widget("time_more_on_time_widget");'     ));


title: Dynamically excluding current page id

text:
I'm attempting to create a "related posts" section on pages using query_posts. I'm wanting to use this simply because we want to show random posts from one category on one page, so a plugin would be overkill. The problem I'm having is dynamically excluding the current page the user is on from the list. Here's the code I'm using and I've tried several methods to exclude the current page but none have worked.               <?php          // The Query     $post_id = get_the_ID();     query_posts("showposts=4&post_type=page&post_parent=168&orderby=rand&exclude='. $post_id .'");          // The Loop     while ( have_posts() ) : the_post();     echo '
';     the_title();     echo '
';     endwhile;          // Reset Query     wp_reset_query();          ?>      Am I going about this wrong or am I using the incorrect code or both? TIA! **On Edit:** After Milo's suggestion, I got to looking again and combined with his reply and a post on the WP forum, I got it to work with the following (seems 'exclude' didn't want to work for this):               <?php         $this_post = $post->ID;         global $post;         $args= array(             'post_type' => 'page',             'posts_per_page' => 4,             'post_parent' => 168,             'orderby' => 'rand',             'post__not_in' => array($this_post)          );     $rel_posts = get_posts($args);     foreach($rel_posts as $post) :     setup_postdata($post);     ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
     <?php endforeach; ?>


title: SSO system between 2 WordPress installs on different servers

text: This is essentially a repeat of this question, but it has not been answered. I am trying to create an SSO system between two separate WordPress installs that are on different servers using different databases. The main site has a full database including a users table containing over 300,000 users. Because of the size of the users table, we do not want to replicate each of them on the second site or do a traditional SSO system where each user is created in the database as they login. Ideally, we would like to reference the users table on the main site and use those same users on the second site. So far I have tried using wp_remote_post() to send a user object to the second site while overriding the pluggable.php functions and setting the $current_user global with the posted user object. This, however, isn't working as well as I'd hoped because the methods that are normally available in the WP_User object are not available in the posted object, which results in fatal errors when methods like $user->exists() are used. I am aware of the CUSTOM_USER_TABLE solution, but that obviously won't work in this example as the sites are on separate servers with separate databases. **TL;DR:** Need SSO. Separate servers. Help.


title: Create custom archive page for individual authors which is separate from the author.php page

text: If this is a duplicate, I apologize. I have searched and searched with no luck. I have a custom author.php set which shows the most recent 10 posts (As it's set in the admin panel under General > Reading). I want to have a link to "View all posts by this author". This will link to a page showing all posts by that specific author. All the information I've found has been about the author.php page which I don't want to change. Thanks


title: 404 on author page using custom permalinks and pagination

text: I have some author pages in my theme (using a modified version of the UDesign theme and the Pagenavi plugin. Pagination works on the blog, but not on the author pages. I'm getting 404's on the author page urls. This works: xxxx/author/dr-fiona-nd/ This does not: xxxx/author/dr-fiona-nd/page/2/ Both of these work: xxxx/blog/ xxxx/blog//page/2/ Where do I start on this? I've seen lots of posts about custom content types, but this is a standard post. I've seen other information on adding custom rewrite rules and endpoints, but I'm thinking there's probably some other standard CMS based solution for this, am I wrong? Looking for some direction, thanks for any help!


title: using theme check plugin to remove waring and errors from my theme

text: i have solve the most of issue now only the followings issue reaming. 1.the most important WARNING: curl_init was found in the file twitteroauth.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls. Line 195: $ci = curl_init(); WARNING: curl_exec was found in the file twitteroauth.php File operations should use the WP_Filesystem methods instead of direct PHP filesystem calls. Line 221: $response = curl_exec($ci);


title: Display Featured Image

text: I am having some issues trying to get featured image to appear on my front page. I am using Genesis, then genesis child theme. I only want the featured image to appear on my `front-page.php`. I know I need to write a custom loop in order for the featured image to appear only. However I am having trouble completing it.I am not sure what code to write into my custom loop. I did this:               /** Code for custom loop */     function my_custom_loop() {          }          /** Replace the standard loop with our custom loop */     remove_action( 'genesis_loop', 'genesis_do_loop' );     add_action( 'genesis_loop', 'my_custom_loop' );


title: Hook pages by id on static front-page

text: I would like to build a one page website upon the Wordpress CMS. I'm looking for a way too hook my pages on a static frontpage by id, since I have several page types. I've tried:               $id=6;      $post = get_post($id);      $content = apply_filters('the_content', $post->post_content);      echo $content;        But this returns only the content and not the content with the HTML. Any tips on how to achieve this?


title: How do you edit the html of teaser excerpts

text: All my teaser excerpts have no formatting applied to them. With firebug I can get the text to look how I want by editing the html but I don't know where to edit the html in wordpress. How can I do this? Thanks


title: Are post, page and category IDs unique to each other?

text: I was looking for a function to get all ancestors of a post **or** category and found get_ancestors( $object_id, $object_type ). To my surprise, the Codex shows that the second parameter is required:               $object_type             (string) (required) The name of the object type (page, hierarchical post type, category, or hierarchical taxonomy) in question              Default: None       Aren't post, page and category IDs all unique to each other, i.e. the intersection of their sets would be empty? If not, why not? It only seems to complicate an API if you have to specify the object type given that posts, pages, and categories are all data objects of a single CMS.


title: Show Custom Field

text:
i am using WCK - Custom Fields and Custom Post Types Creator. I am have code for show image.                       <?php      $my_meta = get_post_meta( $post->ID, 'my_meta_name', true );      if( !empty( $my_meta[0]['avatar'] ) ){         $src = wp_get_attachment_image_src( $my_meta[0]['avatar'], 'full' );         echo '';      }     ?>      Ok! Need show url, after my iditing code i am view postid on site:                  <?php      $my_meta_archive = get_post_meta( $post->ID, 'Books1', true );     if( !empty( $my_meta_archive ) ){         foreach( $my_meta_archive as $entry ){             $attch = wp_get_attachment_url( $id );             echo '123'.$attch[0].'123';         }     }     ?>      and                   $my_book_url = get_post_meta( get_the_ID(), 'Books1', true);              if( ! empty( $my_book_url[0]['archive'] ) ) {                  echo '
Link: ' . $my_book_url[0]['archive'] . '
';         }          ?>      Its code show me Post ID                    <?php      $my_meta_archive = get_post_meta( $post->ID, 'my_meta_name', true );      if( !empty( $my_meta_archiv[0]['archive'] ) ){            echo '22'.wp_get_attachment_url( $my_meta_archiv[0]['archive'].'22';      }     ?>      Its code not display View documentation ty


title: Dashboard Contact Form

text: Is there a way to make a dashboard contact form widget? I just simply want to have it there so users can give feedback directly from their dashboard.


title: Post OrderBy slow performance

text: I have been struggling for quite a while now with this, to put in simple term here is what i do.   * I do an OrderBy with wp_postmeta information   * This allow me to give an additional date to play with. Reasons for this is i want my users to be able to modify a post without changing the current Order which shows on the main and category pages. This extra date is also used to determined if a post was an "Updated Article" meaning it contains additional information. The whole process works flawlessly so far but having a database containing over 40K+ posts in the database each having this meta_key makes it heavy on the queries. Caching is done also with Transient Cache and secret sauce from the Hosting Provider. But the caching process doesn't seem to help all that much. So i'm open to critics and suggestion to make the whole process better. Additional Info:   * Avg Query time is : 5 sec   * Query is done via object WP_Query.                   SELECT SQL_CALC_FOUND_ROWS  wp_posts.ID FROM wp_posts             INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)             INNER JOIN wp_postmeta AS mt1 ON (wp_posts.ID = mt1.post_id)           WHERE 1=1  AND wp_posts.post_type = 'post'             AND (wp_posts.post_status = 'publish')             AND (wp_postmeta.meta_key = '_post_updated_date'             AND mt1.meta_key = '_post_updated_date' )           GROUP BY wp_posts.ID           ORDER BY wp_postmeta.meta_value DESC LIMIT 0, 10


title: Archive pages: sorted by custom field value

text: I'm using a custom field – entry_type – to add types to posts, for example, Gallery or Announcement etc. On my archive pages, I want to then separate out the post types stored in entry_type. For examples: Archive: Maths Galleries: Maths gallery 1 Maths gallery 2 Announcements: Maths announcement 1 Maths announcement 2 So far I've got: http://pastebin.com/mRBKGBQD However, this is pulling in all posts in any category where entry_type is equal to gallery. How can I make it just return the results within the current categories archive?


title: Get category ID in "archive-product.php"

text: How can i get the category ID in the `archive-product.php` template? I tried to get this information with the `$category` var, but this var isn't accessible in this template file.


title: Use Custom Field As Meta Box In Post

text: I recently asked on this forum how to create a beta box using custom field, which was answered but with a not so right answer, but it helped me. For example, there's a custom field that I use called - the-field. I want to add a simple meta box (textbox) to my post editor which will set the value of my custom field from that meta box, not its own value. Is there any way to do that?


title: Malware in header.php

text: Four different websites got infected and been blocked by Google, and after a quick look, I've noticed this just before wp_head():               <?php      #d93065#     echo(gzinflate(base64_decode("tVVNj5swEP0... (edited out) hH5m7L/5+/gM=")));     #/d93065#     wp_head(); ?>      I have cleaned the code but this reappeared after a few hours. Then again and again. I thought that timthumb is the culprit, but this happened on a WordPress without timthumb aswell as I've scanned it previously with timthumb vulnerability scanner. There's nothing suspicious in htaccess, wp-config and the files everyone is talking about, from wp-includes, have checked all the js files, nothing, nothing, nothing. **What could it be, how do I get rid of this?**


title: How to customize my category pages

text: I'm an experienced php programmer, but a wordpress newbie. My site uses the theme twenty eleven. I have created some post categories, and some posts for each category. On my site, for each post category, a page has automatically been created displaying the posts for that category. So far so good. What I would like to do now is do some customization. For example:   1. For some categories, I want the full content displayed, but for others, just the synopsis.   2. For some categories, I want the page to have a link to the permalink of the posts being displayed, but for others not.   3. For some categories, I wish to display the post's featured image, but for others not. Etc. How do I accomplish this? I'm aware of the various php files, such as header.php, etc. It appears that the file that handles category pages is category.php and inside it is a loop "while ( have_posts() )". Is there one php file that I'm supposed to edit and customize to accomplish what I need? (Maybe content.php?) Or is different from this? I would be grateful for any assistance.


title: How can I stop wordpress translating my page template names

text: I am using wordpress multisite to manage different language versions of my site. This is the code I am using to achieve this               /**     * Language Support     */     add_filter( 'locale', 'my_theme_localized' );     function my_theme_localized( $locale )     {     global $blog_id;          if($blog_id==2) {         return 'de_DE';     } elseif($blog_id==3) {         return 'jp_JP';     }          return $locale;     }     add_action('after_setup_theme', 'my_theme_setup');          function my_theme_setup(){         load_theme_textdomain('mac', str_replace('mac-mobile', 'mac', get_template_directory()) . '/languages');     }      This all working fine but I've just noticed that wordpress is translating my template names. I want the back end of every site to remain in english so this is a little annoying. Other than naming my templates to a word or phrase that doesn't feature in my .po file is there a way to stop wordpress translating my page template names?


title: Custom post type plugin archive page doesn't work?

text: I am creating a custom post type plugin. In that I have added a custom archive template and single page template. The single page template works fine, whereas the archive template is not working.               function astest_register() {         $args = array(             'public' =>true,             'has_archive' => true,             'capability_type'  => 'post',             'menu_icon' => plugins_url('images/as-icon.png', __FILE__),             'menu_position'=> 100,             'label' =>'AS-Testimonial',             'taxonomies' => array('category'),             'supports' => array(                 'title',                 'editor',                 'thumbnail',                 'register_meta_box_cb' =>'astestimonial_metaboxes'             )         );              register_post_type('astest', $args);         flush_rewrite_rules();     }     add_action('init', 'astest_register');


title: Strip 'p' tags in wp_trim_excerpt()

text:
When I have a lot of paragraphs in a post and trying to display an excerpt in blockquote, all `<p>` tags are stripped, and whole 55 words are in one `<p>` tag.
       <?php the_excerpt(); ?>
      Result:

First paragraph. Second paragraph. Third paragraph.

      I want it to be:

First paragraph.

Second paragraph.

Third paragraph.

      I tried:               function improved_trim_excerpt($text = '') {       $text = strip_tags( $text, '
' );     }     add_filter('the_excerpt', 'improved_trim_excerpt');      But this does not work. Can you guys help me out? Any help is very appreciated.


title: How to access global $wp_meta_boxes variable on front-end?

text: Is there a way to take the global `$wp_meta_boxes` variable to be used in the front-end? Currently the `$wp_meta_boxes` is accessible on specific admin pages only. I've found a similar question about this. Its solution is to get the data via the `do_meta_boxes` hook, but I would like to access the variable without JS/AJAX, and in a front-end template.


title: Display Something in the Header After All Styles are Loaded

text: I'd like to include a functionality in a theme that will overwrite styles from previously included CSS files. For this purpose, I need to be able to display a `<style>` in the header after ALL stylesheets have been displayed. Is there a hook to do this?


title: Include and Exclude Taxonomies From Archives & Feeds Using 'pre_get_posts'

text: ## What I am trying to do? My blog uses a custom taxonomy called `edition` with terms like `us-canada` (6), `eu` (7) and `india` (8) -- term slug (ID). I want to make sure that posts **not assigned to any specific 'edition'** be shown under all the terms (i.e. if a post is not assigned to usa, europe or india, it'll be shown in the archive pages of all these terms). ## What I've tried? Here's the sample code pertaining to one of the terms, which should give you an idea of what I am exactly trying to do, and what I'd be doing wrong.               add_filter('pre_get_posts','better_editions_archive');          function better_editions_archive($query) {              if ( $query->is_tax( 'edition', 6 ) && $query->is_main_query() ) {             $query->set( 'post_type', array( 'post' ) );                  $query->set( 'tax_query',                 array(                     'relation' => 'AND',                     array(                         'taxonomy' => 'category',                         'field' => 'id',                         'terms' => array( 1, 2, 4, 5 )                     ),                     array(                         'taxonomy' => 'edition',                         'field' => 'id',                         'terms' => array( 7, 8 ),                         'operator' => 'NOT IN'                     )                 )             );         }              return $query;     }      **What's wrong?** The aforementioned code doesn't work (others I've tried: code-1, code-2), it's doesn't change anything. There's no debug error either. So, what could I be doing wrong? **ALSO** , to make sure that the changes also apply to feeds of these terms, I replaced the relevant line in the aforementioned code with this:               function better_editions_archive($query) {              if ( ( $query->is_tax( 'edition', 6 ) && $query->is_main_query() ) || ( $query->is_feed() && $query->is_tax( 'edition', 6 ) ) ) {      But that starts to redirect the terms' feeds back to the terms' archives. That is, with the function in place, `example.com/edition/usa/feed/` redirects back to `example.com/edition/usa/`. Again, I've no clue as to what I'd be doing wrong. ## UPDATE: What's worked for me? (But...)               add_filter( 'pre_get_posts', 'better_editions_archive' );          function better_editions_archive( $query ) {         if ( $query->is_tax( 'edition', 6 ) && $query->is_main_query() ) {                  $args = array(                 'post_type' => 'post',                      'tax_query' => array(                     'relation' => 'AND',                     array(                         'taxonomy' => 'category',                         'field' => 'id',                         'terms' => array( 1, 2, 4, 5 )                     ),                     array(                         'taxonomy' => 'edition',                         'field' => 'id',                         'terms' => array( 7, 8 ),                         'operator' => 'NOT IN'                     )                 )             );                  $query->query_vars = $args;         }              return $query;     }      It works, but the problem is, I'd an extended chat discussion with a knowledgeable WordPress developer, and he told me this (you can follow the full conversation here, but it's too lengthy): > And you're then assigning this array as the `query_vars`. Now the > `query_vars` is a pretty large object. And you're basically overwriting the > data in there and just adding your custom ones. This means that you 'unset' > everything that is added per default. He pretty much advised against using this solution, and instead go with the `$query->set();` method. But as you can see far above, I couldn't get the other one to work. So I am here to see if anyone can tell me what I am doing wrong, in a less-technical- speak.


title: JQuery load php - php file without the template

text: I'm about to start writing a php file that will return a JSON array to be used as a JQuery autocomplete source. I want to create my source.php file that loads without the WordPress template. Currently /includes/source.php contains:               <?php     echo "hello world";     ?>      But if I go to http://www.mywordpress.com/includes/source.php I instead get the templated 404 page. How can I avoid this? EDIT in response to the comments, here is my htaccess file:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


title: Add class to DIV depending on page loaded

text: I'm designing a new theme and in my page template a have a section where an image is displayed . I would like this image to change depending on which page is loaded. The section is a DIV like this: `<DIV class="ximage"></DIV>` What I would like to do is to add a class to the DIV depending om page loaded and then style the class with background-image in CSS. I know you can do this with for example body_class() if you want to add classes to BODY. But how do I do this with a DIV? There will be quite a few pages in this theme, so ceate a template for each page seems wrong.


title: Insert "New User" and update/set meta data at once

text: The wordpress function wp_insert_user doesn't seem to set (overwrite) the input I give. (documentation shows you can't) Trying to use: wp_insert_user using the returned userID also doesn't work. Of course I could just make my own query but maybe I'm forgetting an option to insert this data using a existing function.               $userdata = array(         //user login         'user_pass'  => esc_attr( $_POST['pass'] ),         'user_login' => esc_attr( $_POST['user'] ),         'user_email' => esc_attr( $_POST['email'] ),              //user meta         'rich_editing' => false,         'comment_shortcuts' => false,         'show_admin_bar_front' => false,                 'wp_user_level' => 0,          'wp_capabilities' => 'a:1:{s:10:"subscriber";s:1:"1";}'      );               $new_user_user_id = wp_insert_user( $userdata );


title: SSL redirect loop using Wordpress HTTPS Plugin

text: I'm using Wordpress in a NginX server proxying to an apache server which serves the pages. Recently we wanted to force the use of SSL at least in the Admin section, so we installed the Wordpress HTTPS plugin. The server sections in NginX are properly configured, but when I activate the "Force SSL for admin" option I fall on a redirect loop. I don't think that it's a cookie issue. If you need more info, I'll pass it to you.


title: Help with Changing loop.php?

text: I'm trying to edit the loop so if its on category ID 60 it displays "Photos" instead of "Blog".. how do I do this? blog                   <?php if(is_archive()&&!is_category()&&!is_tag()&&!is_search()){ ?>                  <!-- BEGIN .archive-title -->             <h1 class="page-title">                      <?php if ( is_day() ) : ?>                         <?php printf( __( 'Daily Archives: %s'), get_the_date()); ?>                     <?php elseif ( is_month() ) : ?>                         <?php printf( __( 'Monthly Archives: %s'), get_the_date( 'F Y' )); ?>                     <?php elseif ( is_year() ) : ?>                         <?php printf( __( 'Yearly Archives: %s'), get_the_date( 'Y' )); ?>                     <?php else : ?>                         <?php _e( 'Blog Archives'); ?>                 <?php endif; ?>                  <!-- END .archive-title -->             </h1>              <?php } ?>


title: Search queries don't seem to work?

text:
I have a problem with search queries. Anytime you put additional queries, like: > mywebsite.com/?s=wordpress&post_type=page > > mywebsite.com/?s=wordpress&post_type=page,post > > mywebsite.net/?s=wordpress&cat=1 > > mywebsite.net/?s=wordpress&post_type=post&tag=genesis-post > > mywebsite.net/?s=wordpress&post_type=post&tag=thesis-post it should do a search in the specific scope (post type, category, tag). In my case, it doesn't seem to work no matter what I put as an additional parameter, it will display all results containing the word I'm searching for. In my post types, I have `query_var` set to `true` so in theory, it should work. My search.php loop looks like this               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
                  <?php if ( 'post' == get_post_type() ) : ?>
<?php the_category(' '); ?>
             <?php else : ?>
Resource
             <?php endif; ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
             <?php the_excerpt(); ?>
          <?php endwhile; ?>      Using a hidden input in my searchform.php doesn't work either,               <form method="get" id="searchform" action="<?php bloginfo('url'); ?>"  class="search">         <input type="text" class="field" name="s" id="s" />         <input type="submit" class="submit" name="submit" value="Go" />         <input type="hidden" name="post_type" value="myposttype" />     </form>      it still searches normal posts, not only within myposttype CPT. Any idea why the search queries wouldn't work? Any help appreciated.


title: List posts by category exclude current post

text: I'm trying to get a list of posts from one category, echo the title and the permalink of all posts on that category but exclude the permalink and the post name IF the current post is on that list. It will be displayed on single.php after or inside the loop Anyone knows if it is possible, if so how? Thanks in advance               <?php query_posts('category_name=MyCatName&showposts=-1'); ?>     <?php while (have_posts()) : the_post(); ?>                  <a href="<?php the_permalink(); ?>">               <?php the_title(); ?>               </a>             <?php endwhile; ?>


title: How to have search results page sorted by post date

text: On this search results page: http://p2reloaded.com/?s=versions&search- submit=Search I'd like to inverse the order of the results to start by newest post date first at the top of the page. Right now it's showing older posts first. Is there a way to specify that in the WP search function through a URL parameter? BTW, I am had to install the Relevanssi plugin to get WP (or the theme?) to search using tags. Thanks! Noel


title: How can I include JavaScript that use jQuery on admin side

text: I try this:                 add_action('admin_print_scripts', 'custom_admin_scripts' );      function custom_admin_scripts() {            echo '<script type="text/javascript" src="' . get_bloginfo('stylesheet_directory') . /admin-scripts.js"></script>';      }      but by this way it doesn't recognize jQuery. So I get `Uncaught ReferenceError: jQuery is not defined`.   I think that it because jQuery is linked after my script. As I see in HTML source:                 <script type="text/javascript" src="http://localhost:8080/wp-test/wp-content/themes/test/admin-scripts.js"></script>     <script type="text/javascript" src="http://localhost:8080/wp-test/wp-admin/load-scripts.php?c=1&load=jquery,utils&ver=edec3fab0cb6297ea474806db1895fa7"></script>      How can I fix it?


title: How can i retrive the movies, trailers, news in a single page using search

text: How can i retrive that. For a few month i build a website, and i want to make it diferent For the search i have 3 post type, and i have for each diferent themes for display \- Movies \- Trailers \- Persons ![How can](http://i.stack.imgur.com/f2BKF.jpg) How i retrive the theme's               <?     /* Template Name: Search Results */     $search_refer = $_GET["post_type"];     if ($search_refer == 'post') { load_template(TEMPLATEPATH . '/search/search-filme.php'); }     if ($search_refer == 'persoane') { load_template(TEMPLATEPATH . '/search/search-actori.php'); }     if ($search_refer == 'serial') { load_template(TEMPLATEPATH . '/search/search-seriale.php'); }     elseif ($search_refer == 'trailers') { load_template(TEMPLATEPATH . '/search/search-trailers.php'); };     ?>      So i want to be able to search for a movie and retrive the trailers and the movie in same page each under and search without selecting the post type. as seen on top of a picture. The Search of movies               <?php if (have_posts()) : ?>     <?php             $args = array(                     'post_type'=> 'post',                     's'    => $s);                     query_posts($args);     ?>     <?php while (have_posts()) : the_post(); ?>     //....      Trailers                   <?php if (have_posts()) : ?>         <?php $args = array('post_type'=> 'trailers', 's'    => $s); query_posts($args); ?>     ...      Thanks in andvance to thouse who help me to achive this.


title: Adding "meta" info to WP site PHP function?

text: I'm asking for some grace on this question - I lack sufficient knowledge of both WP and PHP to be more specific ... so here goes: I'd like to associate some "meta" information about my website into the content; for example a tree (e.g. Maple), so that I can use a PHP tag (and/or shortcode) to say something like `<? echo $tree ?>` and get a value printed out. The reason for this is because I'm planning to set up multiple sites using MU with a different focus and some of the content will be dynamic and some manual. What is the recommended way in WordPress to do something like this? Is this something I can define in `functions.php` and then grab at my leisure? PS - is this possibly a custom field thing? I may want this content to appear anywhere (header, sidebar, footer, in page content [etc.])


title: Generate Catalog Of Posts Based On Template

text: Is there a way to print a hierarchy of posts/pages/custom post types based on page template? EG. I am often asked to review another web site and I'd like a way to 'see' all the pages that are assigned to the 'Newsletter' PHP template and all the pages assigned to the 'Product Info' PHP template. Is there a plug-in like that or some code one can recommend?


title: Theme showing multiple times in dashboard theme page

text: I'm making my own blank starter WordPress theme & it currently shows many times in the admin theme page & I do not know why! Does anyone know why this might be (& how to fix it)?![screenshot of Themes in dashboard showing my starter theme many times](http://i.stack.imgur.com/DCaST.jpg) UPDATE 280413 (NB please see my comment below) So after the disaster of my localhost wordpress crash after I tried deleting one of these themes at themes dashboard I reinstalled most of the themes that had been lost. Today while working on a theme I noticed it's link color style remained after I had changed it and saw firebug was pointing to a style.css file OUTSIDE of the localhost/wordpress directory. This style.css was a copy of the style.css in the localhost/wordpress/wp-content/themes/xxxtheme folder I had been editing. I removed the whole folder/directory that was outside wordpress with that style.css from my localhost directory (ie inetpub/wwwroot/xxxtheme folder) & my WordPress theme xxxtheme style editing worked. I had not realised that folders outside my wordpress folder in my IIS localhost server (yet still in my localhost IIS default site structure) could interact in this way with the wordpress style.css in themes directory. I strongly suspect that this has something to do with the problem I had with so many of the same themes showing in the theme admin dashboard. I have 'cleansed' my localhost default and localhost wordpress directory of duplicate theme folders & similar wordpress theme style sheets and truly hope this has fixed this problem. Knowing this also will help me do css styling in localhost/localhost/wordpress with less chance of css conflicts/unwanted inheritances....phew! :-) The screenshot below shows firebug style.css popup referring to a different location to the main style.css for the wp xxxtheme. ![localhost/wordpress theme in firebug showing popupbox with unwanted style.css](http://i.stack.imgur.com/73hpB.png)


title: Wordpress post saves until Apostrophe (’) is used

text: I've installed wordpress onto a fresh VPS with nginx + php-fpm, the installation works fine apart from whenever I post something with a ’ the post ends there. It's looks to be some sort of escape error or something but I've not being able to track it down.   * We are using a custom theme but it still happens when we switch to a standard one   * There are no plugins installed I'm not sure how I can track down the problem, has anyone had any similar experiences? EDIT:: Okay narrowed it down to if the post contains ’ then it will stop at the content if the post contains ' then it will be fine and carry on


title: gallery shortcode exclude not working

text: I'm using this bit of code on single.php:               $params='[gallery link="file" size="my_thumbnail_small" exclude="'.$featuredId.'"]';     $gallery = do_shortcode($params);     echo $gallery;      But nomatter what I put in the `exclude` param, it has absolutely no effect on the output, the image that I'm trying to exclude gets shown every time regardless of the params I use. My `$featuredId` var contains the ID of the post thumbnail / featured image, which in this test case is `93`. I've tried just with `exclude="93"` incase it's getting overwritten or something but to no avail. The theme is an almost completely blank one with nothing but a few `add_image_size()` calls in functions.php and the only plugins I'm currently using is file un-attach 1.01. Wordpress is at version 3.3.2. Anyone have any idea why this isn't doing what I expect? EDIT: I've tried the accepted answer from this question on SO, still no dice. http://stackoverflow.com/questions/4337999/wordpress-exclude-the-post- thumbnail-from-gallery-shortcode Maybe there is some theme support I need to add for this to work?


title: get_results on large datasets

text: I am experimenting some very disturbing problem using a custom SQL query. I have a custom MySQL table called `trading_datas` having 165 lines for 4,4Mo. One field `datas` of my table is a big serialized array. When requesting over it that way:               $querystr = "SELECT item, datas FROM trading_datas";     $result = $wpdb->get_results( $querystr, 'ARRAY_A' );      my PHP script stops and nothing gets echoed right after that line. When retrieving only `item` everything works great. Should I zip my serialized array before putting it in database? Any other solution? Thanks a lot for help!


title: How to get the parent's taxonomy?

text: * I have 2 customs post type : "Artist" and "Concert",   * the "Concert" custom post type is the child of the "Artist" custom post type,   * the "Artist" custom post type has a "genre" taxonomy. What I'm trying to do (for instance): list all the concerts which belong to artists of the "pop" genre. Here is the query of my dream: `SELECT * FROM posts WHERE post_type = "concert" AND **post_parent_term** = "pop"` I think currently there is no such thing as **post_parent_term** , hope I'm wrong ... (I know i can add the "genre" taxonomy to the "Concert" custom post type and voilà! But I'm really curious to know if there is another way to achieve that). Thanks by advance.


title: List Terms in Category

text: I want to list all terms of a specific taxonomy used in a category. Like I have a taxonomy called 'Manufacturer' and a category 'Shoes'. Each post in this category has a term like 'Nike', 'Adidas' or 'Reebok' and of course there are some posts having the same term. And on the archive page I want to list all the terms used in this category and not terms like 'American Apparel', used in in the category "Shirts". I hope you understand my problem and have a good idea for solving this problem. Thanks in advance, Timo


title: What can cause intermittent permalink issue with posts and pages, but custom posts work fine?

text: Ok, we had this issue in previous version of WP, there was a bug about rewrite issue. Bug: http://core.trac.wordpress.org/ticket/21020 We reverted back to previous version, and all was good. We were on sub-domain, finishing up the site. Today, we switched all URLs to the top level domain and everything worked fine. Then, all of the sudden pages and posts stopped working. BUT, custom post types work just fine. It uses postname setup, default urls work! I tried resetting htaccess, resetting permalinks, changing themes to 2011, deactivating plugins, nothing works. I'm stumped. I upgraded to latest WP, 3.4.1 which supposedly fixed the rewrite bug. Still does not work. We've tried going back to previous version again. That did not work. So, then, all of the sudden permalinks began to work. 2 days later, they stopped working again!! Page: http://www.4printing.net/contact-us/ Custom type: http://www.4printing.net/articles/anaheim-commercial-printing/ Please help! Out of ideas.


title: How to display only category of blog without custom code?

text: Is it possible to display the titles of a category without having to use custom code or plugins? I'd like to use two or three categories (basically two or three blogs) on the same site.


title: Multiple Orderby's using random order WP_Query

text: Here is the setup. The site in question is a website that displays listings. Each listing has a rank (1-3). Basically it's a listing type... small, medium & large to determine how much the customer pays. When I do a WP_QUERY of all of the listings I want to display them in order DESC from 3-1 (larget - small)... basically show all large listings, them medium then small listings. Think sortfolio.com The problem is not only do I want to order them large-small, but I also want to randomize each listing so the same large one will not always be the first one displayed. Here is what I was trying:               $query = new WP_Query( array( 'post_type' => 'listing', 'orderby' => 'meta_value_num rand', 'meta_key' => 'membership'));      As you can see I am ordering them by the membership level but then am trying to randomizing them. It seems to work, but it always puts the initial membership results in ASC order and there is no way (i can figure) around it. Any help is greatly appreciated!!


title: How do i display post from a taxonomy term?

text: Hey i was wondering how could i show post from a certain taxonomy term in the loop.                <?php the_excerpt(); ?>      I have a taxonomy entitled "series" under my post type entitled "Gallery", and in "series" i have the TERM "pretty-little-liars". Under my **post type** "pretty-litte-liars" archive it shows all the post posted in that CPT. I would like to add a code that also allows post posted under the taxonomy "series" with the term "pretty-little-liars" to show on that page as well. what do i add to the above excerpt code to make this happen?


title: Writing a view count with w3 total cache

text: I am trying to develop functionality which counts how many times a post is viewed however I am also using page caching (APC possible memcache in the future) via w3 total cache. The "view count" value is not to be shown to anyone but administrators/editors and only when editing the post in admin section. So my question is if I do the following for every post               update_post_meta($postID, 'view_count', $count++);      is it going to   * work considering im using page caching?    * if it does work, would it slow down the request considerably?    * if it does slow down the request would doing a asynchronous mysql update via MYSQLI_ASYNC speed this back up? Thanks


title: Display newest post's custom field content on homepage, daily

text: Ok, so I'm pretty confident on how to display a certain post's custom field content on my home page, or wherever I wanted it. But what I'm trying to do is this: I have my main home page that I want to display content from the newest post everyday. In other words, I have an area where I need to display the newest post's custom field content daily. Automatically. I will be posting a new post every morning. I don't want to have to go in and edit the home template page everyday though. I would like to setup the home page template to automatically pull in the info. So every morning, after publishing my post, this block will show the custom field content in it. Can anyone point me in the right direction? Thanks!


title: How can I unhook this action that was added via $this?

text: This is in regards to the plugin Theme My Login, although the question may relate to any plugin. The author says he no longer uses the support forum, so I've come here. I'm trying to unhook the following action, found in `/modules/custom- passwords/custom-passwords.php` on line `38`.               class Theme_My_Login_Custom_Passwords extends Theme_My_Login_Abstract {        protected function load() {           add_action( 'register_form', array( &$this, 'password_fields' ) ); // Unhook This!           ...      Now I've tried a bunch of versions of the `remove_action` function, but none seem to work. Every time I have used remove_action before it has been with a variable, but TML is using the class directly. I have tried the following in **directly before the`do_action('register_form')`** function call. None seem to work.               remove_action('register_form', array( Theme_My_Login, 'password_fields' ) );          remove_action('register_form', array( Theme_My_Login_Custom_Passwords, 'password_fields' ) );          // get_object() is a method of the original class, and returns the      // object which can be var_dump'd     remove_action('register_form', array( Theme_My_Login::get_object(), 'password_fields' ) );      I know this is the action I need to remove, as I can comment it out within the plugin file and it solves the issue. But I don't want to edit the plugin file, obviously, because I want to keep the plugin updated.


title: Display Post Meta in Header

text: I'm trying to get page post meta in my header so I can set some meta tags. I tried to get the global post variable but it only return true.               <?php         global $post;         global $wp_query;         echo print_r($post);         echo print_r($wp_query->post);         die();     ?>      All I get is `11` \- is there a way to get my post meta in the header?


title: Add role and edit page capabilities

text: i've create a new user role and i want this user can edit page and use custom post type. For custom post type i've resolve but for the page not function. On backend the user can only see the page but can't edit. Where wrong?               /* aggiungi ruolo */      add_role('brokers', 'Brokers', array(               'read' => true, // True allows that capability     'edit_pages' => true,      ));


title: Drag n Drop Post Order for multiple Custom Post Types

text: I have two custom post types (Branding Elements and Products) that I'm showing on a single page, and the client wants to be able to control the sort order of the page. What would be the best course of action for creating a way for the client to re-order two post types with a drag n drop interface? Because they're 2 different post types, none of the currently available plugins are suitable.


title: Pagination broken when merging search results with additional WP_Query

text: On the search results page (`search.php`) I would like to perform an additional `WP_Query` to keep a specific order of search result types e.g. search results from authors should always be shown before the other results - **The first few pages should hold the author results, the other results should be shown on all the following pages only (not mixed on each page).**               global $wp_query; //holds the results of the initial search query          $authorposts = $wp_query->posts;         $query = new WP_Query( 'year=2012&monthnum=12&day=12' );     $otherposts = $query->posts;          $wp_query->posts = array_merge( $authorposts, $otherposts  );     $wp_query->post_count = count( $wp_query->posts );          if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>       //show results loop...      The problems appear with the behaviour of pagination - while the `$authorposts` seem to paginate correctly i.e. correct page numbers for author posts and pagination works as only those where existent. But the `$otherposts` on the other hand are shown at the bottom of each page, right under the author posts. And they are the same on every page! Also the page count reflects the count of the first query only. I have also tried to merge with the `plus` operator:               $wp_query->posts = $authorposts + $otherposts;      but in this scenario the `$otherposts` don't show up at all and the page count stays the same (page count for author posts). All the examples with similar goals using two separate queries I've seen looked quite the same - **So I'm wondering if the my way of extending the original search query results with that additional`WP_Query` is sufficient or if I'm missing some `$wp_query` fields to be populated (correctly)? What's the correct way doing this?** **Update:** It should be noted that I'm using the WP-PageNavi plugin to paginate but this should not be relevant in the first place as the first page is already rendered wrong. And it's also initialized with the query object: `wp_pagenavi( array( 'query' => $wp_query ));`


title: Creating option to allow user to select the page my plugin content will display on

text: I have an options page for my plugin, but cannot seem to figure out how to create an option to allow admins to select a page that will display my plugins content. Does anyone have an example of how this is done? EDIT: I created a plugin and have a widget to search the content of my plugin. However I need the widget to post to the page that my plugins content is being displayed on. Since the widget is on the sidebar it could be submitted from any page, I need to be able to detect which page the plugin content is being displayed on and se the to that page. 1\. detect the shortcode on a given page, and use that. OR 2\. Create an option from a settings page to allow the admin to select which page the plugin content will be displayed on and get rid of the shortcode. I hope that clarifies. I have a settings page for my plugin, I just do not understand how to get a list of the available pages and save/update the option in the wp_options table.


title: load wp_editor without wp_footer

text: Im trying to laod wp_editor in a popup and I don't want to use wp_footer and fill it with lot of unnecessary js, css and html loaded by other plugins. At the moment when i need wp_editor I have:               //if using wp_editor load necesary files     if (  class_exists( '_WP_Editors' ) ):                  _WP_Editors::editor_js();             _WP_Editors::enqueue_scripts();     endif;      But I still need wp_footer.... There is any way to run the tinymce editor without wp_footer?


title: How to add a class to ul tags created by the WordPress editor Tinymce?

text: I want to set a special styling for the ul tags created by Tinymce only, which means only for posts and pages, I only found this filter tiny_mce_before_init with an example on how to add custom style options to an existing style dropdown. so is there a way to add a class to ul tags created by the WordPress editor ?


title: Allow editor to manage part of the admin settings

text: I'm using a plugin called Business Hours. I want the editor role to be able to manage the settings for the plugin which are situated in the Settings menu. I know how to allow editors to access all the admin settings, but I want them only to be able to manage the settings for the plugin. Any ideas? ![Screenshot](http://i.stack.imgur.com/qbEte.png)


title: Search posts by calendar option

text: Currently have this website and as you can see there is search options for Gig date, Gig price, posted date and county. Here is the code:               <option <?php if($tp==3) echo 'selected'?> value="3">Gig Date</option>     <option <?php if($tp==1) echo 'selected'?> value="1">Gig Price</option>     <option <?php if($tp==2) echo 'selected'?> value="2">Posted Date</option>     <option <?php if($tp==4) echo 'selected'?> value="4">County</option>      I am trying to add a search option with a calendar where visitors can select a date and it shows all results on that gig date does anyone know how to do this?


title: Using post ID in custom tinyMCE button

text: I'm building a simple plugin and need to be able to access current post id when user clicks custom tinyMCE button (inside its onclick function). How should I get current post ID to do that. Just for this example, code from this tutorial: http://brettterpstra.com/2010/04/17/adding-a-tinymce-button/ can be used, and after clicking on the button, current post id could be logged into console (console.log) or alerted to screen.


title: is_home() in HTML head

text: Is there a way to check if the current page is the home page from within the head? My `style.php` needs the number of posts in the slider, but only on the home page. So I count my posts like this:               <?php      $meta_key = 'teaser';     $posts_per_page = 6;          $sql = "SELECT count(DISTINCT pm.post_id)     FROM $wpdb->postmeta pm     JOIN $wpdb->posts p ON (p.ID = pm.post_id)     WHERE pm.meta_key = '$meta_key'     AND pm.meta_value != ' '     AND (p.post_type = 'post' OR p.post_type = 'page' OR p.post_type = 'ai1ec_event')     AND p.post_status = 'publish'     ";     $count = $wpdb->get_var($sql);     if($count > $posts_per_page)     {     $count = $posts_per_page;     }     ?>          <link rel="stylesheet" type="text/css" media="all" href="/wordpress/wp-content/themes/roots/style.php?tcount=<?php echo $count;?>" />      I tried to wrap it in an if statement, but `is_home()` or `is_frontpage()` do not work. This is the style.php (Just some relevant parts, to show how it works):               <?php header("Content-Type: text/css");      $seconds_to_cache = 86400;     $ts = gmdate("D, d M Y H:i:s", time() + $seconds_to_cache) . " GMT";     header("Expires: $ts");     header("Pragma: cache");     header("Cache-Control: max-age=$seconds_to_cache");     ?>          <?php     $numTeasers = $_GET['tcount'];     ?>               /* =============================================================================     Slider Controls     ========================================================================== */          <?php     $max = $numTeasers;     for ($s = 1; $s <= $max; $s++)     {          $next = $s+1;     if($next == $max+1){$next = 1;}     echo "#wdgt_slider #slide".$s.":checked ~ #controls label:nth-child(".$next."){background: url('/wordpress/wp-content/themes/roots/assets/img/slider/next.png') no-repeat scroll 0 0 transparent;display:block;position:absolute;right:0;margin:0 20px 0 0;}";          $prev = $s-1;     if($prev == 0){$prev = $max;}     echo "#wdgt_slider #slide".$s.":checked ~ #controls label:nth-child(".$prev."){background: url('/wordpress/wp-content/themes/roots/assets/img/slider/prev.png') no-repeat scroll 0 0 transparent;display:block;position:absolute;float:left;margin: 0 0 0 20px;}";          echo "#wdgt_slider #slide".$s.":checked ~ #active label:nth-child(".$s."){color:#c2b29e}";          echo "#wdgt_slider #slide".$s.":checked ~ #slides #slide-teaser-".$s." .info, #wdgt_slider #slide".$s.":checked ~ #slides #slide-teaser-".$s."     {         visibility:visible;         width:100%;         height:auto;         opacity:1;     }";     }     ?>               @import url(“../adventon/style.css”);      And by the way: Is it bad practice to do such things in the HTML head?


title: Do I need to deal with WordPress SQL Injection

text: Do I need to prepare strings against MySQL Injection when inserting into the database using a WordPress comments function such as this:               $data = array(         'comment_post_ID' => $post_id,         'comment_author' => $comment_author,         'comment_author_email' => $comment_email,         'comment_content' => $comment_body,         'comment_type' => '',         'comment_parent' => 0,         'user_id' => 1,         'comment_author_IP' => '127.0.0.1',         'comment_agent' => 'Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 (.NET CLR 3.5.30729)',         'comment_date' => $time,         'comment_approved' => 1,     );          wp_insert_comment($data);      **Update:** From this page it seams as though it handles all of this, but doesn't strip HTML/PHP tags; is this in itself worth stripping on a purely security basis?


title: tmp file is not generated in wordpress

text: Could not create directory. /opt/lampp/htdocs/wordpress/wp- content/upgrade/responsive.tmp error is generated when new theme is being installed in wordpress .I use xampp as local host in ubantu 12.04 .


title: Adding Woocommerce to my own theme, how do I do it?

text: After searching and trying for days, I'm starting to get agitated.. I have a custom theme for Wordpress, wich seems to function OK. But after installing Woocommerce several widget don't work, such as the shopping cart and lightbox. I found out that it has something to do with my theme not being compatible with Woocommerce because when I change to a standard theme everything works as expected. On Woocommerce docs I saw I might have to add some hooks to my functions.php but I can't figure out where to add these hooks... Can anyone point me in the right direction?


title: multiple comment text areas

text: I need to create a user comment form with three text areas and then display them in comments. I don't know where to start - cannot find any plugin but would like to code it anyway. Any pointers much appreciated.


title: Display posts from an author using search parameters (not author template/query_posts)

text: Is there a way to retrieve a list of all the posts by an author using search (example: ?s&author=xxx)? I can't use query_posts or author template (don't ask why, take it as a condition). And it should be a public query (the filter in admin panel isn't good). If isn't available by default as a search parameter, do you know how to add it smoothly through functions.php (without flooding WP with db queries or requests that slow it down).


title: How to add description over forum list on bbpress root page

text: I have few forums added for bbpress and when displaing root page I have them listed. Now I want to add some description at the top to provide some intoruction to visitors. Does anyone know how to do it?


title: Resetting menu_order to 0 for posts in PHPmyAdmin?

text: Installed a plugin that allows the re-ordering of posts from any post type / category / tag using a drag/drop interface. After some time of using, my post order went haywire and new posts began to appear in a jumbled order. The plugin's native _reset_ button resolved this, but the old posts are still jumbled (only for two particular categories). Plugin author suggested updating **menu_order** to 0 only for the post type in question and I have a few questions:   1. I can't seem to find the appropriate field, which table would I look in?   2. Post types just cover posts, pages and all custom post types, right? If I'm only having this issue with a category, I still have to reset the menu_order of the entire parent post type?   3. I see the menu_order filter in the Codex, but I thought this was only for top level menu order, not the order of actual posts?


title: Comments Template shows, but not the comments

text:
I've customized a twentytwelve theme, changed the index and content, nothing else. Now, I've lost the comments. Google says to call this first:               <?php comments_template(); ?>      But, everywhere I look, including a dump of variables, there's no comments. What have I missed? I know comments.php is being called. Here are more details: I'm not using themes, I have this in the index:               define('WP_USE_THEMES', false);      also in the index I have this:               <?php get_template_part( 'content', get_post_format() ); ?>      so the work is being done over in content.php, not single or page... Over in content.php I have this:               <?php comments_template(); ?>     ...
<?php             printf(                 _n( 'One Response to %2$s', '%1$s Responses to %2$s', get_comments_number(), 'twentytwelve' ),                 number_format_i18n( get_comments_number() ),                 '' . get_the_title() . ''              );         ?>
      That always prints 0. My loose understanding is that `comments_template()` loads comments.php, which it does. That seems to be little different than what single.php did. comments.php is stock, but there seems to me to be some initialization missing because although I get the form, it finds no comments. I was trying to simplify what I needed to do as the blog is simple but the look is complex and fiddly and needs a separate look for mobile which is in a mobile subdomain. I've gotten all this working, except the comments. URL for a post that has comments:


title: How to put a banner ad between post 1 and post 2 on homepage only

text: Wordpress **Swift Theme** is installed on my My site http://tech-ticks.info From last few days, I am trying to find a solution to put an ad banner on homepage only between post1 and post 2. I have already tried on worpress support forum. Can anyone here help me out as i don't have much knowledge about PHP. Your help will be highly appreciated.


title: Proper way to include stylesheet for panels

text: What is the proper way to include a stylesheet with my options panels in wp- admin for a given plugin or theme. In other words -- the stylesheet that styles the panels. I mean, in my panel template code, I'm doing something like...               <style type="text/css">     @import url("../wp-content/plugins/myplugin/panels/style.css");     </style>      ...but suspect that this won't work on some installs of WordPress because of paths and so on, and might not work in the future of WP gets a wild hair and wants to rename wp-content with something else.


title: Grabbing specific content

text: Right now I'm doing this (pseudo code)               posts = content_type("special_stuff");     $i = 0;     $n = 5;     $while(have_posts) {         if($i == $n) {             // print the content         }         ++$i;     }      This is what I'm doing to always get the `n`th item. I'm sure there is a better way, but I'm kind of a WP noob. Related:   1. (this question) How do I grab the nth element of a content type? eg. always getting the 1st or 5th most recent element from the db.   2. List item How do I do #1 based on content id?


title: Getting links to work the same on development and production

text: I am working on a website where I am specifying links to pages within my site in other pages. I am using the same permalink post name structure i.e. http://example.com/sample-post on both development and production and I am using /index.php/sample-post/ to link to a specific blog. This works on production but not on development. My development machine's wordpress install is under a directory called wordpress and is running off a URL http://127.0.1.1:8080/wordpress/ On development for some reason when I specify /index.php/sample-post the wordpress part of the site url is absent. This only seems to happen with posts and not pages. As far as I know /index.php/ refers to the site url which should be http://127.0.1.1:8080/wordpress/ unless I am mistaken. Moreover I would like to know if there is any alternative way to specify absolute URLs in wordpress and get around this problem. Thanks in advance. nav


title: Author custom fields post meta, the code?

text: If I wanted to get a custom field of the current user I would use something like this. `<?php echo get_user_meta($user_info->ID,'address_line_2',true);?`> This time however I want the author so I tried multiple version of the following to no avail.               <?php      $thisauthorID = get_the_author_ID();          echo get_the_author_meta($thisauthorID,'address',true)             ;?>      Any ideas? Marvellous