title: Single.php Category Post Count

text: I have the following code in my single.php file:               <?php          if ( have_posts() ) :              while ( have_posts() ) : the_post();                  next_post_link('%link', 'Next', TRUE);                  previous_post_link('%link', 'Previous', TRUE);                      the_title();                  the_content();                   endwhile;          endif;      ?>      What I would like to do is count the number of posts in a category and use the `next_post_link` and `previous_post_link` link to navigate through them, then display a count. So, if the post is the second one in the category the output would look like (Post 2 of 20), if it were the third the output would look like (Post 3 of 20), etc. Any help or direction is appreciated :-) Thanks,   Josh


title: Connecting multiple post types? Or linking "News" posts with "Game" posts how?

text: I am building gaming news and tutorial website. But i don't know how to link multiple post types with one specific post. For example, i created post types called               Games     News     Tutorials     Videos     Reviews      So the games post type will be basically a list of Games, News will be posts with news, and Tutorials will be tutorials. But i need to somehow link News and Tutorials to the specific post in Games post type. Another example In Games i have made a post with game called Counter Strike. And when user click on that post he goes to the post and reads basic info of the game i inserted when i made that post. But i have a menu where i put               News     Tutorials     Videos     Reviews      So when he click on News, the visitor need to have all the posts from news custom post type related to the game from Game post and have them listed all. Here is a screenshot ![this is custom post types](http://i.stack.imgur.com/6wi1j.png) ![post inside games custom post type](http://i.stack.imgur.com/P3zFC.png) This is a post that i made inside Games custom post type and as you can see its basically a post with informations of the game. But this menu with news, reviews, guides... when i click on news i need to get somehow a list of all the posts from news, related to counter strike game(post) in Games. A way to do this? Custom category or taxonomy and link them?


title: Display content based on a users login

text:
I was wondering if this is possible. I created a client portal where they can see all of their work that was assigned to them _(this is all being displayed on the frontend)_. Once they login, they are then redirect to their page. I am using the code below to display the projects related to the current user                <?php if ( is_user_logged_in() ) : function filter_posts_by_author( $query ) {              global $current_user; get_currentuserinfo();             $query->set( 'author', $current_user->ID );           }             add_action( 'pre_get_posts', 'filter_posts_by_author' );?>
Post Goes here
      <?php else: wp_die('Sorry, you do not have access to this page. Please sign in to view this page.');endif; ?>      This works perfect. The problem I am trying to figure out is how to display all post from all user when you are login as an administrator _(on the front end)_ I tried this but it then displays all of the post to all clients and administrator                <?php if ( is_user_logged_in() ) : function filter_posts_by_author( $query ) {              global $current_user; get_currentuserinfo();             $query->set( 'author, administrator', $current_user->ID );           }             add_action( 'pre_get_posts', 'filter_posts_by_author' );?>       How would I go about displaying all post once an administrator is login and only display selected post when a user login?


title: Plugin for choosing categories in steps in admin, parent first then display childs

text: **Situation:**   I'm setting up a CPT (multiple doing similar thing) where there will be a custom taxonomy only for that cpt... and it will have two levels; parent/child. So like this:               CPT = Vehicles     -- on-road     ----- type 1     ----- type 2     ----- type 3     -- off-road     ----- type A     ----- type B     ----- type C     -- utility     ----- type X     ----- type Y      **What I need to find/build in terms of a plugin / script:** When the user creates a new post in the Vehicles CPT I'd like the category(taxonomy) box to only first display the top level categories... in this case they could only choose between On-road, Off-road, Utility. If they chose on-road then they'd see only the selection for the child elements of that top level category... in this case Type1, Type2, Type3. Point is to make it simple for the user to choose in a way that makes sense for them instead of seeing ALL the categories and subcategories at one time as checkboxes or radios. I haven't seen much out there in searches so... putting it on here to see if anybody's done this yet before, if there's a plugin, a github repo somewhere. May build it if there's extra time in the project but just asking. Thanks in advance!


title: Sub-Theme (based on Taxonomies)

text: This feels like a fairly simple question, though I fear, may be a complicated answer. Is there an way (via plugin or code) to make a theme change some basic CSS elements based on a taxonomy term. So if you have camera brands, and you site is all about cameras. Can you have pages about Kodak use a CSS file where colors are blue, and if Cannon it uses a CSS file that is red, etc. Basically you sub-theme your theme based on a taxonomy term?


title: Get post offset/posts page offset in single post page (outside the loop)

text: I would like to know how I could get the offset of a custom post or its page, outside the get_posts loop. I developed an external web application which connects to the wordpress blog with JSON API plugin, and show a given posts page using an AJAX request like :               ?json=get_posts&orderby=date&order=desc&count=x&page=n      (This will return the nth page of x posts) This works well, but now I would like to set a link on the wordpress blog "single post" page to this application, like "Show this post in app", with the current page offset as parameter. So I will be able to read this param in the app and get posts of the page containing the post, and highlight this post (sent as parameter). If I can get the offset, I will be able to show the right page with a modulo operator : > If offset = 22 and count = 10, show page 3 and highlight post n°2               page = Math.ceil(offset / count);     post_to_highlight_position = offset % count;      Do you know how I could do that? or if there is a better way to achieve this?


title: Modify Wordpress SQL Query to pull from within a category

text: I am using a wordpress plugin called "kf most read" which stores a count of how many times a post was read, and lets you output a list of most read posts. This works well. The issue is, I am trying to pull the most read posts, but only the most read posts within the current category you are viewing. I am close to clueless when it comes to sql. Here us what the plugin is currently using to pull the most read posts:               $sql = "SELECT count(mr.post_ID) AS totHits, p.ID, p.post_title FROM $wpdb->posts p      JOIN {$wpdb->prefix}kf_most_read mr ON mr.post_ID = p.ID WHERE mr.hit_ts >= '".(time() - ( 86400 * $period))."'     GROUP BY mr.post_ID ORDER BY totHits DESC, ID ASC LIMIT $limit";      How could I incorporate the below query which pulls from a specific category into the above?               $sql .= "LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id)";     $sql .= "WHERE $wpdb->term_taxonomy.term_id IN ($currentcat)";     $sql .= "AND $wpdb->term_taxonomy.taxonomy = 'category'" ;      Any Help on this would be much appreciated.


title: Plugin options autoloading

text: In the book 'Professional WordPress Development' I found this tip: _As a rule of thumb, if your options are needed by the public part of the blog, save them with autoload. If they are only needed in the admin area, save them without autoload._ Wouldn't that result in many extra SQL queries in the backend if all plugin developers followed that advice, thus slowing down the admin side? What would be a good example of using autoload with plugin options?


title: Outputting custom field query from a plugin to the website header

text: I added the code below to the plugin that I'm working on to display the values of the custom fields but it shows up but blank.               function mySEO() {         require('wp-site-gps-transport.php');     }          // Add hook for admin <head>     add_action('admin_head', 'mySEO');     // Add hook for front-end <head>     add_action('wp_head', 'mySEO');          add_filter( 'cmb_meta_boxes', 'cmb_sample_metaboxes' );      When I add the content of the called file directly to the folder, it shows perfectly. However, I want the user of the plugin to only put value and not touch the code. Below is the code in the called file. Any ideas of what the problem could be?               <title><?php     if ( is_single() || is_page() ) {         $title = get_post_meta( $post->ID, 'title', true );          if ( $title )             echo $title . ' | ' . get_bloginfo('name');         else             wp_title('') . ' | ' . get_bloginfo('name');     }     ?></title>          <?php     if ( is_single() || is_page() ) {              if ( have_posts() ) : while ( have_posts() ) :  the_post();              $description = get_post_meta( $post->ID, 'description', true );          printf( '<meta name="description" content="%s" />',             ( $description ? $description : get_the_excerpt_rss() )         );              endwhile; endif;          } elseif ( is_home() ) {         printf( '<meta name="description" content="%s" />',             get_bloginfo('description')         );     }          if ( is_single() || is_page() ) {              if ( have_posts() ) :   while ( have_posts() ) : the_post();              $keywords = get_post_meta($post->ID, 'keywords', true);         printf ( '<meta name="keywords" content="%s" />',               ( $keywords ? $keywords : the_excerpt_rss(); ?         );              endwhile; endif;          } elseif ( is_home() ) {         printf( '<meta name="keywords" content="%s" />',             get_bloginfo('keywords');         );               }


title: Return all Tags from search results

text: I am wondering if it is possible to return a list of all the "tags" that are associated with ALL returned posts. In theory, I would then use this list of terms to build appropriate "filter by" links for refining the search. For instance: A user searches for "Foo" and there are 100 results. Would it be possible to get a collection of all the posts' tags? So, post "Foo 1" might be tagged "little bar" and post "Foo 2" might be tagged, "big bar" and "foo foo", etc and etc. I would like to do this _before_ the `while_posts()` is doing its thing. Failing that, I think I could use the `while_posts()` loop to collect all the tags for each post. This is the most obvious solution to me, except that then the list isn't where I want it in the markup. AND, I'm not sure how to include tags on page 2 (and onward) of the results.


title: Comments number message in password protected post

text: I've got a password protected post and `comments_popup_link('No Comments', '1 Comment', '% Comments');` function displays "ENTER YOUR PASSWORD TO VIEW COMMENTS." message. The question is, is it possible to change this message without touching core files, maybe apply filter or something like that. Thanks.


title: How to create and retrieve data from a special registration form?

text: What is the recommended way to approach the follow issue? I have to create two pages. On one page I will have a small form where users will be able to register themselves (with or without photo). On the other page, I will show all the users' info entered on the previous form. For the admin section, I just need to have all the registered users listed and to be able to delete them. I don't want to touch the default's WP user registration stuff, because it is already being used and I cannot mix up the things. Is it possible to use some kind of custom post types? Any plugin or idea?


title: How to change a user's role?

text: I have custom roles in my setup and I want to be able to automatically change a user's role thru a function. Say user A has a SUBSCRIBER role, how do I change it to EDITOR? When adding a role we just:               add_role( $role_name , $role_display_name , array( 'read' =>  true,                                                        'edit_posts' => false,                                                        'delete_posts' => false, ));      How about changing a role? Is there something like:               change_role($old_role, $new_role);      **UPDATE:** I think this one will do:               $wp_user_object = new WP_User($current_user->ID);     $wp_user_object->set_role('editor');


title: Filter get_categories() for taxonomy term in WordPress

text:
I want to show a category only if a (custom) post is in that category AND region = $name for that post. So, e.g. I have a custom post (type "business") named "Mamma Mia" in child- category: "pizzerias" (and in parent-category "food"), and in region "Rotterdam" (custom taxonomy: "region", custom taxonomy term: "rotterdam"). => display category "pizzerias" (and parent-category "food") Only, I have no clue how to accomplish this. I'd appreciate any help on this puzzle.               <?php           // $filter = array('region'=>$name);           $categories = get_categories();      foreach ($categories as $cat)      {          if($cat->parent < 1)          {          $cat_name = $cat->cat_name;          $catid = get_cat_ID( $cat_name );          echo $cat_name. '
';               $args=array(            'orderby' => 'name',            'order' => 'ASC',            'child_of' => $catid            );          $categories=get_categories($args);            foreach($categories as $category) {               echo 'term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'
';              }                }      }           // print_r($categories);                 ?>


title: wp-login.php redirecting to HTTPS

text: I recently restored a WP multi-site 3.0.1 database from production to a staging environment, and when I try to login, I am being redirected to an HTTPS URL. The browser complains that the certificate is bad, and then when I click "proceed", it says page not found. I have cleared my browser cookies and all that good stuff, but it still won't let me login. Also, I am experiencing intermittent "No site defined on this host" errors when I try to login. I've never seen this issue before, and I have definitely done this backup db restore process before. Thanks for your help, Dave


title: Converting theme widgets to plugins?

text:
i need a help, i have a theme, where in i have a twitter widget, i just want to separate it, and keep it in different file, as if it is a plugin, here are is the complete code, what i have to do? this code was in file **admin-functions.php**               /*-----------------------------------------------------------------------------------*/     /* Twitter's Blogger.js output for Twitter widgets */     /*-----------------------------------------------------------------------------------*/          function woo_twitter_script($unique_id,$username,$limit) {     ?>                ` and this second code i found in **theme-widget.php** `               /*---------------------------------------------------------------------------------*/     /* Twitter widget */     /*---------------------------------------------------------------------------------*/     class Woo_Twitter extends WP_Widget {             function Woo_Twitter() {            $widget_ops = array('description' => 'Add your Twitter feed to your sidebar with this widget.' );            parent::WP_Widget(false, __('Woo - Twitter Stream', 'woothemes'),$widget_ops);              }             function widget($args, $instance) {           extract( $args );         $title = $instance['title'];         $limit = $instance['limit']; if (!$limit) $limit = 5;         $username = $instance['username'];         $unique_id = $args['widget_id'];         ?>             <?php echo $before_widget; ?>             <?php if ($title) echo $before_title . $title . $after_title; ?>             <ul id="twitter_update_list_<?php echo $unique_id; ?>">

                <?php echo woo_twitter_script($unique_id,$username,$limit); //Javascript output function ?>               <?php echo $after_widget; ?>                   <?php        }             function update($new_instance, $old_instance) {                            return $new_instance;        }             function form($instance) {                         $title = esc_attr($instance['title']);            $limit = esc_attr($instance['limit']);            $username = esc_attr($instance['username']);            ?>
                <label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:','woothemes'); ?>                <input type="text" name="<?php echo $this->get_field_name('title'); ?>"  value="<?php echo $title; ?>" class="widefat" id="<?php echo $this->get_field_id('title'); ?>" />

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

                <label for="<?php echo $this->get_field_id('limit'); ?>"><?php _e('Limit:','woothemes'); ?>                <input type="text" name="<?php echo $this->get_field_name('limit'); ?>"  value="<?php echo $limit; ?>" class="" size="3" id="<?php echo $this->get_field_id('limit'); ?>" />
           <?php        }          }      register_widget('Woo_Twitter');      i just want this code to be a different file, just like a plugin, so that i can use this in my another theme also, can anyone help me here???


title: Insert link to my thumbnail images

text:
I am try to insert link to my thumbnail images, the link is hyperlink with post. When i put this code inside the loop then instead of showing the first image, first show the second image (template_url)               <a href="<?php the_permalink() ?>" class="alignnone" title="<?php the_title(); ?>">     <?php if (has_post_thumbnail()) : ?>     <a href="<?php the_permalink(); ?>" title="<?php the_title();?>"><?php the_post_thumbnail(); ?>     <?php else : ?>     <img src="<?php bloginfo('template_url'); ?>/images/noimage.jpg" width="213" height="187" alt=""/>     <?php endif; ?>           The code of the tempate :               <?php if (have_posts()) : while (have_posts()) : the_post(); ?>         <div <?php post_class() ?> id="post-<?php the_ID(); ?>=">

          <a href="<?php the_permalink() ?>" class="alignnone" title="<?php the_title(); ?>">          <a href="<?php the_permalink(); ?>" title="<?php the_title();?>">                                                     <?php if (has_post_thumbnail()) : ?>                                                         <?php the_post_thumbnail(); ?>                                                         <?php else : ?>                                                             <img src="<?php bloginfo('template_url'); ?>/images/noimage.jpg" width="213" height="187" alt=""/>                                                         <?php endif; ?>

 Άlbum :  <?php print_custom_field('title_album'); ?>

Photos :  <?php print_custom_field('Number_photos'); ?>

       Even if this part of code, the result is the same..               <?php   echo '';             if (has_post_thumbnail())      {the_post_thumbnail();}     else {echo'';}             echo ''; ?>


title: redirected to the login screen when I do a blank search

text: why when I'm offline , when I click the search button and not put any words I am redirected to the login screen? I simply click in search button, don't put any word. If i'm normal user, don't logged user, i go to login page. I want to show a message: Search Empty, please try again.


title: get_terms() How many is TOO many?

text: Working on revamping a plugin of mine when I noticed that `wp_count_terms()` is not reflecting the same number as a call to `count( get_terms() )` with the same $args passed. I'm pretty sure this is a bug in WordPress and I'll submit a trac ticket in a little bit. I wanted to get a solid working solution, so I ended up just making one call to `get_terms()` and then using `count()` on the array to get the count. My question is: "How many terms can be returned without slowing everything down". It's possible that there could be scaling issues here where there are a lot of terms in a taxonomy, but how many is TOO many? 1,000? 10,000? Just looking for a ballpark here.


title: Custom post type archive with dynamic taxonomy filtering - is it possible

text: I have a custom post type archive template archive-my-posttype.php with pagination. These post types have a custom taxonomy called theme. I am displaying these themes(terms) in the sidebar as a checkbox list. How can I filter the custom post type based on the selected themes/checkboxes? Can this be accomplished by adding a query_var parameter (theme_filter) and somehow modifing wp_query with the pre_get_posts filter? I am trying to let WP handle pagination rather than have to rewrite it myself. Thanks


title: Add custom post types stats to a custom dashboard widget

text:
I have a lot of custom post types and I have them showing in my "Right Now" Dashboard but it's gotten pretty long so I want to separate them to a custom widget within the dash. See example below: ![enter image description here](http://i.stack.imgur.com/ge0Yy.png) So my question is how do I add the CPTs to a custom dashboard widget? Any help would be awesome. Thanks! EDIT: This is what I have (What am I missing?)               // wp_dashboard_setup is the action hook          add_action('wp_dashboard_setup', 'mycustom_moviestats');               // add dashboard widget     function mycustom_moviestats() {          wp_add_dashboard_widget('custom_movie_widget', 'Movie Stats',                  'custom_dashboard_movie_list');          }          function custom_dashboard_movie_list(){          // here is the code to add custom post types + count see below          function my_right_now() {     $num_widgets = wp_count_posts( 'widget' );          $num = number_format_i18n( $num_widgets->publish );     $text = _n( 'Widget', 'Widgets', $num_widgets->publish );     if ( current_user_can( 'edit_pages' ) ) {          $num = "$num";         $text = "$text";     }             echo '
';     echo '' . $num . '	';     echo '' . $text . '	';     echo '
';     }     add_action( 'right_now_content_table_end', 'my_right_now' );          }


title: Use template tags in code snippets wordpress

text: I'm trying to use WordPress template tags (through shortcodes) to merge the post title and url into hyperlink html code. Which looks like this:               [Post Title].      Problem is the text output uses curly quotes around the "Permalink" that are not compatible with html code. I tried placing hyperlink code using template tags (shortcodes) into a code snippet box, however then the shortcodes won't run. I would like to merge the template tags (through shortcodes) into the hyperlink html code first, then have it show up in a code snippet box. Any ideas on how to do that?


title: Duplicate attribute class causing site validation error

text: The following bit of code results in a duplicate attribute site validation error. This template script:               <div class="clearfix" <?php post_class() ?>>      produces this source output:               <div class="clearfix" class="post-263 post type-post status-publish format-st…      WordPress adds its own post-related classes to format the blog entry. Is there any way I can add my "clearfix" class to the template without producing the duplicate attributes? Thanks.


title: Check the password of a user

text: I want to keep a check if the user has a particular password, so I have been trying it with `wp_check_password` but the account for which it is checked gets logged out and can't login again till there is a call of `wp_check_password` in the code. Digging into the code, I found out that it sets the password by using the new hash. and moreover if I am using `wp_check_password( 'hello', md5('hello'), 1 );`, it doesn't even check what is inside the database and returns true. Isn't that a bug? Any ideas how can I check the user's password?


title: What Are Security Best Practices for WordPress Plugins and Themes?

text: As suggested in this question, I am adding this topic as a new question, for community discussion/voting regarding best-practices for Plugin/Theme security. Here is the starting checklist, based on my current (work-in-progress) settings/data security checklist used for reviewing Themes (the principles should be no different for Plugins than they are for Themes). If you want to check out a theme with a secure and solidly-coded theme settings page, check out this theme:   http://wordpress.org/extend/themes/coraline


title: Behind-the-scenes HTTP Request?

text: I'm trying to add a line to my functions.php that does a behind-the-scenes HTTP request submitting some user information to a mailing list URL I have. I'm trying to test the code at the moment, but nothing seems to be working. I have tried the following:               $url = 'blabla.org/mailinglist/add?' . $user_email;     $request = new WP_Http;     $result = $request->request($url);      and               wp_remote_post($url);      Neither have worked. However, if I Just copy and paste the URL into my web browser, it works fine. Please help! Thanks, Tre


title: Search everything (posts, pages, tags, cpt, meta)

text: I would like to know how to use the built in wordpress search to return results from all content on my site. Specifically, I want to search;   * posts   * pages   * tags   * custom post type (portfolio)   * custom taxonomy used in custom post type (skill, client)   * metaboxes used in custom post type (portfolio_caption, portfolio_excerpt, portfolio_credits, portfolio_links) I would like one search form and don't need to limit the search to certain post types or categories. Just enter the search term > click search > see matches from all content on my site. Simple ;) Update: Preferably, I would achieve this through a function or custom database query rather than using a plugin. This is because I'm developing a theme and want this functionality included out of the box rather than requiring a user to download a plugin. (title changed)


title: Global custom meta box

text:
I am trying to create a custom meta box for multiple custom post types in WordPress without creating duplicate code. Currently I have:               add_meta_box('adv_form_box1', 'Advanced Form', 'adv_form1', 'custom-post-type1', 'side', 'high');     add_meta_box('adv_form_box2', 'Advanced Form', 'adv_form2', 'custom-post-type2', 'side', 'high');     add_meta_box('adv_form_box3', 'Advanced Form', 'adv_form3', 'custom-post-type3', 'side', 'high');          function adv_form1() {     global $post;     $custom = get_post_custom($post->ID);     $filename = $custom['filename'][0]; ?>     Filename: (this field is required)
<input name="filename" size="70" value="<?php echo $filename; ?>" />     <?php }          function adv_form2() {     global $post;     $custom = get_post_custom($post->ID);     $filename = $custom['filename'][0]; ?>     Filename: (this field is required)
<input name="filename" size="70" value="<?php echo $filename; ?>" />     <?php }          function adv_form3() {     global $post;     $custom = get_post_custom($post->ID);     $filename = $custom['filename'][0]; ?>     Filename: (this field is required)
<input name="filename" size="70" value="<?php echo $filename; ?>" />     <?php }      I feel as though I am creating a bunch of extra un-needed code. Is there anyway to set the meta box as "global" to be used in all post-types?


title: WordPress category gives 404 after moving to a different domain

text: I just moved a site from one domain to another and now category links are all 404. I have flushed the rewrite rules, recreated the .htaccess file but still it throws up 404. Weird thing is that if I delete `.htaccess` file, then the posts are still accessible by `domain.com/postname/` and when I save permalinks, then it is created there. So can it be the case it is using some other .htaccess file? Possibly some fallback that I am not aware of? **Re-Edit:** _**Tag pages don't work fine_**. Its all weird. Tags generally give 404, one of them opened a non 404 page but not what it should be (i.e. posts listing under that tag). And a category redirects itself to one of the posts. This all led me to conclude that tags were working but they are not. Also everything works, when I turn off the permalinks. I am using a custom slug for category "cat" and not the default "category" but reverting to the default doesn't solve anything. Any clues? **Edit:** I saw Ipstenu's sticky on WP forums and found that Advanced Permalinks are known to have a problem with WP 3.1, so I disabled it and recreated by permalinks but still no joy. What did I miss? So far, I have tried recreating permalinks, flushing rewrite rules by calling `global $wp_rewrite; $wp_rewrite->flush_rules();` in `functions.php`, deleting `rewrite_rules` in `options table` & even deleting `.htaccess` file. So I am clueless and would appreciate if someone can give me a clue how it can be fixed. **Further Edit:** If I delete the .htaccess file, the site behaves if it was there and I can browse pretty permalinks without any issue (.htaccess file is not there in the WP root) but when I resave permalinks, it is created there. So can there be some kind of fallback for .htaccess because this shouldn't be possible without rules in .htaccess? **EDIT:** I am still stuck at the issue. Can anyone please help me out? **Final Edit:** Is there anything left in the wild that I can do to troubleshoot this issue? I have lost hope on this one.


title: How to disable or protect against disposable email accounts?

text: Now im getting a couple of disposable email accounts in users table, how can I avoid this nasty situation?


title: Cancel jQuery 'noConflict' - is it really unsafe?

text: I use some external plugins (not wordpress plugins), that use '$', and it's very convenient for me to cancel `noConflict` mode, by adding this line   `$=jQuery`   But I guess they invented `noConflict` mode not for nothing.   The question is how much have to worry about it. And is really a problem to use `$=jQuery`?


title: No "available widgets" (wordpress 3.2.1 multisite)

text: I have no widgets available any ideas? I've tried the "Twenty Eleven" Standard Theme and the custom one (Lotus). No widgets are listed, I am looking for the custom_menu widget. In my other wordpress installation I have plenty of widgets available. **Update** : I use a multisite installation and I found that the blog_id in wp_options is set to 0 (not sure this has something to do with it?)


title: Custom field totals

text: I have tried searching everywhere for this and although there are some discussions about adding the total to the frontend, there is nothing about the admin side. I have a custom post type that has posts and one fo the fields of those posts is a price. I would like for the statuses (all, published, concept...) to show the relevant sum total of that field. Just like the statuses show the total number of posts in perentheses. Is there a smart way to do this?


title: Wp die causing 500 Internal Server Error?

text: I have function to upload images inside my settings API ,it uploads images as expected but the problem comes when user chooses to upload **non-image file** to stop users from uploading other files (non-image files) i am using `wp_die('No image found');` an that leads to dreaded **500 Internal Server Error** message displayed. Strange thing is that my wp_die `wp_die('No image found');` is running fine on my **local computer** but not **online**.               function validate_setting($plugin_options){             //echo '<pre>';  print_r($_FILES); echo '</pre>';       $keys = array_keys($_FILES);        $i = 0;       foreach ($_FILES as $image) {                  if($image['size']){         //Is it an image?         if(preg_match('/(jpg|jpeg|png|gif)$/i',$image['type'])){           $override = array('test_form' => false);           $file = wp_handle_upload($image,$override);                    $plugin_options[$keys[$i]] = $file['url'];         }        else{        wp_die('No image found');//This triggers 500 Internal Server Error WHY??            //echo:'no image found'; //Now this DON'T work locally but works ONLINE?!?        }     }     else{      $options = get_option('theme_options');      $plugin_options[$keys[$i]] = $options[$keys[$i]];     }     $i++;         }          return $plugin_options;         }      I tried to change `wp_die()` to `echo 'no image found';` and this happens: now on my **locall** machine it echoes 'nothing' (no warning displayed), but now **online** it works and displays 'no image found' warning... I know i could simply delete the `else{ wp_die('No image found'); }` part and display no warning, but WHY it is not working as intended? Can someone tell me what is wrong with my code and how to display warning with wp_die('No image found') properly _(without causing "500 Internal server error" )_?


title: Custom Taxonomies and parents

text:
How can I create a group of custom taxonomies with parents that would include a description for the parent and child taxonomy? Here's what I have so far. The parent and child are created with the descriptions but the child taxonomy is not listed under the parent.               $categories = array(        'Category 01'=>'Category 01',         );          foreach($categories as $category => $cat_desc){         wp_insert_term(           $category, // the term           'style', // the taxonomy           array(             'description'=> $cat_desc,             'slug' => $category ,           )         );     };          // List out all Categories with subcategories     $styles = array(         'Category 01' => array(             'Subcategory 1A'  => 'Subcategory 1A Description
Subcategory 1A Description',              'Subcategory 1B'  => 'Subcategory 1B Description
Subcategory 1B Description',              'Subcategory 1C'  => 'Subcategory 1C Description
Subcategory 1C Description',             'Subcategory 1D'  => 'Subcategory 1D Description
Subcategory 1D Description',             'Subcategory 1E'  => 'Subcategory 1E Description
Subcategory 1E Description',                     )                  );          // Import each array as taxonomy with parent     foreach($styles as $bjcp_category => $bjcp_styles ){     $parent_term = term_exists( $bjcp_category , 'style' ); // array is returned if taxonomy is given     $parent_term_id = $parent_term['term_id']; // get numeric term id     foreach($bjcp_styles as $bjcp_style => $bjcp_style_desc){         wp_insert_term(             $bjcp_style, // the term              'style', // the taxonomy             array(               'description'=> $bjcp_style_desc,               'slug' => $bjcp_style,               'parent'=> $parent_term_id             )         );     }      I have a feeling that I'm creating the arrays in a less than efficient method. What would be the best way to accomplish this as I have over 100 custom taxonomies to import into my CPT and would like to have it done in one plugin. My question is, how would I structure an array to include the parent and child taxonomies with descriptions for each?


title: How to change the login URL

text: I want to change the login URL per a client request. so, instead of mysite.com/wp-login.php or mysite.com/wp-admin it is this: mysite.com/someotherpagename.php   or mysite.com/someotherpagename I do not want to use /login. It's too obvious, per the client. Thanks in advance.


title: How to count media attachments?

text: How do I count the number of media attachments a specific post has? Output example: This post has 22 photos. Thanks!


title: wp_get_archives() - Get CSS selector for current month

text: I'm looking for how to get a class in the wp_get_archives functions to get the current month (when we are in a month archive) just like when we call wp_list_categories, the current category has a ".current-cat" selector for CSS or when we call wp_list_pages we have a '.current_page_item' selector.


title: How to check if a specific page uses a page template?

text: I'm trying to get a page which uses a specific template. I have the page_id. Here is my code :               $pids = $wpdb->get_col( $wpdb->prepare(       "SELECT ID FROM {$wpdb->posts}         WHERE post_author = %d AND post_status = 'publish'         AND post_type='page'", $user->ID     ) );          foreach($pids as $post_id)     {        wp_set_post_terms( $post_id, $tag, $taxonomy );             // I need permalink only if that page use a specific template (say blog.php)        $permalink_n = get_permalink($post_id);             set_cimyFieldValue( $user_id, 'HOMEPAGE', $permalink_n );     }


title: How do I choose not to display the title header on a specific page?

text: I would like to have one specific page on my WordPress blog omit the header . Is there a way to wrap that title code from page.php in my WordPress theme in an if clause that specifies the page I do not want the title to appear on? For instance, if page is 135, do not display title, else display. Thanks!


title: How to query the latest 5 posts and sort them by title?

text: I'm looking to draw a menu listing of the latest "n" number posts, where the number "n" will be a user defined setting stored as an option. n = 5; //Pull the latest 5 posts from the database. The script I'm currently using (below) pulls all of the posts from the database and then only displays the latest 5 out of that collection. This works fine until I decided to sort the list by title. When I do that, rather than sort the latest 5 posts by title, its sorting the entire collection of posts, without regard to when they were posted Any tips on how I can change this query to only pull the latest "n" posts, then sort by title of those 5 only. ( **Note** : I'm really interested in the get_posts() query inside the UL element. The first query ($myquery) is just here to make sure we have posts to display before proceeding.)               function recent_posts(){         $catHidden=get_cat_ID('hidden');         $myquery = new WP_Query();         $myquery->query(array('cat' => "-$catHidden",'post__not_in' => get_option('sticky_posts')));         $myrecentpostscount = $myquery->found_posts;         if ($myrecentpostscount > 0){ ?>         <ul>         <?php          global $post;         if(get_option('mySort') == 'asc'){             $sortOrder='title';$sortDirection='asc';         }         $myrecentposts = get_posts         (             array             (                 'post__not_in' => get_option('sticky_posts'),                  'cat' => "-$catHidden",                 'numberposts' => get_option('cb2_latest_count'),                 'orderby' => $sortOrder,                 'order' => $sortDirection             )         );              foreach($myrecentposts as  $idxrecent=>$post) {              //DRAW THE POST MENU         }     wp_reset_postdata();     }


title: Modify message displayed on post save

text:
After a post is updated there is a message displayed, how can I change the displayed text? I would like to remove the "view post" link and change the 'Post published' text. I'd like to do this for a particular post type. Here is the html WordPress outputs:

Post published. View post


title: Change the HTML output of comments

text:
I'd like to customize the HTML output of the comment form. I've been reading I've been reading how to alter some variables of the comment_form(). The previous link provides a rather good guide to play with that function. But I'm still unable to change the HTML output of the form. And I would like to wrap some fields inside a container. With older wordpress versions this could be changed at will in the comments.php function, but doing it that way will break nested comments, so it is not an option. Is it possible at all to change this html output? Thanks, Upon request, a bit more of inormation :) The default html output of comment_form() is:
Name *<input id="author" name="author" type="text" value="" size="30" aria-required='true' />

Email *<input id="email" name="email" type="text" value="" size="30" aria-required='true' />

Website<input id="url" name="url" type="text" value="" size="30" />
      I would like to wrap all three paragraphs inside an html element (ie. DIV).


title: Full Width Main Post

text: On my site I want to add a section just below Navigation and above-content (from where posts starts to show up on front page) which would show a panel where I can put any BREAKING NEWS (not always, whenever I want) with its excerpt and image. That panel should stretch with max-width. I want to pull that BREAKING NEWS from a specific category say - category_breaking. Is it possible? If yes, then how? Thanks for the help. I want to achieve exactly like this - (http://i.imgur.com/4D9kE.png)


title: How to add terms to taxonomy with wp_insert_terms?

text: I have a huge excel database of locations which I want to add as terms to my current taxonomy. However, I don't know the best way to do this, as inserting manually could take weeks.   I have looked at: http://codex.wordpress.org/Function_Reference/wp_insert_term   but not sure how to use it correctly. My Taxonomy is called: **location** I would like to add the following example terms:   **London, Glasgow, Bristol, Bournemouth** Is this possible? Additionally, if there is hierarchical relationships, is this also possible to add automatically? For instance: London (Parent), Kensington (child of london).


title: Embed interactive pdf

text: I have interactive pdf documents that I need to put on a wordpress site. Visitors need to be able to fill these in and print them out to sign and post. They do not need to be emailed or saved to the site. I have tries embedding them with all kinds of plugins but all they do is embed a non fillable pdf. What I need is this : http://download.belastingdienst.nl/belastingdienst/docs/aangifte_bpm_verzoek_teruggaaf_bpm_bpm0162z3plfol.pdf Hope anybody can help. Kind Regards, Marja


title: Fetch data from database from multiple tables matching condition

text:
I want to fetch data from the database. I have three tables in my database: `listing_master_residential`, `listing_master_condo` and `listing_master_commercial`. There is one primary key, `Ml_num`, in all tables. I want to search the data from one table which matches mls number table.               if (isset($_POST['search'])) {         $mls=$_POST['mls_number'];         $sql = "SELECT * FROM listing_master_residential,             listing_master_condo,              listing_master_commercial               INNER JOIN listing_master_residential AS res ON res.Ml_num=Ml_num             INNER JOIN listing_master_condo AS con ON con.Ml_num=Ml_num             INNER JOIN listing_master_commercial AS com ON com.Ml_num=Ml_num             WHERE Ml_num='$mls'";         $result = $wpdb->get_results($sql) or die(mysql_error());         foreach ( $result as $row) {             echo $row->Lot_code."
";             echo $row->Ml_num."
";             echo $row->Acres;             echo $row->Addr."
";             echo $row->Bath_tot;             echo $row->Br;             echo $row->Br_plus;         }     }      With the above, I get an error: > Column 'Ml_num' in where clause is ambiguous


title: Taxonomy term breadcrumb; how?

text: Given a taxonomy term (perhaps in a taxonomy*.php template) how to construct a breadcrumb going up the full ancestry of the term? Is there any shorter way other than a "brute-force" loop to query current term's parent -> query term's parent -> query term's parent etc.?


title: get_search_link() redirects to 404 template page

text: I built a custom theme, and in it, there is a 404.php page and a search.php page. Elsewhere in the template, I wanted to link to the search page directly. So, I used the get_search_template() function to get the search page link, which results in a link like this: http://example.org/search When I click the link, I get sent to the 404 page template. Why is it going to the 404 page template instead of the search page template?


title: Category Specific Archive

text: I'm trying to display a monthly archive but only for a certain category. How can I do this?


title: modify buddpress adminbar only in admin pages

text:
I have modified the buddpress admin bar by creating the following plugin which adds a simple text link to the bar:               function bp_adminbar_currentsite_menu() {          global $bp;     ?>
          EXAMPLE LINK TEXT
     <?php     }     // Call The Function Above     add_action('bp_adminbar_menus', 'bp_adminbar_currentsite_menu', 999);      However, I do NOT want the above link to be shown when logged into the wordpress admin backend (so for example when an admin is editing a post). I thought about just doing a `php_self` check to see if it contained "/wp- admin/" but figured that there has to be a more elegant wordpress/buddypress hook here. How can I get the above code to only show when you are viewing a normal blog page, NOT in the admin area? Thanks


title: get_template_part function and add images

text:
Added this function in any page:               get_template_part('recent', 'posts');      And:               if(have_posts()){     while(have_posts()){ the_post(); ?>
<?php the_content(); ?>
     <?php }     }      It's working, show 5 blog post on my page. But it's have only title and publish date. I want add thumbnail images on this post. How can I do it?


title: Wordpress 3.1 .htaccess contents keep dissappearing?

text: I have Wordpress 3.1 installed in a subdirectory of a shared hosting account, it's a linux server and mod_rewrite is enabled and working fine elsewhere. The contents of the .htaccess file disappear whenever I try and change the permalinks structure, leaving just the begin/end wordpress comments with nothing in between. I have no plug-ins installed. Thanks.


title: Adding a class to last post in the_date

text:
I'm using `<?php the_date('l jS F Y','<h2>','</h2>'); ?>` inside the loop in order to group/sort posts by date. This all works great but I would like to add a different class to the last post for each date, effectively seperating each date section. Does anybody know how to do this please? I can't seem to find anything! Many thanks, S. Code below:               <?php while ( have_posts() ) : the_post(); ?>     <?php the_date('l jS F Y','
','
'); ?>

<a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>
                                              <?php the_excerpt(); ?>
 <?php endwhile; ?>
 //want this to appear at the end of each date/section      Updated code based on Bainternet's answer below:               <?php while ( have_posts() ) : the_post();                  $curent_date = $post->post_date;                 $curent_date = substr($curent_date,0,strpos($curent_date," "));                 $next_post = get_adjacent_post(false,'',false) ;                 if (!$next_post == ''){                 $next_date = $next_post->post_date;                 $next_date = substr($next_date,0,strpos($next_date," "));                 if ($next_date != $curent_date){                 $hrbtm = '
';                 echo $hrbtm;                     }                 } else {                 $hrbtm = '';                 }                 ?>                       <?php the_date('l jS F Y','
','
'); ?>      Then I echo `$hrbtm` just before the `endwhile`:               <?php echo $hrbtm; ?> <?php endwhile; ?>


title: How can I change a function in a parent theme via a child themes functions.php

text:
I have a function in a parent theme:               function cyberchimps_logo_icons() { ?>
             <?php if (function_exists('cyberchimps_header_logo') ) {                 cyberchimps_header_logo();             } ?>

             <?php if (function_exists('cyberchimps_header_social_icons') ) {                 cyberchimps_header_social_icons();             } ?>
          <?php }     add_action('cyberchimps_header_content', 'cyberchimps_logo_icons');      I want to remove the social icons by removing the second half of this function. What's the best way to ADD something to a child themes functions.php to over ride this? I tried copying and pasting this into the child themes functions.php file, and deleting what I wanted gone, but the same function name can't be called twice.


title: Making custom woo themes

text: I have recently decided to step into WordPress but I am needing to create a few themes for eCommerce that are currently built in Open Cart. My experience from eCommerce comes from Open Cart but I am completely new to using one for WordPress. After a few months of research I decided I would like to try and create my own theme from the Woo theme Mystile. My questions are followed:   1. If making a custom theme is the preferred method to only modify the `custom.css`?   2. When updates are released for their themes are they also updating the `.css` files or is there a standard set of files being updated?   3. Woocommerce appears to not have a **standard** framework for customizing so is there a better alternative then using Mystile or Artificer?    4. If using the `custom.css` to create a theme wouldn't that theme be considered a child? EDIT:   1. Is the preferred method to install the woo extension and build around Twenty Twelve?


title: How can I give Wordpress child custom post type the same title and slug as its parent?

text: I have two custom post types, one is the child of the other (the parent is more of a modal post). I want the child post to inherit the same title and slug as its parent. I've tried to use the following action hook:               function copy_parent_post_title( $post_id ) {              $new_post = get_post($post_id);              if($new_post->post_type == 'child-post-type') {              $parent_title = get_the_title($new_post->post_parent);         $post_slug = sanitize_title_with_dashes($parent_title);              $post_update = array(             'ID'           => $post_id,             'post_title' => $parent_title,             'post_name' => $post_slug         );                      // To stop infinite loop:         remove_action( 'wp_insert_post', 'copy_parent_post_title' );         wp_update_post( $post_update );         add_action( 'wp_insert_post', 'copy_parent_post_title' );              }          }     add_action( 'wp_insert_post', 'copy_parent_post_title' );      The problem is that `$new_post->post_parent` is always giving `0`. I've tried replacing it manually with the actual parent ID and the above works fine. Why is `$new_post->post_parent` not giving the correct parent post ID?


title: jQuery form plugin, submit in the wordpress way

text:
Trying to use jQuery form plugin in wordpress site to upload files. HTML markup:               <form id="myForm" action="process.php" method="POST" enctype="multipart/form-data">               <input type="file" value="" name="file_upload"  class="file_upload"/>

          <input type="submit" value="Submit" class="btn_submit" name="btn_submit" />               </form>      and the JS snippet :                      The form processes its element values in `process.php` which is a non-template file. As a result Wordpress codex functions are not available in that page . So what I need to do is to use the jQuery form plugin's ajax submission in the wordpressian way. How to implement that ? * * *


title: What tool are available in the wordpress API for debugging a plugin?

text: I am very new to plugin development. I have created my first plugin but when I activated it, it caused the majority of every page on the site to stop being generated. I have echoed something from the end of the php script to confirm that it was completing without an error. But other than that I have no idea what I should do to debug this problem. I would like to be able to work on this on a public site that will be getting traffic while I work, is there a way I can have the plugin only activated on one page or only for me and not for guests? I would like to be able to show debug messages, is there a convenient way to do this? Are there points outside of my plugin that would be helpful for debugging? I don't know where to look that might be leading to the problems.


title: How do I paginate a get_posts() request inside another page loop (Paginating childpages)

text:
The heading says a lot, so I'll repeat it here "How do I paginate a `get_posts()` request inside another page loop?" I'm using a page to display child-pages and I need to paginate them. **Edit:** Should I use a custom `WP_Query` instead? Would this make any difference? The code I use inside the normal page loop looks like this right now:               // Set up the arguments for retrieving the pages     $args = array(         'post_type' => 'page',         'numberposts' => -1,         'posts_per_page' => 1,          'paged' . get_query_var('page'),         // $post->ID gets the ID of the current page         'post_parent' => $post->ID,         'order' => ASC,         'orderby' => title     );     $subpages = get_posts($args);     // Just another WordPress Loop     $child_counter = 1;          foreach($subpages as $post) :         setup_postdata($post);              if ($child_counter == 2 || (($child_counter)%3)-2 == 0) {             echo '
';         } else {             echo '
';         }         $child_counter++;
<?php the_title(); ?>

<?php the_excerpt_max_charlength(200); ?>

<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php _e('Les mer', 'monster'); ?>

<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>

     <?php endforeach; ?>      I can't get my head to understand how I can retrieve the pagination information for the child loop and not the main loop. So I have no clue how to paginate the childpages. Remember this `get_posts()` call is inside a normal page loop. Happy for all answers, hints or tips!


title: How can I prepopulate the URL address for the add media button

text: I was wondering if there is a way to get the URL address to prepopulate with my web address so I don't have to type it in every time I want to insert an image. Example. Click on the upload/insert "add media" button --> click "from URL" and instead of having a blank box, I would like it to prepopulate with: http://mysite.com/images/ this way the only thing I would have to type in is: nameofimage.jpg


title: How to include custom post type posts on a page?

text: I need help adding a Portfolio page to one of my main Pages. I don't know what information is needed, so I'll just throw in some of the important stuff. Basically I have my main menu, (Welcome, About, Contact, etc.) which includes a tab called 'Work'. Under that tab, I have two pages called Portraits and Modeling. I want to somehow insert a few portfolio pages (each with a separate photo shoot) into the Modeling page. Ideally, I want it to show a one image preview and the full shoot once clicking on the image.


title: Own Custom Tags/Category page ( posts)

text: I want to make a page where on each **tags** : My page should look alike : http://www.missmalini.com/aamir-khan-2/ Above page is coming from http://www.missmalini.com/celebrity-fan-pages/ this are categories with **Tags** : I also know that the patten is like Big Image is First ( **First** latest Post of resp. tag )... then 4 image with title are from **Second** post )and then only title after **sixth** post .. its means they have **divide latest 10-12 post** with this structure.. 2 } if u see on top ( above Ten Latest Aamir Khan Updates ) there is " **Aamir Khan Full Bio** " which is **_different_** for resp. **tags**. 3 } If Scroll Down there is **Photos and Videos** of resp. celeb ( which is tags or may be category wise ) Hence how i can do this ( means how i can make such Own Custom Page code ) can any one let me know.


title: Admin ajax add tag callback

text: Is it possible to add an additional callback to admin ajax? Basically, I'm trying to increment the value in an input field of the add form for a custom term after the form is submitted. After the form is submitted via ajax, the response that comes back appends the new row at the top of the table of terms on the right side of the add form. I want to be able to update a field in the add form itself. Something like the following is what I need executed after the ajax call is made:               function add_tag_increment_num() {              echo '<script>                 var num = $("#num-field").val();                  var incrementedNum = parseInt(num) + 1;                  $("#num-field").val(incrementedNum);              </script>';              die();      }          add_action( 'admin_ajax_add_tag', 'add_tag_increment_num' );      Any help would be greatly appreciated.


title: How to have embedded images from smugmug take full width of blog posts

text: What I'm trying to achieve: Have images in blog posts take the full width of a blog post, and keep image proportional. Aka, a portrait image will end up being bigger than landscape. The challenge, I'm not using images from my wordpress server, but from smugmug. Hense, I'm using embed images like this one (just drop the link in a post written in html, not wysiwyg) http://nickpelletier.smugmug.com/Category/From- nickpelletiercom/21943413_P6Mzn6#!i=1750174498&k=5SsSHBq&lb=1&s=A I tried through settings here: Settings -> Media -> Embeds and leaving a blank value for width. This worked for landscape images, but not for portrait images. Portrait images were still using the height making the resulting width different for any picture with a different size ratio. I tried many template (including ten eleven) and all have the same problem. Hence, I think this is how Wordpress is actually made to work. This being said, I'm looking for how I can change this behavior in the code (template if possible, wordpress if worst case). I'm a programmer by day doing backend code. I'll probably be ok with the code part, but I have no clue of php, wordpress (this is my first blog I'm setting up) and am fairly new to web\html. Any clue of where to look first would be appreciated. --Edit Here is a page with a portrait image (first from smugmug, second from flickr) http://nickpelletier.com/2012/03/19/alphonse-et-dorimene-desjardins/ The current value in setting -> Media -> Embeds are width:nothing and height:1500 I would have liked the image to go to max width of column instead of having a height of 1500


title: Display Image for a category using get_categories, or show an image from any child post

text:
I am using get_categories to list the child categories of a parent category. I want to add an image to the child categories, using the get_categories output.   * I can either take the featured image from any of the posts that are children of the category that I am using get_categories on, IE the grand-child of the parent category. I do not want to show any other grand child information, and would want just one featured image from each set of category children. The code I currently use is               $args = array('child_of'  => 1  );     $categories = get_categories($args);       foreach($categories as $category) {          echo '
Category:'. $category->name.'
 ';         echo '
 Description:'. $category->description . '
';         echo PUT CAT IMAGE HERE;          }         * Or I could add an image to a category using some plugin, and show it in the `foreach($categories as $category)` output. But what is the best (and easiest) way to implement this?


title: How to add custom javascript into <head> from custom plugin

text: I wrote a plugin but it keeps adding custom javascript into section not into section of every page. Can anyone help me or give me a hint how to add js into section?               public constructor {         add_action( 'init', array( $this, 'custom_js_register' ) );         add_action( 'wp_head', array( $this,  'custom_js_print' ) );     }          function custom_js_register() {         wp_register_script('custom_button', 'http://xxx.xxx.xxx/js/Button.js');     }          function custom_js_print() {         wp_enqueue_script('custom_button');     }                 also instead of just loading js, I want to be able to do something like this.               <script type="text/javascript" src="http://xxx.xxx.xxx/js/Button.js" charset="UTF-8">     </script>


title: Multiple sites with pretty permalinks with nginx

text: I'm trying to set up a new local development server and instead of Apache I've decided to go with nginx. What I'd like to do is have each WordPress site live within its own directory inside `/usr/share/nginx/www`. The sites are only going to available on our local network. So for example: `/usr/share/nginx/www/ourcompanywebsite` -> `http://192.168.2.250/ourcompanywebsite` `/usr/share/nginx/www/firstclientwebsite` -> `http://192.168.2.250/firstclientwebsite` `/usr/share/nginx/www/secondclientwebsite` -> `http://192.168.2.250/secondclientwebsite` `/usr/share/nginx/www/sitefortestingthings` -> `http://192.168.2.250/sitefortestingthings` Getting that setup is fairly trivial. In fact, I've got it working just fine. The problem is that pretty permalinks do not work. Unfortunately I don't know enough about nginx to make this happen. Here's my current nginx sites-enabled/default.conf file. Please excuse any obvious amateur mistakes; I really cannot stress how little I know about setting up nginx.               server {         listen 80;         listen [::]:80 default ipv6only=on;              root /usr/share/nginx/www;         index index.php index.html index.htm;              location / {             auth_basic "You shall not pass!";             auth_basic_user_file /home/mojo/src/config/nginx/htpasswd;             try_files $uri $uri/ /index.html;         }              location /doc {             root /usr/share;             autoindex on;             allow 127.0.0.1;             deny all;         }              location /images {             root /usr/share;             autoindex off;         }              error_page 500 502 503 504 /50x.html;              location = /50x.html {             root /usr/share/nginx/www;         }              location ~ \.php$ {             fastcgi_pass 127.0.0.1:9000;             fastcgi_index index.php;             include fastcgi_params;         }              location ~ /\.ht {             deny all;         }     }      I've seen guides on how to setup pretty permalinks with nginx but they all seem to assume that you'll just have one site or that your separate sites are on separate domains. So, is the setup I want possible? If so, what do I need to do to make it happen? If not, or if it's a really bad idea, then what is a similar setup that lets me have multiple WordPress installs with pretty permalinks? Any other useful tips that might improve my configuration are appreciated. Worst case scenario I can go back to Apache (where I had my desired setup working), but I'd rather figure this out.


title: Navigation that Runs Above and Below Header Image

text: Is there a way to have a navigation div(s) on the Twentyeleven theme or similar themes that runs over the header image and finishes below the header image? Basically so overflow runs below the image. Here's an example: Link to Website


title: Why does WordPress load jQuery in my header instead of footer?

text: Here's a site I'm working on... 198.1.77.196/~larog/ I've taken an older WordPress theme (Twenty Ten) and modified it to be my own theme. Anyways, the site isn't anywhere near done, I'm just in the process of building it. One of the things I'm curious about though is why WordPress loads jQuery in the head of my site when I am always hearing people saying that you should load jQuery in the footer of your site (or after the tag) so that it helps the page to load faster. I've Googled this and found nothing that answers my question. Any input is appreciated!


title: How to add shortcode tags in single.php

text:
In my theme has one shortcode tags to display tags of post and function to load content post. But in function doesn't include shortcode tag. Now I want to add it to function but i don't know how to do it. Hope everyone help me out. Thank in advance. **Shortcode tag**               function wwl_post_tags( $atts ) {         if( $tags = get_the_tag_list( '', ', ' ) ) {                  $defaults = array(                 'before' => __( 'Từ khóa: ', 'icy' ),                 'after'  => '. ',             );             $atts = shortcode_atts( $defaults, $atts );                  return sprintf( '%1$s%2$s%3$s',                 $atts['before'],                 $tags,                 $atts['after']             );         }     }     add_shortcode( 'post_tags', 'wwl_post_tags' );      **Function to load content post**               function wwl_post_content() {         global $more;              if ( ! is_single() ) {             $more = 0;           }              do_action( 'wwl_before_post_content' ); // Hook              if ( ! is_single() && of_get_option('post_content') == 2 || is_search() ) :         ?>
                 <?php wwl_thumbnail(); ?>                 <?php the_excerpt(); ?>

         <?php else : ?>
                 <?php wwl_thumbnail(); ?>                 <?php the_content( '', false, '' ); ?>                 <?php wp_link_pages( array( 'before' => '
' . __( 'Pages:', 'icy' ), 'after' => '
' ) ); ?>

         <?php endif;     }


title: Problem accessing values from $wp_query in plugin

text: I am creating a custom plugin where I am passing parameters in the url and trying to access the values of those parameters using $wp_query directly in the plugin, but it returns an empty array. I presume it is because $wp_query doesn't exist yet when my plugin is executed.                global $wp_query;      print_r($wp_query); // this is empty      But If I create a filter first then the contents of $wp_query are accessible within it                add_filter('wp_head', 'get_values');           function get_values() {        global $wp_query, $id;        print_r($wp_query); //complete array        $id = $wp_query->query_vars['id']; // value exists      }      I need to be able to access the contents of $wp_query outside of a filter, in the main part of my plugin, so I can make calls like this                global $wp_query;      if ($wp_query->query_vars['id'] == 1) {        remove_action('wp_head', 'rel_canonical');        // do a bunch of other stuff      }      I thought I could set $id be a global variable within the filter and then access it later outside of the filter but that doesn't work either. Any ideas or workarounds?


title: Image Manager Plugin

text: I'm looking for a simple plugin that allows me to manage groups of images. Wordpress does this, but you would need to link the gallery to a page or post. Since i'm looking to create a site banner with dynamic images, i don't want to link a gallery to an specific page. Is there a good image manager plugin for this simple task or do you know a way to do it natively in wordpress?


title: Add stylesheets and js to template files when shortcode is used

text: After looking for days throught the net and no avail - i'd like to ask all of you guys. PROBLEM: i need to add custom code to the head of the file as part of shortcode use for my plugin. The same files and code insert fine in the admin page (backend) but fail to load in the template file. The files are inserted in the admin head with add_action('admin_print_scripts', 'add_swm_scripts'); & add_action('admin_print_styles', 'add_swm_styles'); calls pointing to functions that use wp_enqueue_script() and wp_register_style() / wp_enqueue_style() This does fine - however - when i try to get the same files registered in the function of the shortcode (for use in the template), nothing workds. I checked that the shortcode is read and it's according function is fired, but neither add_action( 'wp_enqueue_scripts', 'swm_scripts' ); , add_action('init', 'register_swm_scripts'); nor add_action('wp_head', 'print_swm_scripts'); will work. I've tried more than this not don't find a working solution. If somebody knows a valid trick - i more than appreciate some advice. Thanks in advance! Herbie


title: Changing Wordpress blog name and web address

text: I created a self-hosted WordPress blog (on Dreamhost) several years ago. I've never truly been happy with the name and URL/domain of the blog, and I've decided that I want to change it. Here's what I'd like to do:   1. Register the new domain name. (Say www.newblog.com for example.)   2. Redirect traffic from the old domain name (www.oldblog.com) to the new one (www.newblog.com).   3. Begin using www.newblog.com as the new web address. I'll be staying at the same web host through all this. I know there are lots of smaller steps I need to take in here, so I'd appreciate it if someone could help me fill in the blanks. Thanks!


title: Display list of most used tags in the last 30 days

text:
I am looking for a way to display the most used tags over the last 30 days. I am no coder, but I have come up with this mashup to display a list of the most used 28 tags (preference to fit my theme). I cannot, for the life of me, figure out how to limit the tags to the most used in the last 30 days. Here is what I have:
         <?php             $tags = get_tags( array('orderby' => 'count', 'order' => 'DESC', 'number'=>28) );                 foreach ( (array) $tags as $tag ) {                 echo '
term_id) . '" rel="tag">' . $tag->name . '
';                 }         ?>
      ## Update This is the full code I am using right now, following One Trick Pony's code below.
     <?php     global $wpdb;     $term_ids = $wpdb->get_col("        SELECT DISTINCT term_taxonomy_id FROM $wpdb->term_relationships           INNER JOIN $wpdb->posts ON $wpdb->posts.ID = object_id           WHERE DATE_SUB(CURDATE(), INTERVAL 30 DAY) <= $wpdb->posts.post_date");          if(count($term_ids) > 0){            $tags = get_tags(array(         'orderby' => 'count',         'order'   => 'DESC',         'number'  => 28,         'include' => $term_ids,       ));     foreach ( (array) $tags as $tag ) {     echo '
term_id) . '" rel="tag">' . $tag->name . '
';     }     }     ?>
      The website is slightly less than ~4 weeks old, so to test, I changed `INTERVAL 30 DAY` to `INTERVAL 3 DAY` and the tags being returned seem random and some haven't been used in 2+ weeks and have only been used a single time. As well, only 8 tags are being displayed, when more have been used. To check that the correct number of days have been queried, I did the following: Completely deleted all items in the trash for posts and pages, I don't have any custom post types. Did the same with drafts. Ran a query in phpmyadmin to delete all post revisions - `DELETE FROM wp_posts WHERE post_type = "revision";` Ran a query in phpmyadmin to check if the results are the posts from the last 3 days - `SELECT * from wp_posts WHERE DATE_SUB(CURDATE(), INTERVAL 3 DAY) <= post_date` The results from the phpmyadmin query were, in fact, the posts from the last 3 days, but the front-end display did not change. # Update 2 Here are some screen shots. Maybe the screenshots can help find where my code is wrong. **Blog Post with Category and Tags** ![Image of blog post](http://i.stack.imgur.com/ZTTAo.png) **`wp_posts` table with the post `ID` of above post** ![wp_posts](http://i.stack.imgur.com/mZOVs.png) **`wp_terms` table with the `term_id` of the tags used** ![wp_terms](http://i.stack.imgur.com/F3tpl.png) **`wp_term_taxonomy` with the tags' `term_id` as `term_taxonomy_id`** ![wp_term_taxonomy](http://i.stack.imgur.com/iNpIH.png) **`wp_term_relationships` with `term_taxonomy_id` assigned to post as `object_id`** ![wp_term_relationships](http://i.stack.imgur.com/PTr44.png) # Update 3 I think I figured out the problem, but do not know how to fix it. The SQL query gets the `term_taxonomy_id`, not the actual tag ID and `get_tag_link` uses `term_id`


title: MultiPostThumbnails and media queries

text: I am using the plugin "MultiPostThumbnails" and it's setting my width to 700px. Is there a way to get it to not set the width and height at all? I want it to resize when I use media queries and instead what is happening is that the image "box" is getting smaller but the image is not because of the width and height settings in the `<img>` tag...


title: How to sent one form values to 2 different sites in wordpress

text: I am trying to post values in a form into 2 different urls. Is this possible? Basically i want to have a form send the form optin values into aweber and send a email with the filled in values. I am on wordpress site but can have a php or html page if this is not possible using wordpress. I currently have the aweber form to collect the info would like to send these values as email. Is this possible using any plugin or any hack Thanks Prady


title: WordPress plugin to publish to multiple remote WordPress blogs

text: I have a WordPress (.org) blog (let's call it blog1) that is used by many authors, who may create, edit and publish posts (on blog1). Each author has her/his own WordPress blogs, hosted elsewhere. The authors would like to be able to publish their posts from blog1 to their remote blogs. Is there any plugin I can use for this task? Notes: 1) WP multisite is not a solution to this problem since it hosts multiple blogs on one host, and also since the authors of blog1 have their popular blogs already hosted elsewhere. 2) I need the functionality to be able to publish from blog1 to remote WP blogs, and not vice-versa. Thanks!


title: Reblog WordPress to another WordPress?

text: 1.Is there any way to reblog only the excerpts of WordPress posts to another WordPress with the featured image(option to choose the size of the image we prefer) and link to the WordPress site to see the full post from specific category/ies or tag/tags? 2.Will it cause me any problem to my page rank and the Google search results if I do something like this?


title: How to get attachment file name not attachment URL

text: I'm using this code to list the image attachments of a post:                     <select name="chb_homes_for_sale_specifics_floor_plan" style="width:100%;">             <option value="">Select</option>             <?php             $args = array(                 'numberposts'     => -1,                 'orderby'         => 'menu_order',                 'order'           => 'ASC',                 'post_type'       => 'attachment',                 'post_parent'     => $post->ID,                 'post_mime_type' => 'image'             );             $image = get_posts($args);             if($image) {                 foreach($image as $key => $data) : ?>                          <option value="<?php echo $data->ID; ?>"><?php echo $data->post_title; ?></option>                      <?php endforeach;             }             ?>           </select>      But what I'm showing currently is the attachment `post_title` but I want to show the file name instead. I could maybe use get attachment URL then parse the URL to get the file name but was wondering if there is a ready made way in WordPress to get the file name.


title: just can't get date-based archives per post-type to work

text: I expected that wp3.1 with the support for archive-{post_type}.php would solve my problems. However, I am still struggling to get it working. What I want is: a custom date-based archive page per post-type, which displays years and months. Once you click on a year of a month, you'll go to another archive page which outputs the relevant posts. First of all: I am clueless on how to create a date-based archive page for certain post-types anyway. Is there a certain page-template which automatically gets called when going to {post-type}/archive? `<?php wp_get_archives(); ?>` doesn't seem post-type aware. Second of all my date-based permalinks doen't work. A simple {post- type}/2010/01 gives an error404. I've created all my archive-.php pages with simple content:               get_header(); ?>                  <section id="content" class="hfeed">     <?php get_template_part('posts'); ?>             </section>          <?php get_footer(); ?>      Any clue?


title: Is there any plugin which enables users to rate comments in thumbs up-down way?

text: * The plugin should work with un-registered users also.   * Its not mandatory for plugin to add rating system to posts/pages. I need thumbs up-down rating system only for comments.


title: How to make post templates to include shortcodes only?

text: I used to post same shortcodes every time (shortcodes loads dynamic contents). So, I want to pack these shortcodes in a template for my posts. How can I do this?


title: Using author_can() on custom post types in WordPress

text: I'm trying to conditionally display some content in a theme using custom roles and capabilities. First, I define a custom role: `add_role('free_vendor', 'Free Vendor Listing', array('read', 'edit_posts', 'delete_posts', 'display_map'));` This is run directly from functions.php (do I need to add it to an action somewhere?) Then I use the `display_map` capability I defined to conditionally display the map: `if (author_can($post, 'display_map')) echo '<li><a href="#map">Map</a></li>';` The only problem is, it doesn't work! Is there some issue in using author_can() with custom post types? Am I not calling add_role() properly? I can't really find any decent documentation on using `author_can()` with anything other than vanilla posts. Is this just not possible?


title: Rewrite Rules for Multiple (more than 2) Taxonomies

text: I am using woocommerce and have some 'product attributes' which are just a taxonomies. I have the following taxonomies:   * pa_color    * pa_material   * pa_style the pa_ stands for product attribute and it is built-in to WooCommerce handles these taxonomies, so I can't change that. WooCommerce also comes with product categories (product_cat) and product tags (product_tag) taxonomies. the following query gets me all the Red, Vinyl products in the Fabrics product category > ?product_cat=fabrics&pa_material=vinyl&pa_color=red I'd like to turn this into a pretty permalink, something like: > product-category/fabrics/material/vinyl/color/red This answer gets me pretty close to what I am trying to achieve: URL rewrite rules for multiple taxonomies query in that I can get my URL to handle 2 taxonomies (product_cat + 1 attribute taxonomy), but I am stuck on how to get 3 (or more) parameters. So I can get: > /products-category/fabrics/color/red or > /product-category/fabrics/material/vinyl but not all 3 together > /product-category/fabrics/material/vinyl/color/red edit / though i think it'd be ideal to have the URL be /fabrics/vinyl/red i'm not sure that is possible? end edit/ WooCommerce also has some settings for modifying the permalinks (like prepending the URL with 'shop' or changing the product-category slug) so i'll need to account for that eventually, but right now I need to get this first step down. for simplicity's sake, this is a stripped down version of my code. I'm actually getting the taxonomies from built-in woocommerce functions, but the question isn't limited to woocommerce... as it pertains to any site w/ a lot of taxonomies.               add_action( 'init', 'wpa_init' );     function wpa_init() {          $taxonomies = array ('pa_color'=>'Color','pa_material'=>'Material','pa_style'=>'Style');     $base = 'product-category';                  foreach ($taxonomies as $taxonomy=>$mask):                       $attribute = strtolower(sanitize_title($mask));                 add_rewrite_rule( $base.'/(.+?)/'.$attribute.'/([^/]+)(/page/(\d+))?/?$', 'index.php?product_cat=$matches[1]&'.$taxonomy.'=$matches[2]&paged=$matches[4]', 'top' );                      endforeach;          }      this was the best resource i've found on taxonomy query permalinks: http://thereforei.am/2011/10/28/advanced-taxonomy-queries-with-pretty-urls/ but it, too, seems stuck at 2 taxonomies.


title: Redirection with a wildcard

text: I have put my wordpress installation liek these : http://www.mydomain.com/cms for the testing time, and time to implement thing in the database. Now i have switch the whole thing to : http://www.mydomain.com/ (root). How is it possible to tell all the request to /cms to be / (root). i know htaccess can do that, but i prefer a plugin or how to migrate an installation from one directory to another seemlessly ?


title: Total number of posts in last year

text: How can i echo total number of posts in last year ? I‚m writing article with stats, and want to get number of posts i published last year. There is something here, but not for last year http://perishablepress.com/press/2006/08/28/display-total-number-of-posts/ It displays only total number of all posts


title: How can I add an Export option to a WP_List_Table

text: I have an admin page that extends the WP_List_Table class to generate a table of results from a custom database table. I am trying to add a button that will enable the admin user to export the results (as filtered by any search terms) to a CSV file. Here is the challenge:   * The WP_List_Table class passes search terms etc through GET query parameters. If my "Export" button goes to a separate page, I think I will have to manually add the GET parameters for the Export button.   * The CSV export will require me to send HTTP headers (specifically, Content-type and Content-Disposition). If I simply have the Export button be a special submit button with a specific name/value, I don't know how to get the WP_List_Table to check the GET parameters for the Export button's status prior to triggering early output hooks like admin_head(). I'm sure there's a method that I've overlooked. Can anyone give me some advice?


title: Deploying WordPress development updates to multiple sites?

text: I have a wordpress site with many copies,and hosted in many servers.This uses child theme.I have my local copy of it and developing is going on this copy.in local copy i have added many files,pages and some database changes.I want to update all server copies from local developed copy.How can i do this?.Can i achieve this by simply updating theme from backend?


title: How to reverse the order of Wordpress blog posts?

text: WP 3.0.2 I've tried adding                 <?php query_posts($query_string . "ℴ=ASC") ?>      above                 <?php if(have_posts()) : ?>      in the page.php file, with no result


title: How to show Small Box Inside Content Area, which holds (text, images, links)?

text: I want to generate unique TEXT+Images+Link for each (single) post, the results will be visible to content area right hand side, within a BOX. I already have a plugins WP-InfoBox (http://wordpress.org/extend/plugins/wp-infobox/) it works similar ways but the developer who made, he didn't bothered the class, ID -- so it's messed-up the entire theme. I tried to change the class, ID names from the plugins but it's not working anyways. It's overlapping and I almost spend 3-4 hrs but I couldn't able to resolve it. However, Basic things, I'm looking for   * Include images+text+link form WordPress CUSTOM area   * Visibility in the location (see images) Can anyone help me with that issue, that would be great.


title: adding my posts (author posts) in menu

text: I want to add "my posts" to main menu. By clicking on this, each logged-in user will see his/her own posts. I don't know how the link structure should be to add on the menu.


title: How to filter a static post page with ajax and $wp_query

text:
I'm at a loss, I've found several unanswered questions related to this one. I have a static post page which has a search form in the sidebar. What I want to happen is to type in a keyword and then 'filter'(return with ajax) only the posts that fit the search. I also want it to be paginated. I've found several ways to manipulate `$wp_query` so that I can use the same loop for the ajax call. Unfortunately when I look `global $wp_query` in functions.php where my callback action is, it is basically null or initialized to default parameters. I debugging everything locally, I wonder if that would affect anything. I haven't confirmed it but shouldn't that global variable stay the same unless something explicitly happens to it(like navigating to a new page)? This is the callback in functions.php               function cbSearch()     {         $counter=1;         $html="";         global $wp_query;                   if ( have_posts() )         {             while ( have_posts() )             {                 the_post();                 $html.="
";                 $html.=the_title('
','
');                 $date= strtoupper(get_the_date('F Y'));                 $subtitle = get_post_meta (get_the_ID(), 'subtitle', $single = true);                 $summary = get_the_excerpt();//get_post_meta (get_the_ID(), 'summary', $single = true);                 $html.="
".$subtitle." - ".$date."
";                 $upload_dir = wp_upload_dir();                 $html.="";                 $html.="
";                 $html.=$summary;                 $html.=" › READ MORE";                 $html.="
";                 if ($counter != count($posts))                 {                     $html.="
";                 }                 ++$counter;                      $html.="
";                 echo $html;                 $html="";             }         }         $html.="
";         $html.="";         $html.=get_previous_posts_link(" P ");         $html.="";         $html.="";         $html.=get_next_posts_link(" N ");         $html.="
";         echo $html;              die();     }      I use a breakpoint in this function to find the `$wp_query` parameters. This is what is returned when I do a var_dump immediately after calling `global $wp_query;`               object(WP_Query)[145]       public 'query' => null       public 'query_vars' =>          array           empty       public 'tax_query' => null       public 'meta_query' => boolean false       public 'queried_object' => null       public 'queried_object_id' => null       public 'request' => null       public 'posts' => null       public 'post_count' => int 0       public 'current_post' => int -1       public 'in_the_loop' => boolean false       public 'post' => null       public 'comments' => null       public 'comment_count' => int 0       public 'current_comment' => int -1       public 'comment' => null       public 'found_posts' => int 0       public 'max_num_pages' => int 0       public 'max_num_comment_pages' => int 0       public 'is_single' => boolean false       public 'is_preview' => boolean false       public 'is_page' => boolean false       public 'is_archive' => boolean false       public 'is_date' => boolean false       public 'is_year' => boolean false       public 'is_month' => boolean false       public 'is_day' => boolean false       public 'is_time' => boolean false       public 'is_author' => boolean false       public 'is_category' => boolean false       public 'is_tag' => boolean false       public 'is_tax' => boolean false       public 'is_search' => boolean false       public 'is_feed' => boolean false       public 'is_comment_feed' => boolean false       public 'is_trackback' => boolean false       public 'is_home' => boolean false       public 'is_404' => boolean false       public 'is_comments_popup' => boolean false       public 'is_paged' => boolean false       public 'is_admin' => boolean false       public 'is_attachment' => boolean false       public 'is_singular' => boolean false       public 'is_robots' => boolean false       public 'is_posts_page' => boolean false       public 'is_post_type_archive' => boolean false       public 'query_vars_hash' => boolean false       public 'query_vars_changed' => boolean true       public 'thumbnails_cached' => boolean false      I know that ajax function is working. Can anyone tell me why $wp_query turns into garbage somewhere between page load and the http request? EDIT: After considering the logic a little bit more I don't think typical pagination will work with ajax. Since next/previous_posts_link provides a url for a link, that means $wp_query parameters are loaded based on the page template any additional parameters in the url. Only when $wp_query knows it's loading a page template next/previous_posts_link will return http://domain.com/new/page/2/ instead of http://domain.com/wp-admin/admin- ajax.php?paged=2. I'm considering using `get_posts()` in the ajax call and returning the posts for one page and creating next/previous links that call the ajax function with an offset representing the page number.


title: Hide echo of no categories from get_object_taxonomies

text:
The following code works perfectly to show all the categories for a custom post type. However when there are no categories it echos 'No Categories'. How would I remove this?                                   <?php //Category Display for Custom Post type - Video                         $customPostTaxonomies = get_object_taxonomies('opd-music');                         if(count($customPostTaxonomies) > 0)                         {                                  foreach($customPostTaxonomies as $tax)                             {                                      $args = array(                                     'orderby' => 'name',                                     'show_count' => 0,                                     'pad_counts' => 0,                                     'hierarchical' => 1,                                     'taxonomy' => $tax,                                     'title_li' => '',                                     'echo' => 0,                                     'style' => 'simple'                                 );                                 echo '';                                     echo  'All';                                 echo str_replace( '
', '', wp_list_categories( $args ) );                                 echo '';                                  }                              } ?>


title: Which are the hooks run before/after when a category's deletion?

text: What are the actions that a plugin can hook on to for processing when the user deletes a category?


title: In wordpress I am manipulation 404 response. I want to give the response before 404 error is given to google

text: May be the question in title is not explaining what exactly I want. So I will explain one logic and then ask what problem I am getting from that. We are using wordpress. We have 2 categories Option1(Having 64 different values) and Option2(Having 8 different values). We wanted url like ourdomain/Option1/Option2 depending on users location. And data on that url will be specific according to that Option1 and Option2. We dont wanted all this 64*8 actual wordpress pages to be created. So after searching much on net we had one solution that I implemented one plugin for routing. IN that code snippet was as follow.               function site_router() {          global $route,$wp_query,$window_title;     error_reporting(E_ALL);     if ( $wp_query->is_404 )          {             $wp_query->is_404 = false;             $cUrl="http://".$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI'];             $targetUrl="";             switch($cUrl)                     {                     /* According to condition  I had written diffent cases like below.                     */             default :                 {                            include(get_template_directory() . "/home.php" );                  $template =locate_template('pagepath/home.php');                             $window_title = 'dynamically it will come';                             if ($template) {                             load_template($template);                             die;                             }                         }                                             }              }     }          add_action( 'wp', 'site_router');      So by this my purpose was fulfilled successfully. But now problem is that google is saying they are getting back a 404 error. I think obviosly it will give as after it gives the error we are doing all template loading and all stuff. So Can any body guide me how can I do this before that 404 response is given to google.


title: Adding content to sidebars

text: I am working on a three-column layout where all three columns will have differing content depending on the post/page in the main column. How would I go about giving the ability to change and update the sidebar content and display it in templates using something like `<?php the_content() ?>` ? Since the sidebar content is related to the post I will need a way to reference the right sidebar content for the post. Thanks in advance Yours sincerely, nav


title: How to store and receive variables in WP sessions?

text: I have a form with some checkboxes and inputboxes selectboxes and it shows what the user wants via an ajax call. The problem is that when the user click on the item and the detail page is shown and then decide to go back to the previous page he needs to click and select his previous choice again. I would like to make WP to store all the options in the session when the button to the detail page is clicked and save actual info in the session and then when he visits the page again the values will be chcecked in sessions and set if any are found. Could that be done in WP? If yes, how? Let's oversimplify that and say that we have something like this in our form:               <input class="car_color" type="checkbox" name="car_color" value="1" />     <input class="car_color" type="checkbox" name="car_color" value="2" />     <input class="car_color" type="checkbox" name="car_color" value="8" />     <input class="car_color" type="checkbox" name="car_color" value="4" />     <input class="car_color" type="checkbox" name="car_color" value="6" />      I don't use submit button in my form, it's handled via AJAX on input change. And in my results get via ajax I have a link to the detail page:               <a class="detail-info-link" href="<?php echo $url ?>">      Any idea how can I store my values in Session and call them when revisiting/reloading/back button in the browser? I need to be able to read the session stored stuff and use it via ?Javascript? and trigger my search fuction via ajax which is already working well. I just need to store (probably before going to $link in href of by detail button and read and send session variables (if they exist).


title: Query author's posts & posts that have author's id as meta value

text:
I am trying to get posts with an author's ID as a meta value in the `author.php` template using additional request parameter. For example I want posts with john's ID as a meta value using a request like this               http://localhost:8888/twitgreen/author/john/?eco=somemetakey      So far I can make it using a `new WP_query` in author.php like this               if ( get_query_var('paged') ) {         $paged = get_query_var('paged');     } elseif ( get_query_var('page') ) {         $paged = get_query_var('page');     } else {         $paged = 1;     }          if($_GET['eco']=='somemetakey'){         $lot = array(             'meta_query' => array(                 array(                     'key' => 'somemetakey',                     'value' => $current_view->ID                 )             ),             'post_type'=>'lot',             'paged'=>$paged ,         );     }          $wp_query = new WP_Query($lot);          //and some loop here
<?php next_posts_link( __( '← Older posts', 'clonecell' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'clonecell' ) ); ?>
           But unfortunately it doesn't work on the next pages. The URL, `http://localhost:8888/twitgreen/author/verifikator/page/2/?eco=somemetakey` points to the 404 page. **The Question**   * How can I query posts with an author's ID as a meta value in the author.php?   * How can I query posts with an authors's ID as a meta value or post from that author in author.php?   * How can I do this requests using WordPress hooks? Thank you in advance.


title: Writing a custom Glossary plugin

text: I'm just about to start work on a Glossary plugin for my fishkeeping website. My fish guru has suggested that he would like to be able to   * include images and    * easily link to other glossary entries. To begin with I was intending just to write a taxonomy : title, slug, description, parent. with parent being the initial of the glossary entry for easy searching. That probably won't do the trick however - how could I thus incorporate images or linking? What would be the most effective way of going about this?   * A Custom Post Type?    * How can I provide the Glossary entry authors with a simple way of linking to another Glossary entry? **EDIT** I'm specifically looking for a glossary, with the following kind of entries: > **Cyanobacteria** - Phylum of generally blue-green coloured bacteria, often > confused with algae, that obtain their energy via photosynthesis and include > unicellular and colonial species. Some species occur commonly in aquaria > where they're normally regarded as pests. and.. > **Ich** - Common name for Ichthyophthirius multifiliis, a protozoan which > infects freshwater fish. Also referred to as white spot.


title: How do I Add images uploaded in the post to a default custom field

text: I'm trying to add the URL of the post images in to a default custom field. Here is the code I got so far... Here is how I add the default custom field:               add_action('wp_insert_post', 'mk_set_default_custom_fields');         function mk_set_default_custom_fields($post_id)         {             if ( $_GET['post_type'] != 'post' ) {                 add_post_meta($post_id, 'Image', '', true);             }             return true;         }      Now I need a function that fills the value with the URL from the image uploaded. If there is no image uploaded the field can be empty. Here is the code to fill the value with info, but I need the thumbnail url in the value               add_post_meta($post_id, 'custom field name', 'custom field value', true);