title: How to get rid of error message of custom metabox in dashboard when moving out of edit page?

text:
in plugins folder i'have `custom-post-metabox folder`, inside it `custom-post- metabox.php`, `admin.js` and `admin.css`. //code of `custom-post-metabox.php`               <?php          /**      * Plugin Name: Custom Post Meta Box      * Plugin URI: http://localhost/wpuploadtest      * Description: Demonstration of custom post meta box      * Version:1.0.0      * Author: me      * Author URI: http://google.co.in      * License:GPL2      */               function cpmb_css(){              wp_enqueue_style('cpmb-admin', plugins_url('custom-post-metabox/admin.css'));     }          add_action('admin_enqueue_scripts', 'cpmb_css');               function cpmb_js(){            $screen = get_current_screen();                 if ('post' == $screen->id) {         wp_enqueue_script('cpmb-admin', plugins_url('custom-post-metabox/admin.js'));       }          }          add_action('admin_enqueue_scripts', 'cpmb_js');                         function cpmb_add_meta_box(){              add_meta_box(            'cpmb_audio',            //The ID for the meta box            'Add_mp3',               //The title for the meta box            'cpmb_display_meta_box', //the callback function for the meta box            'post',                  //we'll be only displaying this on posts            'side',                  //where the meta box should appear            'core'                   //the priority of where the meta box should be displayed             );     }          add_action('add_meta_boxes', 'cpmb_add_meta_box');          function cpmb_display_meta_box($post){            wp_nonce_field(plugin_basename(__FILE__), 'cpmb-nonce-field');            if ('invalid-file-type' == get_post_meta($post->ID, 'mp3', true)) {         ?>
Invalid File Type
       <?php         }              ?>               MP3 Title              <input type="text" id="mp3_title" name="mp3_title" value="<?php echo get_post_meta($post->ID, 'mp3_title', true); ?>" placeholder="Give me some sunshine">               MP3 File              <input type="file" id="mp3_file" name="mp3_file">         <?php     }                         function cpmb_save_metabox_data($post_id){              if(cpmb_user_can_save($post_id, 'cpmb-nonce-field')){                         if (isset($_POST['mp3_title']) && !empty($_POST['mp3_title']) ) {                      $mp3_title = stripslashes(strip_tags($_POST['mp3_title']));                      update_post_meta($post_id, 'mp3_title', $mp3_title);                    }                             if (isset($_FILES['mp3_file']) && !empty($_FILES['mp3_file']) ) {                                 if (cpmb_valid_mp3($_FILES['mp3_file']['name'])) {                                   $response = wp_upload_bits($_FILES['mp3_file']['name'], null, file_get_contents($_FILES['tmp_name']));                                   if (0 ==strlen(trim($response['error']))) {                                     update_post_meta($post_id, 'mp3', $response['url']);                                   }                            }else{                                     update_post_meta($post_id, 'mp3', 'invalid-file-type');                            }                       }         }          }          add_action('save_post', 'cpmb_save_metabox_data');                    function cpmb_valid_mp3($filename){      $path_parts = pathinfo($filename);           return 'mp3' == strtolower($path_parts['extension']);          }          function cpmb_user_can_save($post_id, $nonce){            $is_autosave = wp_is_post_autosave($post_id) ;       $is_revision = wp_is_post_revision($post_id);       $is_valid_nonce = (isset($_POST[$nonce]) && wp_verify_nonce($_POST[$nonce], plugin_basename(__FILE__) )  );            return !($is_autosave || $is_revision) && $is_valid_nonce;     }               function cpmb_display_mp3($content){                if(is_single()){                if('invalid-file-type' != get_post_meta(get_the_ID(), 'mp3', true)){                      $title = get_post_meta(get_the_ID(), 'mp3_title', true);                 $link  = get_post_meta(get_the_ID(), 'mp3', true);                 $content .= ''.$title.'';                          }                     }              return $content;     }          add_action('the_content', 'cpmb_display_mp3');      //code of `admin.js`               (function($){       "use strict";            $(function(){              $('form').attr('enctype', 'multipart/form-data');       });          })(jQuery);      The problem is if i just click on the update button without uploading anything the error message of invalid file type is still there , even if i leave the page and comeback to the edit page the error message is still there. How to fix it?


title: WordPress Twenty Twelve Child Theme. Removing default widgetized areas

text: I'm trying to remove Main Sidebar, First and Second Front Page Widget areas in my child theme. Basically I don't want them to be shown up in Admin Panel. I've placed that code into my function.php file. It's seems to not work:               function remove_some_widgets(){              unregister_sidebar( 'Main Sidebar' );         unregister_sidebar( 'First Front Page Widget Area' );         unregister_sidebar( 'Secon Front Page Widget Area' );     }     add_action( 'widgets_init', 'remove_some_widgets', 11 );      I've got it from WordPress Codex but I think that was developed for Twenty Ten theme. Anyone knows the right code for Twenty Twelve parent theme. ? Thanks for answers.


title: How to hook in and modify the new revisions UI (3.6+)?

text: Let's say I want to add some post_meta into the "new" revisions UI. I'm saving some meta on revisions only, and want to display it on this screen. ![enter image description here](http://i.stack.imgur.com/nmfgQ.png) Normally, I'd open up `wp-admin/revisions.php` look for some hooks and code away. But the revisions page is all done with Backbone. I don't know Backbone (totally willing to learn). However, I can't find anything about how to modify existing admin Backbone views in WordPress. Has anyone successfully modified this interface and can provide an example of how it can be done?


title: Edit / Change Jetpack Mobile Theme

text: I really like the idea to switch themes for mobile devices and am using jetpack for several feature on my website, So I thought, why not use it for mobile devices as well. Jetpack comes packed with a feature that switches themes for mobile devices, but it is only possible to use their theme and adjust some things like bg colour etc.. I was wondering is it possible to completely change this theme? So use jetpack to detect device, yet use your own mobile theme? That would stay like that after any updates.


title: Share plugins, themes, and multi post in a multidomain network

text: I have created a network consisting of 3 sites (site1.com, site2.com, site3.com). Everything works fine, and I can access all three sites fine. What I need is to be able to share themes, plugins and post to all sites. I have tried multipost-mu, and ThreeWP Broadcast. When I create a post I can now choose the other two sites, but the post doesn't show up there. The way I set up my network is:   1. My host Setup the dns with a wildcard A record, and setup apache by adding ServerAlias *.|DOMAIN| to my httpd.conf   2. I then added the subdomain   3. I Edit the new subdomain: Changeg the value of Domain, Siteurl, Home, and Fileupload Url to suit to my new domain (http://www.site1.com)   4. I Edit my wp-config.php: define( 'DOMAIN_CURRENT_SITE', 'domain.com' ); changed it to define( 'DOMAIN_CURRENT_SITE', $_SERVER['HTTP_HOST'] ); What am I doing wrong?


title: Copy and delete a directory with WordPress functions

text: I have successfully used `copy_dir()` to copy a directory to a new location. How can I delete a directory using WordPress functions?


title: Different Category Headers using in_category and elseif

text:
At the moment I'm trying to figure out why this snippet is not working basically I want to display a div id for different categories. I'm using the following.                <?php if (in_category( array('6,14,15,13') )) { ?>
           <?php } elseif (in_category( array('7,11,12,10,9') )) { ?>
           <?php } elseif (in_category( array('4,16,17,18,19') )) { ?>
           <?php } elseif (in_category( array('3,22,21,26') )) { ?>
           <?php } elseif (in_category( array('5') )) { ?>
           <?php } else { ;?>
           <?php } ?>      But this is not working I'm getting the following error message: Parse error: syntax error, unexpected $end in /home/test/public_html/project/wp-content/themes/project/category.php on line 75 Line 75 is the               <?php get_footer(); ?>      Any help would be awesome, thanks!


title: Custom field query without duplicates results

text:
I have categories as cities like london or new york I also have a custom field called Location where I usually put the name of a restaurant. I am trying to show on a separate post/page all the restaurants in a certain town. Each post I make is basically a review of a restaurant but sometimes there is a review for the food or another one for their bar. I can t seem to figure out how to list all the restaurants in one city without getting duplicates. I have this for example:               <?php query_posts('posts_per_page=20&category_name=New York&meta_key=Location&order=DES'); ?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>     <a href="<?php the_permalink(); ?>"><?php the_title(); ?>     <?php $links = get_post_custom_values("Location");     if ($links[0]!="") {     $mykey_values = get_post_custom_values('Location');     foreach ( $mykey_values as $key => $value )     {     echo $value;     echo "

";     }     }     ?>      So this lists all the posts from New York and the content of the custom field called Locations. But I am getting duplicates. I would like that if there is a location on a post called Trump Tower that it will show listed only once? Any help is appreciated


title: Force logged in users to provide more data when commenting

text:
I have added more data to my comment using hooks. I added a group of radio buttons so users can select and choose one of radio buttons. Everything works perfectly fine but the newly added radio buttons do not show up when you're already logged in.. they only show up and work when you are not logged in. Logged in users only see the comment box. How to show the newly added field alongside with the comment box to logged in user? this is what I added to my functions.php               function add_comment_fields($fields) {              if(is_user_logged_in()) {                  $fields['age'] = '
' . __( 'Age' ) . '' .             '<input id="age" name="age" type="text" size="30"' . $aria_req . ' />
';             return $fields;         }     }     add_filter('comment_form_default_fields','add_comment_fields');               function add_comment_meta_values($comment_id) {              if(isset($_POST['age'])) {             $age = wp_filter_nohtml_kses($_POST['age']);             add_comment_meta($comment_id, 'age', $age, false);         }          }     add_action ('comment_post', 'add_comment_meta_values', 1);


title: How to show custom field and parent post id in wordpress attachment page (image.php)

text: I'm trying to use code to show custom field outside the loop in wordpress attachment page (image.php) it's returns nothing. this is the code i'm used to show the custom field:               <?php     global $wp_query;     $postid = $wp_query->post->ID;     echo get_post_meta($postid, 'my-custom-field', true);     ?>      and i'm trying to show parent post id in attachment page too with `get_the_id` and use this code               <?php global $wp_query;     $this_page_id = $wp_query->post_parent;     $post_id = get_the_id($post->ID);     echo $post_id ;?>      but the code above just shown the attachment ID not the parent post ID. anyone can help, please ?


title: Delete original image - keep thumbnail?

text: I'm using a lot of thumbnails but never the original file. To save space, I'd like to prevent the original from being saved on disk but only keep a thumbnail of 100px. How can I do this? Thanks, Dennis


title: Set (featured) thumbnail for post?

text: I'm using wp_insert_post and media_sideload_image to create a post and attach a single image to the post. However, how can I mark this attached image as featured thumbnail? It would make listing the thumbnails significantly faster by using the_post_thumbnail instead of looping through each post manually showing the first image. How can I mark the attached image as featured thumbnail? Thanks, Dennis


title: If have posts a week old, display, else display a different loop

text:
This is what I have.               <?php     $week = date('W');     $year = date('Y');     $projects_in_news = new WP_Query(                     array(                     'post_type' =>'news',                     'posts_per_page' => 5,                     'orderby' =>'ID',                     'order' =>'ASC',                     'w' => $week,                     'y' => $year,                     'tax_query' => array(                             array(                                  'taxonomy' => 'project_taxo',                                  'terms' => $post->post_name,                                  'field' => 'slug'                                  )                            )                     )     );          // The Loop     <?php if($projects_in_news->have_posts()) : ?>                  <?php while($projects_in_news->have_posts()) : $projects_in_news->the_post(); ?>

                              <a href="<?php the_permalink(); ?>">                                 <?php the_title(); ?>                                 <?php the_author(); ?>, <?php the_time('d F Y'); ?>

             <?php endwhile; ?>                  <?php else: ?>
There is no news related to this theme
                  <?php endif; ?>                 <?php wp_reset_postdata(); ?>      What I have here displays posts from the last week that match the query. Is there a way of determining if this loops query has posts and if not use a different query and loop? I tried adding the following code in place of `<p>There is no news related to this theme</p>`                                                 <?php                                                  $theme_in_news = new WP_Query(                                                         array(                                                             'post_type' =>'theme',                                                             'posts_per_page' => 5,                                                             'orderby' =>'ID',                                                             'order' =>'ASC',                                                         )                                                 );                                         ?>                                              <?php if($theme_in_news->have_posts()) : ?>                                              <?php while($theme_in_news->have_posts()) : $theme_in_news->the_post(); ?>

                                                 <a href="<?php the_permalink(); ?>">                                                 <?php the_title(); ?>                                                 <?php the_author(); ?>, <?php the_time('d F Y'); ?>

                                         <?php endwhile; ?>      But it returns an Internal Server Error. Thanks


title: References to other site everywhere in Wordpress site

text: I am relatively new to Wordpress, have been handed a site developed by someone else on one server, and have to deploy it to another. This site has bbpress installed, plus a load of other stuff. However it also seems to contain (somewhere) references to the other developers server, so even though I have copied the site onto my server all the links still point to his. I'm assuming that somewhere in the template files or database there is a reference to his site but I don't know where. I've done a search / replace and replaced what I can find, but still the same thing happens. I'm just wondering if there is any really obvious place I need to look for things like that. It seems to me he has just done something pretty stupid by hard coding references to his site; but maybe it's for a good reason, I don't know.


title: Remove the whole menu in the admin

text: How can i remove the whole menu in the admin? I have this code:               function remove_menu_items() {         global $menu;              end( $menu );              while ( prev($menu) ) {             $value = explode( ' ', $menu[ key($menu) ][0] );             if ( $value[0] != NULL ? $value[0] : "" ) {                 unset( $menu[ key($menu) ] );             }         }     }     add_action( 'admin_menu', 'remove_menu_items' );      This only removes the default menu items, any pages added to the menu by a plugin are still there. How can i remove the whole menu?


title: How to display a listing template of a certain taxonomy?

text: I'm trying to figure out how to display a list of specific taxonomy (`categorycourses`). In `functions.php` for the theme I have:               //Register custom taxonomy for courses-categories     $course_cat_args = array(       'hierarchical' => true,       'labels' => $course_cat_labels, //Other labels set before       'show_ui' => true,       'show_admin_column' => true,       'query_var' => true,       'rewrite' => array( 'hierarchical' => true )     );          register_taxonomy( 'categorycourses', array('course'), $course_cat_args );      The actual taxonomy is working fine in admin. Now I'm trying to create a template for `categorycourses` at frontend that lists all coursecategories. I've looked at the template hierarchy and I thought I should create a file with the taxonomy name `categorycourses.php` So I created a file called `categorycourses.php` in the themes folder. I also tried creating `categorycourses-categorycourse.php`, `archive- categorycourses.php` but I just keep getting a 404 error. Please bare with me. I understand lot of backend-stuff in WP, but I'm just learning how to create templates at frontend. I'm able to create archive-pages for certain post typs, so rewrites rules and so on are working on my local server. What am I doing wrong? **UPDATE** 1\. I've tried to create a file name `taxonomy-categorycourses.php` and with same result (404 error) I've flushed permalink-settings in admin by resaving them I've also tried:               $course_cat_args = array(       'hierarchical' => true,       'labels' => $course_cat_labels,       'show_ui' => true,       'show_admin_column' => true,       'query_var' => true,       'rewrite' => array('slug' => 'soup')     );          register_taxonomy( 'categorycourses', array('course'), $course_cat_args );      I try to access the template with `http://server/soup` but still get the error. (after resaving permalink-settings in admin) **UPDATE2:** * _I think I've figured it out:_ * There don't seem to be any template for "root-taxonomy". You have to choose a specific coursecategory to act as a root. In my case I've created this file:               taxonomy-categorycourses-semester2014.php      When I then access `http://server/soup/semester2014` the expected template (t`axonomy-categorycourses-semester2014.php`) is shown. But there seems no way to actually create a "root template for a taxonomy" like `http://server/soup/` . Even if I create a template called `taxonomy- categorycourses.php` it does not work. **Is this correct?**


title: Moved server, and WP now uses original images for all thumb sizes?

text: I just moved servers. When calling `wp_get_attachment_image()` or any of its sister functions the image returned is always the full-size image, scaled down, instead of the requested thumbnail size. This has a pretty nasty impact on load times. Both AJAX thumbnail rebuild and Regenerate Thumbnails those have happily created plenty of thumbnails. WordPress just chooses to ignore them. Thanks for any help. This _might_ be a dupe of Major issue with image sizes being lost, only full size images being shown but I'm not sure. **Update** After some research, it appears that the attachment_meta => sizes array on each image has all the correct keys for sizes, but none of the values:               (     [width] => 677     [height] => 472     [hwstring_small] => height='89' width='128'     [file] => my_original_image.jpg     [sizes] => Array         (             [thumbnail] =>              [medium] =>              [large] =>              [admin-list-thumb] =>              [select-a-post] =>              [detail] =>          )      Why might this be happening?


title: how to assign an ID to a wordpress menu

text:
The following code does not produce a UL with ID of "nav". It just produces

      This is the code:               wp_nav_menu( array( 'theme_location' => 'menu-1', 'container_id'    => 'nav';       According the WP Codex this should work. Why isn't it working? WP version = 3.5 **Update** I now have:               wp_nav_menu( array( 'theme_location' => 'menu-1', 'items_wrap' => '
%3$s
', 'menu_id' => 'nav'));      but this doesn't work either.


title: Only show posts with image and the correct ammount of posts in loop

text: This script makes a loop showing only posts with images, but I have a problem. It doesnt show the right ammount of posts pr page. Probably because it counts the total nr of posts, including the ones without pictures. Does anyone know how to fix this?               <?php      while ( have_posts() ) : the_post();         $content = $post->post_content;         $searchimages = '~<img [^>]* />~';         preg_match_all( $searchimages, $content, $pics );         $iNumberOfPics = count($pics[0]);         if ( $iNumberOfPics > 0 ) {             //your loop content goes here         }      endwhile;      ?>      Second problem: It also shows broken-image if the image in the post is external.


title: WP Query with custom taxonomy

text: I'm just getting used to the WP Query and was hoping I could get some assistance on this. I've created a custom taxonomy (theme) and now want to display the latest post with one of these taxonomies on my front page as a top featured post. Now I can't really seem to work out how to get it to filter the query properly, maybe someone can correct me:               <?php                $args = array(                     'tax_query' => array(                         array(                             'posts_per_page' => 1,                             'taxonomy' => 'theme',                             'field' => 'slug',                             'terms' => array ('text-image', 'just-text', 'just-image')                         )                     )                 );                 $query = new WP_Query( $args );                ?>                <?php if (have_posts()) : while (have_posts()) : the_post(); ?>      Any help would be highly appreciated, thanks! EDIT: Here's the finished code in case anyone else needs it;               <?php                $args = array(                 'post_type' => 'post', // it's default, you can skip it                 'posts_per_page' => '1',                 'order_by' => 'date', // it's also default                 'order' => 'DESC', // it's also default                     'tax_query' => array(                         array(                             'taxonomy' => 'nameoftaxonomy',                             'field' => 'slug',                             'terms' => array ('whatever1', 'whatever2', 'whatever3')                         )                     )                 );                 $query = new WP_Query( $args );                ?>                <?php if (have_posts()) : while( $query->have_posts() ) : $query->the_post(); ?>      Thanks for the help!


title: Memory needed to host 200 wordpress sites?

text: I'm planning to use Multisite to host 200 different wordpress blog with each having their own unique subdomain. I notice each time I create a virtual host for each subdomain it'll use roughly 50mb ram. So if 50mb * 200 sites = 10GB RAM correct me if wrong is 10GB of RAM needed to host 200 sites? if possible is there solutions to decrease ram usage?


title: How to export comments in WordPress?

text: I want to export my comments to Excel, PDF or Word. The format really doesn't matter, I just want them exported. I tried the _Export Comments_ plugin, the standard one, but couldn't get it to work, I have to do it manually. Anyone can suggest something on this topic?


title: wp_ajax_[service] returning 0

text: I have a few Ajax services that I'm setting up. All of them require being logged in so I've attached hooks into the "wp_ajax_[$service]". The problem is when I call these services I just get a "0" response. I also get no record of anything in my php error log. What I'm wondering is:   1. Is there a way to hook into ALL Ajax requests and dump some debug information into the log file so I can get some more info out what is going on?   2. Has anyone seen this problem before? Are there any tips about solving for this type of problem? UPDATE: Including code to give more context. First the the Javascript, it is:               ServiceCall ( 'get-action-template' , {'action' : action} , function(response) {// callback function});      and the ServiceCall function is:               function ServiceCall ( service , parameters , callback ) {         console.log ('getTemplate was called: (' + service +', ' + parameters + ')' );              //initialise a request object         var requestObj = {};         requestObj.response = 'ajax-response';         requestObj.type = 'POST';         requestObj.url =  my_config['ajax-service-list'][service]['url'];         requestObj.data = $.extend ( requestObj.data , {                                                 'service': service,                                                 'request_parameters': JSON.stringify(parameters),                                                 'ajax_nonce': my_config['ajax-service-list'][service]['nonce']         });         requestObj.global = false;         requestObj.timeout = 30000;         requestObj.success = function ( r ) {             alert ( "Success: " + JSON.stringify (r) );             callback ( r );         }         requestObj.error = function ( r ) {             console.log ("FAILURE WITH AJAX Call ( " + JSON.stringify (r) + ")");         }         $.ajax( requestObj );     }      This then generates the following message (taken from network panel in browser's debugger): ![debug](http://i.stack.imgur.com/piYOq.jpg) Finally, here's the code for the handler function (which NEVER gets called):               public static function ajax_handler () {         error_log ( "AJAX HANDLE"  );          $service = $_POST['action'];         $request_parameters = json_decode ($_POST['request_parameters']);         if ( LG_Utility::key_from_hash ( self::$services_list , $service , false ) ) {             $object = new self::$services_list[$service]['class'] ($service);             $object->handle( $service , $request_parameters );         } else {             if (class_exists ('AppLogger') ) AppLogger::error ( "Trying to handle a service ({$service}) which is not registered!");          }     }      I have validated, however, that it is hooked correctly to the wp_ajax_get- action-template event. The shorthand "proof" is using the popular "debug objects" plug-in I was able to validate that it was set. Here's the whole PHP class that's managing the AJAX transactions (some methods/consts removed for brevity):                class LG_AjaxServiceManager      {        private static $services_list = array(         'get-action-template' =>    array ( 'class' => 'LG_GetActionTemplate' , 'login_required' => true ),         'some-other-service' =>     array ( 'class' => 'LG_FooBar' , 'login_required' => false )        );        public static function add_listeners () {         foreach ( self::$services_list as $id => $service ) {             add_action ( 'wp_ajax_' . $id , 'LG_AjaxServiceManager::ajax_handler' );             if (class_exists ('AppLogger') ) AppLogger::log ( "Registering $id as an Ajax service" );          }           }         public static function ajax_localize () {         // add hook for script localisation; this is important so that JS scripts have nonce and URL information         foreach ( self::$services_list as $id => $service ) {             $service_url = wp_nonce_url ( admin_url ( 'admin-ajax.php?action="' . $id .'"' ) , self::AJAX_APP_NONCE_KEY . '_' . $id );             preg_match ( '/.*action=%22(.*)%22&_wpnonce=(.*)/' , $service_url , $service_parts );             self::$ajax_js_array [ $service_parts[1] ] = array ( 'nonce' => $service_parts[2] , 'url' => esc_url ( $service_url ) );         }              $localize = array (                 'SiteURL' => get_bloginfo ('url'),                 'AjaxURL' => admin_url ('admin-ajax.php'),                 'ajax-service-list' => self::$ajax_js_array         );         wp_enqueue_script ( 'jquery' );         wp_enqueue_script ( self::JS_FILE_HANDLE  , plugins_url ( '/js/lg-ajax-client.js' , dirname(__FILE__)) , 'jquery' );              wp_localize_script( self::JS_FILE_HANDLE , self::JS_NAMESPACE , $localize );             }        public static function ajax_handler () {         error_log ( "AJAX HANDLE"  );          $service = $_POST['action'];         $request_parameters = json_decode ($_POST['request_parameters']);         if ( LG_Utility::key_from_hash ( self::$services_list , $service , false ) ) {             $object = new self::$services_list[$service]['class'] ($service);             $object->handle( $service , $request_parameters );         } else {             if (class_exists ('AppLogger') ) AppLogger::error ( "Trying to handle a service ({$service}) which is not registered!");          }        }     }


title: Custom ajax call returns 0

text: I' am still searching on why am getting 0 when doing a ajax call on wordpress. I know that when a ajax call is successfull it returns 0. I' am returning some value from the ajax call and it returns 0 with it. Here's my code Javascript               $.ajax({         url: "/wp-admin/admin-ajax.php",         type: 'POST',         data:{             action: 'registerform',             name: 'John',             age: '38'         },         success: function( data ){             alert(data);         }     });      PHP Function               function registerform(){         echo $_POST['name'];     }     add_action('wp_ajax_registerform', 'registerform');     add_action('wp_ajax_nopriv_registerform', 'registerform');      Above Code returns John0 Please help?


title: wp_list_categories in in nav_menu

text: I have a website and I want to add automatically categories to my menu. I mean when I create new category it should appear in my menu. How I can make it?                 <?php wp_nav_menu( array( 'theme_location' => 'header', 'container' => '' ) ); ?>          Home | Categories | Contact               category1               category2               category3


title: linking to post outside the loop

text: Is there an easy way to link to a specific page/post outside the loop? I used the `get_permalink()` code as follows.               <a href="<?php echo get_permalink( 164 ); ?>/post-slug/"> </a>      But this meant that I had to get the post ID from the Shortlink in the Admin for the post I wanted and then append the slug to it. Is there a better way to get the post ID of the post I am looking for, without using the loop? My permalinks are set up to use the post name so this seemed to work.


title: How to correctly include jquery-ui effects on wordpress

text: I've been trying to include the jquery ui effects (more specifically the shake effect) on my wordpress theme. So far, I've only been able to include the jQuery script, but I really have no clue where to place the ui scripts and how to enqueue them. This is the code I have. It obviously doesnt work:                   <?php wp_enqueue_script("jquery"); ?>     <?php wp_enqueue_script("jquery-ui-core"); ?>     <?php wp_head(); ?>     <link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" />     <script type="text/javascript">         var $j = jQuery.noConflict();         $j(document).ready(function() {             $j("#manita-imagen").mouseover(function(){                 //$j(this).animate({ opacity: "hide" })                 // alert('asd');                 $j(this).effect("shake", { times:3 }, 300);             });         });           </script>      Thanks for your help!


title: What is the new Network Admin section?

text: Previously, in WordPress 3.0, multisites were managed through a Super-Admin section of the administration interface. The 3.1 update seems to have moved the administration of multisites to a new "Network Admin" section, which has a similar layout to the standard WP administration panels, but only contains options related to network administration. This section, however, seems to be pretty similar to the old Super-Admin section. Has there been any additional network management features added, or is the Network Admin section just a separation of options?


title: Get FaceBook Friend Count

text: Is there a simple PHP or Javascript method of getting the total number of FaceBook friends? Twitter makes it super easy to do that, and I need to do the same for one of my WordPress installs.


title: How to get the post content from a category on my homepage

text:
I'm trying to get posts with a specific category to show in a box on my home page. But ive only been able to get one post on my homepage. How can I make this work in the code below? With getting the title, excerpt (limit the characters - without read more) and post link (in the read more button below?)               echo '

';                 echo get_the_title();                 echo '

';                 the_excerpt();                 echo '

                 Read More

';      EDIT: Thanks Pieter Goosen. This is the code with your suggestions and some minor edits which I ended up using with some jquery and css to create a pretty sliding box:               function homepage_highlights() { ?>     <?php $my_query = new WP_Query('category_name=accommodation&posts_per_page=3'); ?>     <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>

                 <div class="item" <body style="background-image:url(<?php echo catch_that_image() ?>)">

<?php echo '' . get_the_title() . ''; ?>

             <?php the_excerpt(); ?>


title: Copying Custom Meta Values from existing post to a duplicate post

text:
I'm trying to revise an existing WP plugin BU Versions to accept different custom meta field values from items I've set-up using the Advanced Custom Fields (ACF) plugin. BU Versions will copy over the title, excerpt, content and a few other page specific features from one page to another, but I can't get it to copy over the custom meta values. For example, when I print_r($new_version), I get this in my results for what exists within the array, so I know it is adding the custom meta fields and values that are currently on the live page I am testing post duplication on.               Array(     [post_type] => page_alt     [post_parent] => 40     [ID] =>     [post_status] => draft     [post_content] =>     [post_name] => resources     [post_title] => Resources     [post_excerpt] =>      [_subheading] => For ELI Students     [_edit_last] => 3     [_wp_page_template] => default     [_edit_lock] => 1368111234:3     [add_columns] => 0     [_add_columns] => field_37     [left_column] => Array()     [_left_column] => field_39     [right_column] => Array()     [_right_column] => field_61     [header_image] => 426     [_header_image] => field_64     [_yoast_wpseo_linkdex] => 0     [3] =>     )      And this is the part of the code where I think the plugin creates a new post based on existing post values               /**      * Create a new alternate version.      *      * @param mixed $post      * @param mixed $alt_post_type      * @access public      * @return int|WP_Error      */     function create( $post_id, $alt_post_type, $meta_keys = null ) {         $this->get_version( $post_id );         if ( $this->has_version() ) {             return new WP_Error( 'alternate_already_exists', __( 'An alternate version already exists for this post.', BUV_TEXTDOMAIN ) );         }         $this->original = get_post( $post_id );         if ( ! isset( $this->original ) ) {             return new WP_Error( 'alternate_no_original', sprintf( __( 'The post ID: %s could not be found.', BUV_TEXTDOMAIN ), $post_id ) );         }         $new_version['post_type'] = $alt_post_type;         $new_version['post_parent'] = $this->original->ID;         $new_version['ID'] = null;         $new_version['post_status'] = 'draft';         $new_version['post_content'] = $this->original->post_content;         $new_version['post_name'] = $this->original->post_name;         $new_version['post_title'] = $this->original->post_title;         $new_version['post_excerpt'] = $this->original->post_excerpt;         $new_version['_subheading'] = $this->original->_subheading;         // Loop through Post Custom Meta and add to array          $custom_field_keys = get_post_custom_keys($new_version['post_parent']);         foreach ( $custom_field_keys as $key => $value ) {             $new_version[$value] = $this->original->$value;         }         //         $result = wp_insert_post($new_version);         if ( ! is_wp_error( $result ) ) {             $this->post = get_post( $result );             $this->copy_original_meta( $new_version );             update_post_meta( $this->original->ID, self::tracking_meta_key, $this->post->ID );         }         return $result;     }     /* Because of sanization and serialization, it may be better to use SQL, but for now we are using the API      **/     private function copy_original_meta( $new_version ) {            foreach ( $new_version as $key ) {             $values = get_post_meta( $this->original->ID, $key );             foreach ( $values as $v ) {                  update_post_meta( $this->post->ID, $key, $v );             }         }         update_post_meta( $this->post->ID, '_bu_version_copied_keys', $meta_keys);     }     /**      How can I get per say "Header Image" which is a ACF image field with a value of "field_64" on my page to populate the image field with the image ID of "426" when I duplicate the post? Or

         Header Image         Choose the image that will display in the header. If none is chosen, then a default image will be displayed. Make sure image chosen has dimensions that meet or exceed 1170 pixels across.

         <input class="acf-image-value" type="hidden" name="fields[field_64]" value="">

Remove

Edit

No image selected <input type="button" class="button add-image" value="Add Image">


title: Executing query_posts after wp_insert_post

text: am working on a custom plugin. I'm programmatically adding a new post in the plugin use `wp_insert_post`. Works fine, the post gets added and I get the `$post_id`. However, if I immediately run `query_posts` and try and reset the $wp_query to point to the new post_id I get nothing. I feel I am not using `query_posts` correctly ... because I would think it should return the new post.               <?php     wp_reset_query();          $args = array(         'post_title' => 'test post',         'post_author' => 1,         'post_status' => 'publish',     );          $post_id = wp_insert_post( $args );          if ( $post_id != 0) {         query_posts( array( 'post_id' => $post_id ) );     }


title: WordPress 3.1 and Disqus throws Warning: number_format() error in Posts List

text: After upgrading to WordPress 3.1, the comment count for each post in the Posts list now shows the PHP error `Warning: number_format() expects parameter 1 to be double, string given in /wp-includes/functions.php on line 155`. This problem is definitely related to the Disqus comments plugin, which I suspect is manipulating the comments count. I see how I could fix this error by editing the WP core file /wp-admin/includes/class-wp-list-table.php and neutering the "get_comments_number()" function, but I'd rather find a solution for whatever is being manipulated in disqus.php. Any thoughts?


title: How to add a filter to all widget output

text: Is there one last filter that is ran over the widgets before they are sent out to the browser? I would like to add a filter that adds `rel="nofollow"` to all links in all widgets. For instance, I can add a filter to the text widget:               add_filter('widget_text', 'xrvel_nfp_modify_nofollow');      But I don't want to hunt down every single hook for every widget. (Also, the RSS widget doesn't even HAVE a filter. Trac ticket submitted)


title: Delete Post From front Page ( With Wp-admin restriction )

text: am using this function to delete post from front               // Delete from Front-End Link          function wp_delete_post_link($link = 'Delete This', $before = '', $after = '', $title="Move this item to the Trash", $cssClass="delete-post") {         global $post;         if ( $post->post_type == 'page' ) {             if ( !current_user_can( 'edit_page' ) )                 return;         } else {             if ( !current_user_can( 'edit_post' ) )                 return;         }         $delLink = wp_nonce_url( site_url() . "/wp-admin/post.php?action=trash&post=" . $post->ID, 'trash-' . $post->post_type . '_' . $post->ID);         $link = ''.$link."";         return $before . $link . $after;     }      its work 100% but am using function to restrict no admin to access wp-admin, using this function :               function restrict_admin(){     //if not administrator, kill WordPress execution and provide a message         if ( ! current_user_can( 'create_users' ) ) {             wp_die( __('You are not allowed to access this part of the site') );         }     }     add_action( 'admin_init', 'restrict_admin', 1 );      **my problem** , how can i allow user ( not admin ) to delete his post own post ?


title: Check category_name or taxonomy slug for a Custom Post Type?

text:
I am checking the current page I am on and then using that to set a variable to change the category name like so.                   <?php             if (is_page('apples')) {                 $categoryname = 'Apples';             }                  $args = array (                  'posts_per_page' => -1,                 'post_type' => 'products',                 'category_name' => $categoryname             );                  $fruit_query = new WP_Query( $args );                  if ( $fruit_query->have_posts() ):                 while ( $fruit_query->have_posts() ) :                     $fruit_query->the_post();                           if ( has_post_thumbnail() ) {                        the_post_thumbnail();                     }                 ?>                          <?php the_title(); ?>
                     Harvest Week: From <?php the_field('harvest_week_from'); ?> to <?php the_field('harvest_week_to'); ?>
                     Colour: <?php the_field('colour'); ?>
                     Market Season: <?php the_field('market_season'); ?>
                     Market Sector: <?php the_field('market_sector'); ?>
                     <a href="<?php the_permalink();?>">Link to product
                      <?php endwhile;             else:                 // Insert any content or load a template for no posts found.             endif;                  wp_reset_query();              ?>      The problem however is that this a Custom Post Type so I think I should be checking the taxonomy since the category is not working. I have already tried examples from this page http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters but to no avail. Is there something else I am mean to be doing? Thanks **EDIT: This is the setup of my Custom Post Type**                   add_action('init', 'register_products');         function register_products() {         register_post_type('products', array(             'label' => 'Products',             'description' => '',             'public' => true,             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'map_meta_cap' => true,             'hierarchical' => false,             'rewrite' => array('slug' => 'products', 'with_front' => true),             'query_var' => true,             'supports' => array('title','editor','excerpt','trackbacks','custom-fields','comments','revisions','thumbnail','author','page-attributes','post-formats'),             'taxonomies' => array('category'),             'labels' => array (               'name' => 'Products',               'singular_name' => 'Product',               'menu_name' => 'Products',               'add_new' => 'Add Product',               'add_new_item' => 'Add New Product',               'edit' => 'Edit',               'edit_item' => 'Edit Product',               'new_item' => 'New Product',               'view' => 'View Product',               'view_item' => 'View Product',               'search_items' => 'Search Products',               'not_found' => 'No Products Found',               'not_found_in_trash' => 'No Products Found in Trash',               'parent' => 'Parent Product',             )         ));}      **Screenshot of the Dashboard:** ![enter image description here](http://i.stack.imgur.com/UeRsL.png)


title: template_redirect causing infinite loop when get_queried_object is called

text: I have a situation where I am calling get_queried_object() in the 'wp' action hook and it is causing an infinite 301 redirect. I can temporarily fix this by adding: > remove_filter( 'template_redirect', 'redirect_canonical' ); but I know this is a temporary fix because this disabled the auto redirect 404 errors. http://www.mydigitallife.info/how-to-disable-wordpress-canonical-url-or- permalink-auto-redirect/ http://docs.dev4press.com/tutorial/wordpress/canonical-redirect-problem-and- solutions/ The error seems to be server specific though because I've not seen it on dozens of other. And even stranger, caching prevents the issue from occurring when not logged in (using W3 Total Cache) 2012 theme activated and all other plugins are deactivated except the one calling get_queried_object. I also discovered that this was only an issue on the client's homepage.


title: Is it possible to make *.js and folders visible in theme-editor

text: I just created a file `test.js` in the folder of my own child-theme. Unfortunately it is not visible in the Theme editor. How can I make it visible? And is it possible to make folders visible?


title: Export plugin omits many images

text: I think I have never seen the WP Importer plugin work perfectly a single time. It always skips a few featured images. Is there a manual and hopefully more reliable procedure to export and import all posts/CPT with featured images?


title: Theme Activate Hook

text: I would like to write a function to email me the URL of the website when my theme is activated. What is the hook initiated when the theme is activated?


title: parallels plesk plugins installation fail error

text: Whenever I try to install Worldpress or any other plugin in Parallels Plesk 11.5 I get the Following error                   Error: Installation of WordPress at http://example.com/wordpress failed. ODBC         error #42S22: [MySQL][ODBC 5.1 Driver][mysqld-5.5.24-0ubuntu0.12.04.1]Unknown         column'T100253344.app_id' in 'where clause'       that didn't happen before I upgrade Plesk.


title: Enqueueing Scripts and Styles

text: I'm trying to enqueue my custom script and style with the block of codes, the scripts works but not the style. I don't know what I'm doing wrong.                   function my_scripts_method() {                  wp_deregister_script( 'jquery' );                         wp_deregister_script( 'style' );                      wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js' );                         wp_register_style( 'style', '//siteripe.com/style.css' );            }                       add_action('wp_enqueue_scripts', 'my_scripts_method');         add_action('wp_enqueue_style', 'my_style_method');


title: How to remove "read more" link from custom post type excerpt

text: Is there a way I can add some kind of `pre_get_posts()` filter to strip out the "read more" link that appears at the end of `the_excerpt()` for only 1 certain custom post type that I specify? If so, can someone please help me out with the code? I've been working at it for a while but haven't gotten anywhere. Any help would be greatly appreciated. Thanks!


title: How to embed form data within the 'Add new post'

text: I want users to be able to use a car template in new posts. The template will include items such as a photograph of a car, make, model, number of doors, colour of car, etc. Users will not want to use the template in every one of their posts. How should I do this? My idea is to: **Create a new widget within the 'Add new post' page. This would contain a form in which the user can upload a photograph and enter data (in text input fields).** **Once the user has completed the form (within the widget), they could press a button (either in the widget or in the 'Add new post' toolbar) which will embed the form data into the new post.** Please can you tell me if this would be a good/best approach, or if I should do it another way.


title: Can't get blog entry to format properly using wp-load

text: I'm setting up a blog that I'm trying to integrate the posts of into old site pages. The               $id = $_GET['article_id'];     $post = get_post($id);     setup_postdata($post);     echo $post->post_content;      However, when I echo the blog post from `$post->post_content`, it seems that the html has been stripped out. The lines all run together. There are line breaks in the source, but there are no html `<BR>`s or `<p>`s. However, the post looks fine when I view it through the actual WordPress page. I have to use `<pre>` to get it to display properly, but then on the page, lines don't wrap and it defaults to that typewriter font. What am I doing wrong?


title: How to make multi -column, interesting home page in Weaver 2010?

text: (I am pretty new to wordpress - am a C++ developer, not an html/css coder, but I am trying.) I am having trouble figuring out how to make a home page that has blurbs about some of our products, etc and generally make something better than just a static page of text. I want to have some pictures, perhaps a three columns or two columns of little bits of intro text that users can click on to go to other pages. I am at a loss about how to do that. Do I need the widgets, or something? It is very unclear to me how to make it work. I'll try to post some samples of what I am looking to do - but it really isn't all that fancy. Some links to resources would be great - I am so new to this I don't know where to go for help or documentation. What I need is a simple "how to do this" tutorial. Thanks


title: Custom Post Type Query for Sidebar Doesn't Work on Front Page

text:
Interesting issue here. I have this:               $args=array(     'meta_key'=>'_simple_fields_fieldGroupID_1_fieldID_8_numInSet_0',       'post_type' => 'stores',       'post_status' => 'publish',       'posts_per_page' => 10,       'caller_get_posts'=> 1     );     $my_query = null;     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {       while ($my_query->have_posts()) : $my_query->the_post(); ?>

     <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php $selected_value = get_post_meta(get_the_id(), "_simple_fields_fieldGroupID_1_fieldID_9_numInSet_0", true);       echo "$selected_value"; ?> at <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>

     <?php       endwhile;          }     wp_reset_query();  // Restore global post data stomped by the_post().      Which intends to display a list of a specific post type (stores) in the sidebar if a specific custom field is not empty. On single posts that works great - on the main page (home.php) it doesn't - the sidebar widget is empty. I'm stumped. Any ideas? John


title: Specifying # of Posts per page using inline post plugin (:

text: I am working on a website for my school. I downloaded the inline post plugin. This plug-in allows you to make posts on multiple pages throughout the site. However, I am having trouble displaying a certain number of posts per page. Please let me know what I can do. Thank you (:


title: Disable Create New tags for posts

text: > **Possible Duplicate:**   >  Can I turn off write-in tags/taxonomies? I am trying to disable creation of new tags for posts. If a tag is in exisiting list of tags, it will be added with post otherwise deleted. The code i am using doesn't seem to work. Here is the code               add_filter( 'pre_post_tags_input', 'no_tags_input_create' );                         add_action( 'publish_post', 'no_tags_input_create' );           add_action( 'publish_updated', 'no_tags_input_create' );          add_action( 'save_post', 'no_tags_input_create' );               function no_tags_input_create($post_ID) {     $taxonomy_ar = wp_get_post_tags( $post_ID );                 if (count($taxonomy_ar) > 0){         foreach ($taxonomy_ar as $taxonomy_term) {               $term_ids= $taxonomy_term->term_id;      $tags_name[]= $taxonomy_term->name;     }          }         $output = array();              foreach( $tags_name as $tag )             if( !term_exists( $tag, 'post_tag') ){                  wp_delete_term($term_ids,'post_tag');              wp_set_post_tags( $post_ID, '', false );                 }          }      Can anyone point out where i am wrong?


title: How to create a sharing marketplace with wordpress for bicycles?

text: I want to create a marketplace for bicycles with wordpress. Users can register/login and sell their bicycle to other users. They also can create a pre-defined page for their bicycle... Which wordpress plugins do i have to use or do I have to write my own plugin? How would you create such a site?


title: What are the critical theme files when building a custom theme?

text: What are the critical files a theme MUST have to be a WordPress theme and validate properly?


title: Get plugin_dir_url() from one level deep within plugin

text: I've written several plugins using the structure : /plugins/myplugin/myplugin.php /plugins/myplugin/class/class-myclass.php So as to take advantage of OO and overall structuring my code From within the class file there are times I need to get the URL of the base plugin... I have been using the following, but I'm sure there's a better way:               $this->plugin_location = substr(plugin_dir_url(__FILE__),0, strrpos(plugin_dir_url(__FILE__), "/",-2)) . "/";      Another idea I toyed with was having an additional singleton class that stores all of the settings for the plugin and adding an abstraction layer via the class files. Any help is greatly appreciated.


title: Exclude comments on page X from site's comments RSS feed

text: I would like to exclude comments on a certain page from the site's comments RSS feed (site.com/comments/feed/). I've done some searching but failed to find any info on how this could be achieved. Any help would be appreaciated.


title: Rewrite rules custom post type

text: I created a new custom post type "video" and a new taxonomy "singers". There are 3 singers: Michael Jackson, Madonna, Eminem. I'd like change the permalink and so I'd like this URL: www.example.com/madonna/video-like-a-prayer (where "madonna" is the singer, "video" is the post type and "like-a-prayer" is the post name). How can I resolve please? Thanks.


title: Translating form labels shortcode output

text: I'm using MyMail plugin to manage my newsletter.   I'm also using WPML to manage translations, there is no compatibility between the two plugins.   The subscription form, is placed in the footer area, through a MyMail shortcode and the wordpress text widget. I want to translate the field labels, to the active language: So I was thinking on writing a filter for the "widget_text", search the "label name" and preg_replace() its output... But I don't find the way to achieve it. Looking in the php class that manage the form, I could see that the function that outputs the form, stores the final code as:               return apply_filters('mymail_form', $html, $formid, $form);      So I guess that I need "search and replace" in the $html variable. Any ideas? Many thanks!


I turned on debug mode and see the following in my header: **Notice: Use of undefined constant - assumed ' '** I'm using the following function in header.php:               <?php if ( is_user_logged_in() ) {           global $current_user;         get_currentuserinfo();         echo $current_user->display_name; //affected line     } else {     ...     }?>


title: I need to dynamic insert post containing javascript from my other website?

text: I am trying to dynamicly add some content post (also containing some js), but the javascript part is filter out. I thought by using wp_set_current_user the js would be included. This is my main function which generate the post                  function mydomain_which_page2($atts) {         extract( shortcode_atts( array(             'temp_title' => 'something'         ), $atts ) );             //post exists?         if( wp_exist_post_by_title( $temp_title ) ) {             $redirect_title = sanitize_title( $temp_title);             header('Location:' . $redirect_title);             exit();         } else {              // post does not exist             wp_set_current_user(NULL, 'Test user');             //GET THE MAPS             $output = getIncludeContent('myotherdomain.com/generate.php');              //SAVE AS WP POSTS             mydomain_add_post($temp_title,$output);             //REDIRECT             $redirect_title = sanitize_title( $temp_title);             header('Location:' . $redirect_title);             exit();         }        }      directly going to myotherdomain.com/generate.php will output the js in source code also $output will show the source code with js. and add_post function               function add_post($title, $content){         // Create post object wp_strip_all_tags         //$content = strip_tags($content);              $my_post = array(           'post_title'    => $title,           'post_content'  => $content,           'post_name'   => sanitize_title($title),           'post_status'   => 'publish',           'post_author'   => 1,           'post_category' => array(1)         );              // Insert the post into the database         wp_insert_post( $my_post );      }      Any tips, suggestions? regards


title: Create a custom capability to allow an 'Editor' to edit only 'Subscriber' users

text: I want to create a new "Moderator" role (in between Administrator and Editor), that can edit only "Subscriber" type user accounts. I can create the role and add existing wp capabilities, but I don't know how to create a new capability, 'edit_subscriber', that can do that. Any insight appreciated.


title: How to 'If Author' Comments Check

text:
I would like to add extra markup to a comment made by the site admin/post author. Is there a check for this and how would I add it to my code below? Basically, if the comment is from the post author I would like to add HTML next to their name (Author or Admin). Thanks
                              <?php printf(__('%s said on'), get_comment_author_link()) ?>                     <a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">                     <?php                         printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','' );                     ?>


title: How to echo JS right after enqueued script to put it into noConflict mode?

text: I want to include and use third party JavaScript file (Bootstrap Tooltip) in my plugin. Since Bootstrap is highly popular framework and `tooltip()` is rather generic name I want to make use of included `noConflict()` functionality to isolate tooltip's instance in my own variable. If I understand timing at all right, this needs to be done right after script file loaded - so that nothing else has a chance to mess up instance (it had just set up) or get messed up by it either. However there seems to be no convention in queue functionality to echo JS at such point. `$wp_scripts->print_extra_script()` is called _before_ the script. Is this at all possible to accomplish with current queue implementation?


title: count number of posts (public , private , protected) by category name

text: I wanted to count number of posts (public, private, protected) according to a category name suppose `blog` . To get all the posts no matter what category i used `$total_pages = wp_count_posts()->publish;` But i cant figure out how to count number of posts for a category name `blog`


title: How to get Gallery ID in nextgen template

text: I want to retrieve gallery description in file ...\wp-content\plugins\nextgen- gallery\products\photocrati_nextgen\modules\nextgen_basic_gallery\templates\thumbnails but it is must to know gallery id.How can i retrieve variable gallery id?


title: Why is archive.php used for my page

text: I have a page "Portfolio", it contains a loop that outputs the list of portfolio (Custom Post Type, _is this the problem?_ ) items using `page- portfolio.php`. Problem is somehow WordPress used the `archive.php` to render my portfolio page, why is that?


title: Remove media button from the custom post type support editor

text: Below code removes the medial button from other editors as well.. how to remove the editor from the post type support editor                  add_action('admin_head', 'remove_mediabuttons');               function remove_mediabuttons()     {         global $post;              if($post->post_type == 'custom_post_type' && current_user_can('edit_post') )         {             remove_action( 'media_buttons', 'media_buttons' );         }     }


title: Wordpress stylesheet isn't being added

text: I have recently started to learn WordPress and after learning how to use it at basic level I immediately started to learn how to develop templates since this is what interested me from the start when I started to learn it. I am reading WordPress 3 Complete and at Chapter 6 the book guides you to develop your first basic theme. The only problem is that it seems that my theme is not taking the style sheet. I have tried to use:               <link rel="stylesheet" type="text/css" href="style.css"/>       and               <style type="text/css">@import url("style.css");</style>      None of them seem to get the style on the page. What should I do?


title: WordPress Custom Application form

text: * I want to implement an application form with WordPress, Preferably using a plugin. What I need here is not a contact us form, But I need a complete registration form or customer registration form or student registration form. This means fields could be customized according to particular need. or   * I want a fixed number of columns table plugin which has a form and store data to that table. Because i want to show that table in my reports under wordpress admin panel. I am open to any suggestion. Even if i am going totally wrong. Please guide me. Thanks,


title: Loop from another WP site onto mine

text:
What i'm trying to achieve is bringing a loop from one WP site into another WP Site. I used this method to get the loop into an external php file (which all works fine, the results show)               <?php     define('WP_USE_THEMES', false);     require('path_on_server/wp-blog-header.php');     query_posts('showposts=5');     ?>          <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
             <a href="<?php the_permalink() ?>"><?php the_title(); ?>" />
     <?php endwhile; endif;  ?>      I then try and include the file in my sidebar using a simple php include call but the results don't show.... I imagine this is because of some sort of confliction between my WP & the other sites WP. Any help on achieving this? Thanks


title: Can't access WordPress functions in file called via Ajax?

text: I am trying to reload the fresh posts using jQuery. As far as I know, I can't reload the contents of a div inside the page so I reload a file into that div. The problem is that my loaded file gives me a **Fatal error: Call to undefined function wp_query()** How can I implement functions to a newly created file inside the theme directory to work properly? _**This is my jQuery_**               <script language="JavaScript">     $(function() {         var SANAjax = function(){              }         setInterval(SANAjax, 15000 );     });     </script>      _**And this is what i have in`reloadhomeposts.php` (I have deleted the content though)_**               <?php $recent = new WP_Query("cat=3,4,5&showposts=10"); while($recent->have_posts()) : $recent->the_post();?>     .     .     .     <?php endwhile; ?>


title: How to get posts from network blog

text: So I have function that gets posts with URL(id) (ajax stuff). It works but now I would like also fetch posts from other blogs in my network. I'm baffled how can I achieve this? Do I have to know the blog ID too somehow? So now it pass to my function the URL and with get_blog_id_from_url I get ID of the post and fetch all data and pass it via JSON back to fronded. But if I pass url of some of network blog, it doesn't know how fetch post data from that post. EDIT: here is the function:               function my_query(){       $url = $_POST['url'];            $rsp_post = array();            $post_id = url_to_postid( $url );            global $post;       $post = get_post( $post_id );            $rsp_post[] = array(         'post_title' => $post->post_title,         'post_date' => $post->post_date       );       print json_encode( $rsp_post );            exit;     }


title: Conditional statement to show pagination

text:
I'm using pagination to navigate between posts from the same category. Here is my code:

             <?php next_post_link('%link', 'Article Précédent', TRUE); ?>

             <?php previous_post_link('%link', 'Article Suivant', TRUE);?>

      It works perfectly. But what I am trying to do is to add an `if` statement, to show the div with ID `article_single_prev_next` only if there are next of previous pages inside the category. I tried using this code without success:               <?php if (show_posts_nav('%link')) : ?>

                 <?php next_post_link('%link', 'Article Précédent', TRUE); ?>

                 <?php previous_post_link('%link', 'Article Suivant', TRUE);?>

      Can anybody help me with this?


title: What is the expected limit for acceptable performance of WordPress without any adjustments?

text: In your experience, when is the time one needs to start thinking about scaling up? **What is the expected performance of a common WordPress installation on a standard Apache web server, without any [performance tweaks or plugins]** (Steps to Optimize WordPress in Regard to Server Load?)? In terms of page loads (let's assume no caching): **Is it in range of 100's/1000's/+ of page loads per second?** In terms of traffic: **At which number of users per day can one expect to start hitting performance bottlenecks (ignoring traffic, assuming great connection)?**


title: Profiling a WordPress Website for Deployment on Shared Hosting?

text: I am having a problem with CPU usage on my website, and am looking for a way to detect (and fix) what is causing it. A topic not covered in this question. Following on Hakre answer here, I now realize that what I need to do is profile my PHP calling. Is it reasonable to put the website on my own computer, run the profiler, and use that information to improve my website? Any other suggestions on how to do this in the best way?


title: Inserted double quote when prepending to the_content

text: I am trying to write a plug-in to display the RunKeeper Healthy button on single posts, but my output has an extra space and double-quote when I look at the page source. What I'm trying to do with the button is open a new window via inline JavaScript. I've tried switching between single and double quotes and have also ensured that I was escaping nested quotes properly. Trying to append the `get_permalink()` breaks the generated link for the RunKeeper sharing URL. The image tag for the link itself is fine, but I see an incomplete link when I hover over it. The link output is:                     But what I would expect is:                     This is what my plug-in code is so far:               add_filter('the_content', 'add_runkeeper_btn' );          function add_runkeeper_btn($content) {         $output = "";              if (is_single()) {             $output .= "";             $output .= "";             $output .= "";         }              return $output . $content;     }      For reference this is what is in the page source of the RunKeeper blog post. I am trying to modify it so that the `healthyUrl` query parameter references the permalink for the post.


title: wp_nav_menu and fallback

text: I am using this code to call any custom menu and display:               <?php      wp_nav_menu( array(          'container' => 'none',          'container_class' => 'menu-header',          'theme_location' => 'primary',          'menu' => get_post_meta( $post->ID, 'MenuName', true) )      ); ?>      At the moment if there is no custom menu defined it falls back to the primary menu. I am trying to edit this code, so if there is no custom menu then display nothing. Having no luck, doesn't help that I'm new to php and wordpress. I have searched online and tried a few other solutions. Knowing my luck it's probably something really simple. If anyone could help me out, I'd appreciate it a lot! Thanks


title: Get_the_term_list inexplicably adds values in foreach

text:
I'm trying to get three values from all my custom posts, to populate a Google Map with the places where I've been. All is going fairly well, except for an issue I'm having with `get_the_term_list`. For some reason it adds the number **"1"** in front of each correctly returned value. As an example, my below code will output the following for "name":               Key: name, Value: 1     Grossglockner
      The problem code:               <?php      //get custom posts ids as an array     $loop = get_posts(array(         'post_type'   => 'trips',         'post_status' => 'publish',         'posts_per_page' => -1,         'fields' => 'ids'         )     );     //loop through each post     foreach($loop as $p){         //get the meta and taxonomy data          $name = get_the_term_list($p, "mountains",true);          $wtr_longitud = get_post_meta($p,"wtr_longitude",true);          $wtr_latitud = get_post_meta($p,"wtr_latitude",true);              //Add to Array         $map_array[] = array ("name" => $name, "latitude" => $wtr_latitud, "longitude" => $wtr_longitud);     }             //Print array             foreach($map_array as $y) {                         foreach( $y as $key => $value){                         echo "Key: $key, Value: $value
";                         }                 }     ?>


title: $wpdb->insert() and Values for Datetime Columns?

text: I have a custom table with a DATETIME column. I have a function to add records; I would like to add an `$expires` argument to this function which can hold a unix timestamp noting when the record should expire. I would like to use `$wpdb->insert()` to populate this column. So far I've been unable to find a WordPress convenience function to massage the timestamp into 'YYYY-MM-DD HH:MM:SS' format. Is there such a builtin, or should I just use `$wpdb->prepare()`, or possibly a third option?


title: Is there a WordPress plugin to design WebGL?

text: I have been working as a WordPress designer/developer for some time and now I've decided to write a plugin myself. I also have some OpenGL experience (not web based). I was thinking is it worth investing my time learning WebGL and then using it to create a WebGL designer plugin for WordPress? **To elaborate:** My plugin would allow designers and non-coders to design WebGL based animations and games using basic building blocks and preset animations. It wouldn't be as good as writing the code yourself but it'd be a good start. It would be as simple as "drag and drop" and all the code will automatically be generated by this plugin. Is it a good idea? Is there really a need for it? Is WordPress a suitable platform for this? And most importantly are there any existing plugins for designing WebGL out there?


title: When click Update button all changes are lost

text: when I update the slider on my site's home page and click `preview changes`, I can see the changes. But when I click `Update` everything is lost. What causes this? How to solve this? Any suggestions will be appreciated. Thanks in advance.


title: How to delete custom taxonomy terms in plugin's uninstall.php?

text: I am writing my plugin's uninstall.php file and would like it to delete any terms that were created in the plugin's custom taxonomy. In the plugin's uninstall.php file I am using this:               // Delete all custom terms for this taxonomy     $terms = get_terms('custom_taxonomy');     foreach ($terms as $term) {         wp_delete_term( $term->ID, 'custom_taxonomy' );     }      The problem seems to be that the custom taxonomy isn't registered at this point, so get_terms returns an error for "invalid taxonomy", thus I can't delete the custom terms in this manner, which seems the most straightforward way to do so. If the custom taxonomy isn't registered when uninstall.php is called, how can I have it so that my plugin is able to clean up it's custom data? Any help is greatly appreciated. Thanks.


title: comment meta_query for keys that aren't yet set

text: I need query help! I am trying to set up a `meta_query` (for `get_comments`) for keys that aren't yet set. I have some code that allows moderators to add a custom meta key to individual comments. Click the checkbox and the meta key is set to `shadow`, unclick it the meta key is set to an empty string. This means that there are three possible states for a comment to have. It can either have the 'shadow' meta key, it can have an empty string and the meta key, or the meta key could not be set. What I would like to do is query all comments that either don't have this meta key set or have the meta key that is NOT shadow. It is fairly easy to select all comments that have the meta key not equal `shadow` but I haven't found a away to also select comments that don't have the meta key set. This is the code I am using, but it doesn't work. It selects every comment that has the meta key set, regardless of what it is set to.                           $comments = get_comments( array(                      'meta_query' => array(                         'relation' => 'OR',                         array( // Select comments that don't have the 'shadow' p3_comment_status meta                             'key' => 'p3_comment_status',                             'value' => 'shadow',                             'compare' => '!='                         ),                         array( // Select comments that don't have the p3_comment_status set                             'key' => 'p3_comment_status',                             'compare' => 'NOT EXISTS'                         )                     )                     )                 );      Any help would be appricieated. Thanks **UPDATE:** For the record this is the code that ultimately worked for me:                           $comments = get_comments( array(                      'order' => 'ASC',                     'post_id' => get_the_ID(),                     'meta_query' => array(                         'relation' => 'OR',                         array( // Select comments that don't have the 'shadow' p3_comment_status meta                             'key' => 'p3_comment_status',                             'value' => 'shadow',                             'compare' => '!='                         ),                         array( // Select comments that don't have the p3_comment_status set                             'key' => 'p3_comment_status',                             'compare' => 'NOT EXISTS',                             'value' => ''                         )                     )                 ) );      The key was to set `'post_id' => get_the_ID()`


title: Allowing shortcodes inside attributes

text: I want to do a Wikipedia-like infobox for some articles on a WP site. I guess the most logical thing to do it is to use a custom shortcode—one that returns a table-like markup with a fixed order of fields, each with more markup at custom along some conditional stuff for showing or not fields if they are not set, somewhat emulating something like this:                <!--MediaWiki markup-->      {{infobox-cd      |name=Abbey Road"      |cover=[[File:laserdisc.jpg]]      |artist=[[The Bombay Beach Boys]]      |country={{flag id=mx}} Argentina<br />{{flag id=dk}} Vanuatu (post-production)      |rating={{stars no=3}}      |prev=[[The Wall]]      |next=[[Born in the U.S.A.]]      }}      Yet I have been blocked from using them in a more literal approach for years due to shortcodes breaking while having brackets inside attributes. It theoretically should work, but doesn't because the shortcode regex stops with the first occurrence of a closing bracket (]) in a shortcode, so in this:               [foo bar="[baz /]"]content[/foo]      it "outputs":               [foo bar="[baz /]      I'm not sure how else I can get this markup working or something else with the same goal.


title: How to delete user on logout and when session expires?

text: I am looking for a way to delete a user when they logout and when session expires...whatever one happens first? Reason being is that all login authentication happens through an api to another company and checks if the user is a registered user with that company. Then the login will give them WP login authentication. All of this works, but I now want to delete users when they log out or when their session expires. Thanks.


title: How to include specific post terms in Facebook share?

text:
So I already added the necessary scripts to add a Facebook share button in my posts

               <div class="fb-share-button" data-href="<?php the_permalink(); ?>" data-type="button_count">
      But so far, it is only showing the Title and Content of the post. How do I include specific post terms in the share function?


title: How to exclude scripts from being moved to the footer using their handle?

text: I'm working on a small plugin that moves all scripts to the footer using the following code:               function move_scripts_to_footer() {              global $td_options;              if ( !is_admin() and isset( $td_options['scripts_to_footer'] ) ) {             remove_action( 'wp_head', 'wp_print_scripts' );             remove_action( 'wp_head', 'wp_print_head_scripts', 9 );             remove_action( 'wp_head', 'wp_enqueue_scripts', 1 );         }     }          add_action( 'wp_enqueue_scripts', 'move_scripts_to_footer' );      In the plugin options page I added the following option that is supposed to exclude certain scripts using their handles (e.g. "jquery") but it seems to be a real challenge to make it work with the above function:               <textarea name="js_exceptions" id="js_exceptions" value="<?php echo $js_exceptions; ?>" /><?php echo $js_exceptions; ?></textarea>      Since I noticed that some of scripts need to be in the head, I need to know how can I exclude certains scripts from being moved to the footer using their handles. I tried all sorts of variations for 2 days but nothing works so any help will be greatly appreciated. Thank you!


title: One of the messages in .po file doesn't show up

text: I've changed a file `wp-content/languages/pl_PL.po`               #: bfa_header.php     msgid "notice"     msgstr "napis"          msgid "Online Information Website"     msgstr "Internetowy Portal Informacyjny"          msgid "something"     msgstr "coś"      I've added the second pair. It works for another language, but doesn't work for this one. All other messages are working. What might be the problem?


title: quey posts from different categories with taxonomy

text: I wonder if someone could help me. I just upgrade my wordpress and start to use taxonomy. what I want to do is to query posts from different categories. I used to do it like this `query_posts('cat=5');` but with taxonomy added to my categories, doesnt work anymore for example if I go to a category page the link goes like this `www.website.com/ad-category/cars` I guess my taxonomy category name is "ad-category" and the category name is cars but how could I query posts from categories ids, example 5,6,7,8 etc.. Thak you for your time!!


title: What is a good robots.txt?

text: What is the "best" setup for `robots.txt`?   I'm using the following permalink structure `/%category%/%postname%/`. My `robots.txt` currently looks like this (copied from somewhere a long time ago):               User-agent: *     Disallow: /cgi-bin     Disallow: /wp-admin     Disallow: /wp-includes     Disallow: /wp-content/plugins     Disallow: /wp-content/cache     Disallow: /wp-content/themes     Disallow: /trackback     Disallow: /comments     Disallow: /category/*/*     Disallow: */trackback     Disallow: */comments        1. I want my comments to be indext. So I can remove this   2. Do I want to disallow indexing categories because of my permalinkstructure?   3. An article can have several tags and be in multiple categories. This may cause duplicates in google. How should I work around this? Would you change anything else here?


title: Password protected photo galleries

text: What is the best way to password protect individual photo galleries so individual users can log in and view their user specific photo gallery?


title: Show 'Read more' in rss feed

text: How can I show 'Read more' links in rss feed instead of showing excerpt? The settings in reading only allow to choose between full content and excerpt.


title: Initialization Script for "Standard" Aspects of a WordPress Website?

text: I am about to have to write **a script to take a fresh install of WordPress 3.0.1 and add-in all the initial features for a website**. This is for a company that installs lots of similar websites and they need a standard starting point in configuration and data.   * **I'm wondering if anyone else has already done this and if so if they can share their code?** **I envision we will tweak this script each time** they create a new site so _hard-coding is fine_ although eventually (after enough experience) I'd like to convert into a plugin. **Here's the basic list of tasks** I think we'll need _(these assume I've started with WordPress 3.0.1 already installed and my custom plugins and custom theme copied into the appropriate directories)_ :               // Create users for the current site     // Delete Hello Dolly Plugin     // Download, Install and Activate repository plugins     // Activate Custom Plugins (assume the plugins are already there)     // Activate Custom Theme     // Delete Hello Post     // Delete Comment on Hello Post     // Create Pages with Starter Content     // Create Initial Custom Post Types with Starter Content     // Create Multiple Menus      // Create Menu Items for those Menus linking to Pages and wp-login.php     // Create Initial Taxonomy Terms     // Set Desired Permalinks Setting     // Set Static Front Page Setting      That's about it (though I may identify more as I get into it.) Again, I'm **looking for code that I can just copy and modify** so I don't have don't have to figure out all these details myself _(which is not hard, just tedious and time consuming)_. Oh one more thing, **I have to start on this _now_** so the sooner the better! :-)


title: Widget constructor: about $id_base and $options

text: in the book professional wordpress, they use something like               $options = array(         'classname' => 'pp_widget',         'description' => '...'     );     $this->WP_Widget('pp_widget', ..., $options);      but in most tutorials               $this->WP_Widget(false, ...      is used. i wonder is there a reason to specify the `$id_base` param? i see that if i dont, an `id` will be generated. also, is there any need to specify the `classname` option? on a side note, i asked a related question on stack overflow: PHP: `parent::somefunction` or `$this->somefunction` if someone got an answer let me know :)


title: update_post_meta not adding anything.(Nor add_post_meta)

text: So I have made some kind of importer(From another non WP db to my WP db) which handles everything in a click of a button. Now it does correctly create a post type although one of the custom fields made with ACF in which I have to place the ID from the other DB is not filling in correctly and I did this according to `update_post_meta`. Now I have no idea what the issue is because when I look into my Wordpress DB it shows that it adds it correctly into the database but it does not add(Better said Show) WITH the custom post in the WP-Admin. This is the code i've used:               <form action="" method="post">         <input type="submit" value="Test" id="submit" name="submit">         <?php              if(isset($_POST['submit'])){         foreach ($result as $c) {             $postargs = array(                 'post_title'   => $c->member_name,                 'post_status'  => 'draft',                 'post_type'    => 'bedrijf'             );                  $thisid = wp_insert_post ( $postargs, true);                  if ( is_wp_error($thisid) ) {                 return get_error_codes();             } else {                   update_post_meta( $thisid, $meta_key, $c->memberID);             }           }         }              ?>           </form>      A screenshot from my DB showing that it does add(Yes the meta key is correct as I only have one custom field). The meta value is also correct as I put it on LIMIT 1 in the query I have so it shows the first value of the DB only. ![DB Image](http://i.stack.imgur.com/rHlhf.png) EDIT: To be exact it adds it in the `wp_postmeta` table.


title: Translate arguments of a user added custom code

text:
I needed to hardcode some extra code to a existing portfolio-template. Now there are two arguments which values need to be translated:

News

                precisely `href` value `/news/` and `News` between `<h4>` tags. I'm using WPML to translate the rest of the sites content but I cannot get these values to appear in the **string translation** admin area. How do I achieve this?


title: How to create a custom search form and handler?

text: I'm trying to build a search that, depending on what user chosen in admin, will either query one of several external api search methods with user input, save all the results in database and then display them or it will search the custom tables in database, it should also be fully encapsulated in a plugin. I already have the business logic that does this, I'm having trouble hooking it up to WP. What would be the best way to accomplish this? edit: sorry, it was probably quite vague question, what I have is an app I described above built on php framework, what I want to do is move it to WP, the problem is while the logic itself will require little modification, I have no idea how to hook it up to wordpress via plugin, essentially how do I create a form with plugin and how do I take input from that form and direct it to the logic that will handle that request?


title: Enqueue script in specific page

text: I am building a wordpress theme with a theme dashboard with options, but as I read somewhere, the enqueue script code I am using just enqueues it in the backend but it loads in every page in the backend. So I am having some js conflicts... I have this code:               add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'ikos_admin');     add_submenu_page(basename(__FILE__), $themename . ' Options', 'Theme Options', 'administrator',  basename(__FILE__),'ikos_admin'); // Default     }               function ikos_add_init() {              $file_dir=get_bloginfo('template_directory');         wp_enqueue_style("ikosCss", $file_dir."/functions/theme-options.css", false, "1.0", "all");         wp_enqueue_script("ikosScript", $file_dir."/functions/theme-options.js");         wp_enqueue_script("ikospickerScript", $file_dir."/functions/color-picker.js", array( 'farbtastic', 'jquery' ) );         wp_enqueue_style( 'farbtastic' );         wp_enqueue_style( 'farbtastic' );         wp_register_script('my-upload', $file_dir."/functions/upload.js");         wp_enqueue_script('my-upload');                  if(function_exists( 'wp_enqueue_media' )){             wp_enqueue_media();     }else{             wp_enqueue_style('thickbox');             wp_enqueue_script('media-upload');             wp_enqueue_script('thickbox');           }          }      So, how do I enqueue those scripts in that specific admin page only??? Thanks :D **EDIT** YEAH NOW IT IS WORKING! New code using the hook, then I added the var_dump( $hook_suffix ); exactly before the abort/return statement as @kaiser told me in the comments and it printed this: **string(0) "" string(27) "toplevel_page_theme-options" **. So I just added the "toplevel_page_theme-options" in the ikos_add_init($hook_suffix) and it works!               $hook_suffix = add_menu_page($themename, $themename, 'administrator', basename(__FILE__), 'ikos_admin');     add_submenu_page(basename(__FILE__), $themename . ' Options', 'Theme Options', 'administrator',  basename(__FILE__),'ikos_admin'); // Default          }               add_action( 'admin_enqueue_scripts', 'ikos_add_init' );          function ikos_add_init($hook_suffix) {         if ( 'toplevel_page_theme-options' !== $hook_suffix )         return;         $file_dir=get_template_directory_uri();         wp_enqueue_style("ikosCss", $file_dir."/functions/theme-options.css", false, "1.0", "all");         wp_enqueue_script("ikosScript", $file_dir."/functions/theme-options.js");         wp_enqueue_script("ikospickerScript", $file_dir."/functions/color-picker.js", array( 'farbtastic', 'jquery' ) );         wp_enqueue_style( 'farbtastic' );         wp_enqueue_style( 'farbtastic' );         wp_register_script('my-upload', $file_dir."/functions/upload.js");         wp_enqueue_script('my-upload');                  if(function_exists( 'wp_enqueue_media' )){                 wp_enqueue_media();     }else{             wp_enqueue_style('thickbox');             wp_enqueue_script('media-upload');             wp_enqueue_script('thickbox');           }          }


title: Difference between stylesheet_directory and template_directory

text: What is the differene between stylesheet_directory and template_directory? Is that representing Child theme and Parent theme?


title: Do I need to flush rewrite rules when creating new user if using custom author rewrite rules?

text: I am using custom urls for my author pages like this: `http://site.com/author_name` After I create a new user, that author page appears as not found; however, if I update my permalink structure from admin panel, the author page is found. So, is it necessary to flush rewrite rules after a new user is created? Is there any other way? From codex, I read that flushing rewrite rules is a very expensive task. So, I would like to avoid this. Is it possible? EDIT:               add_filter('author_rewrite_rules', 'no_author_base_rewrite_rules');     function no_author_base_rewrite_rules($author_rewrite) {          global $wpdb;         $author_rewrite = array();         $authors = $wpdb->get_results("SELECT user_nicename AS nicename from $wpdb->users");             foreach($authors as $author) {             $author_rewrite["({$author->nicename})/page/?([0-9]+)/?$"] = 'index.php?author_name=$matches[1]&paged=$matches[2]';             $author_rewrite["({$author->nicename})/?$"] = 'index.php?author_name=$matches[1]';         }            return $author_rewrite;     }          add_filter('author_link', 'no_author_base', 1000, 2);     function no_author_base($link, $author_id) {         $link_base = trailingslashit(get_option('home'));         $link = preg_replace("|^{$link_base}author/|", '', $link);         return $link_base . $link;     }


title: Converting HTML5 to XHTML

text: What do I need to ponder if I want to convert Twenty Eleven theme to XHTML? Is it just the matter of replacing the HTML5 for divs?


title: how to add class to the ul returned by wp_list_bookmarks

text: wp_list_bookmarks returns HTML that has a `ul` with classes `xoxo blogroll`. I'd like to add another class to that ul, but can't seem to find an elegant way to do so. wp_list_bookmarks does accept an argument "class", but that is applied to the li, not the ul. Is there some argument I'm missing? Or is there a hook I can hook onto and add a class?


title: Cannot access WordPress install on subdirectory of drupal site

text: I want to convert my site from Drupal to WordPress. I installed WordPress in a subdirectory so I can tweak it until I'm ready to delete drupal and move it to the root folder. After installing I cannot access the WP index in the subdirectory. I get this in firefox: "The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete.               *   This problem can sometimes be caused by disabling or refusing to accept           cookies."      I have cleared my browser and still get the same error. It must have some conflict with drupal. The drupal part of the site is still working ok. When I try to load my WP admin login url in the subdirectory it loads ok, but as soon as I submit my username and password, it redirects me to the login again. Any clues? Thanks UPDATE: I contacted my host and the problem was WP was not creating an .htaccess file when installing to a subdirectory. I tried installing WP a few times and it would never create an .htaccess file within the subdirectory. I'm using hostgator. I don't know if it was because there already was an .htaccess in root (from drupal) or something to do with my host.


title: How to add URL-Parameter for Javascript Widgets?

text: I need to add pamarameters to URLs that are read by javascript widgest/gadgets run on the site. Whenever I just add them e.g. the original URL is `http://example.com/blog/page/` and the parameter is called _foo_ with a value called _bar_. The new URL becomes: `http://example.com/blog/page/?foo=bar` The original URL is working fine, **but the new URL is giving a 404**. I assume that I need to register any additional parameter so that this works first. Is this true? How can I make new URL parameters not triggering 404s?


title: Contact Form 7 - Show image on successful send?

text: I am running Contact 7 form, and looks good for my needs. I have added it to Wordpress, for people to suggest ideas for our product. When users send an idea, they are given a message to say thanks.   This message is configurable via the settings for the form in wp-admin ![enter image description here](http://i.stack.imgur.com/UUu53.png) Does anyone know how I could get Mr Burns to appear once they have successfully sent an idea? i.e. Make a picture visible, and ideally place the picture to the side of the contact form.


title: Change URL for Blog?

text: Using WP 3.1.1 as a CMS, using the Boldy theme.   Home page is at http://www.dekho.com.au Advantage of using this theme, is that it comes setup with a homepage that has a gallery slider and some homeboxes at the bottom. To get to the blog, I had to dump all my posts into a category called blog.   \- The themes docco advises to do this]3.   I can then link to this blog category from the top menu. This then passes me to this URL: http://www.dekho.com.au/?category_name=blog **I want to know how to retain the home page provided by Boldy, but have the blog on a separate page with the following URL:**   _dekho.com.au/blog_


title: Get terms by taxonomy AND post_type

text: I have 2 custom post types 'bookmarks' and 'snippets' and a shared taxonomy 'tag'. I can generate a list of all terms in the taxonomy with get_terms(), but I can't figure out how to limit the list to the post type. What I'm basically looking for is something like this:               get_terms(array('taxonomy' => 'tag', 'post_type' => 'snippet'));      Is there a way to achieve this? Ideas are greatly appreciated!! Oh, I'm on WP 3.1.1


title: index.php template is used instead of blog page

text: I am trying to set WordPress so that home page is static, and the blog page is a separate page. So, I created two page templates in my theme., lets call them **home_template** and **blog_template**. Then, I created two WordPress pages (from Pages -> Add New). The first page is called **Home,** and is using **home_template** ; and the second is called **Blog** and is using **blog_template**. Then I went to the Settings -> Reading setting, and chose **Front Page Displays A Static Page**. And in the two drop downs that follow, I chose **Home** for **Front Page** , and selected **Blog** for **Posts Page**. Then I went to Appearance -> Menu, and added the Blog page as a menu item. Now, when I go to view my site, the home page is nice and dandy. **However, when I click on the menu item for the blog page, I see that the blog page is using index.php to display its content, it is not using the page blog_template to display the content.** How can I make sure that the blog_template page is used? Please help and thanks.


title: Mail isn't sent after local site registration

text: I installed a new WP site on local machine with wamp server. When a new user registers it gets the "registration successful" message but a mail with the password is never sent. Also checked the junk folder.   What can be the cause?


title: Will my Wordpress site become vulnerable to Cross-Site Scripting (XSS) if I allow img tags in the comments area?

text: I'm planning to follow this tutorial in order to allow my subscribers to add images to comments (actually a custom post type called "Replies"). Wordpress filters `<img>` tags by default (except for the admin). Will my Wordpress site be vulnerable to Cross-Site Scripting (XSS) if I allow img HTML tags in my comment section?