title: Pagination with WP_Query is buggy - working for some pages, but not the others

text:
I'm having a very peculiar bug with pagination :( I'm trying to display 4 posts per page for a category with slug "lastest-news". The pagination function seems to work correctly. There are 33 posts. The pagination gets constructed correctly with 9 pages and links of following format: /category/lastest-news/page// The interesting thing is that it works correctly (displaying 4 posts per page) from page 1-4 including. However, for pages 5-9 it doesn't work at all. It doesn't even seem to serve the template... the only error that I could spot is of the page saying "Nothing found for Category Lastest-news Page 5". I would understand if it won't work at all, but for randomly 4 pages and not more? I would really really appreciate any help! I've spend about over 4 hours trying to figure out what's wrong and it's bugging me. Thanks for help :) I'm using the following code for query:               <?php      $page = get_query_var('paged');     $posts_on_page = new WP_Query("posts_per_page=4&category_name=lastest-news&paged=".$page);          //loop to display every one of 4 posts          //pagination     pagination($posts_on_page->max_num_pages);     ?>      I'm using pagination function from this post: http://www.kriesi.at/archives/how-to-build-a-wordpress-post-pagination- without-plugin Here is the function (which seems to work fine):               function pagination($pages = '', $range = 2){        $showitems = ($range * 2)+1;             global $paged;      if(empty($paged)) $paged = 1;           if($pages == '')      {          global $wp_query;          $pages = $wp_query->max_num_pages;          if(!$pages)          {              $pages = 1;          }      }              if(1 != $pages)      {          echo "
";          if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "«";          if($paged > 1 && $showitems < $pages) echo "‹";               for ($i=1; $i <= $pages; $i++)          {              if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))              {                  echo ($paged == $i)? "".$i."":"".$i."";              }          }               if ($paged < $pages && $showitems < $pages) echo "›";            if ($paged < $pages-1 &&  $paged+$range-1 < $pages && $showitems < $pages) echo "»";          echo "
\n";      }     }


title: How to display the page title/content in the Posts page?

text: I made a home.php file and called it Blog. It set it to be the Posts page, but I would like to add a title that will be displayed in that page (the title of page or content). e.g:               Posts page:              Page title         (Maybe page content)              == Posts ==              Post Title         Post Content          Post Title and so on


title: What's the section of code (or loop) which retrieves the Page title and description?

text:
What's the code of the loop which retrieves the Page title and description? I checked the code inside page.php of the Starkers theme (I guess is the same as the TwentyTen theme):               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>               <?php if ( is_front_page() ) { ?>
<?php the_title(); ?>
          <?php } else { ?>
<?php the_title(); ?>
          <?php } ?>                    <?php the_content(); ?>           <?php wp_link_pages( array( 'before' => '' . __( 'Pages:', 'twentyten' ), 'after' => '' ) ); ?>           <?php edit_post_link( __( 'Edit', 'twentyten' ), '', '' ); ?>              <?php comments_template( '', true ); ?>      I looks identical to the loop which retrieves the main (blog) posts. What's the difference? Which is the part which retrieves the title and content of the current Page?


title: Favorite post when post is updated

text: I want to auto-favorite a post (using wp favorite posts) when a post is updated. I tried this :               function myfunction($post_id)     {     wpfp_add_favorite($post_id);     }     add_action( 'save_post', 'myfunction' );


title: Move out of sync posts from one database to another

text: I have an issue where the following has occurred: WP install is pointing to database server 1. Database server 1 is backed up. Database from DB server 2 is restored onto DB server 1. I need to get all the posts that exist in the post from DB backup 1 that do not exist in DB server 2. What is the easiest way to do this? I am currently manually comparing the mysqldump files, but this is a 30+ site multisite installation, and I would prefer to not make things worse.


title: Top ten tags ala Delicious

text: How would I create a list that only shows the ten most used tags for my site? Kind of how Delicious organizes tags. Any ideas?


title: Hoe to add rel="nofollow" to wp_list_pages

text: I'd like to use the wp_list_pages as a navigation bar, but I don't want the links to be followed. This is the simple version of the code I'm using `<?php wp_list_pages('hierarchical=1&title_li=&depth=1'); ?>` but I have no idea how to add the "nofollow" to the links.


title: add_theme_support('my-custom-feature')

text: According to the codex, there is no way that I can see to define a custom theme support feature. Ideally, I'd like to set a feature in my child theme that the parent theme could check for. Does an equivalent function exist that would be appropriate to use in this context? For example, I'd like the parent theme to have a new sidebar in the header area, but since I'm introducing this sidebar area late, its presence could break previously created child theme layout look and feel. So, for new child themes created after this addition, I'd like to be able to call something like:               add_theme_support('header-sidebar');      Then, in my parent theme, where I register the default sidebars available to any child theme, I'd like to use:               if(current_theme_supports('header-sidebar')){      /* create a sidebar for the header area */      register_sidebar(...)     }


title: Multi-level ordering in Wordpress

text: I have a collection of posts and first I want to order them by 'name' in ASC order and then order by 'date' in ASC order. How does one go about doing this?


title: How to "pair" two widgets side by side in one sidebar

text: Currently I use the Pinboard theme with 2 sidebars. In each sidebar I place one kind of widget several times. The point is that 2 widgets of a row (1 of each sidebar) belong together regarding the content. What I really want is that I could place the 2 different widgets (belonging together) side by side in one sidebar and repeat this for the others in the same sidebar. I found the extensible widgets plugin (http://wordpress.org/plugins/extensible-widgets/) but it isn't maintained anymore for 3 years. So I didn't install it. Furthermore, I found some discussions about solving similar problems with tables or with css anyhow. For better understanding you can see my WP instance here: http://turbine.reimone.net/ My problem is that each widget in a "widget pair" must be configured. The first widget is an event widget which comes from the All-in-One Event Calendar by Timely plugin and the second widget just is a text widget containing simple html. A "widget pair" is meant to be 2 widgets belonging together by content. Both widgets of a pair should be aligned side by side in the layout. I hope that both upper edges (one of each widget) in a pair are on the same vertical level so that visitors can determine better which widgets belong together. Can you help me to solve this?


title: Custom Page redirects after user registers

text: I'm using the "Theme My Login" plugin and basically I needed to make it so if the user fills out the registration form on page "X", they get taken to page "Y". I have done this with the help of a plugin called "Peter's Login Redirect". The issue is I need to make it conditional, e.g. if the registration form is filled out on page "A", go to page "B", and if it was filled out on page "C", go to "D". The client keeps adding extra features to the site, which if I knew about from the start, I would never have recommended WordPress. It's too late now and the site is live. They just need to add this feature for a big promotion they are running.


title: How to check if a page exists by url?

text: I need to display certain content depending on whether or not a page URL exists. I don't want to check by title, because certain pages will have the same title, and just different parent pages. For example one page may be               http://example.com/analysis/firstNamelastName     http://example.com/exercise/firstNamelastName       I just need to know if one of these URL exists or not.


title: Wordpress.com hosting question

text: I'm recently newbie using WP. My website idea consist in fast and easy/direct video uploading, which is possible using my premium WordPress.com subscription (13gb storage and "unlimited" bandwidth). The issue is that, my website core will consist in a large amount of video bandwidth (the videos size around 5-10 mb, but with multiple visualizations). My biggest fear is that the WordPress server may have problems with that and the website video's performance may be reduced. Moreover, i read several articles not recommending hosting in wordpress.com due to bandwidth limitations but to have a independent host service. Unfortunately, this possibility doesn't allow the essential fast and easy/direct video upload that i need for my website. My question is, considering the requirements for my website, does wordpress.com server guarantee the optimum video visualization? Is there a way to use a independent hosting service like bluehosting but yet still upload the videos in a direct way like in wordpress.com? Thank you for your time and patience Cheers, R.C:


title: how do I get the tag name from tag id?

text: I have the tag ID, in integer format. I want to convert this to the tag name. e.g. "cars" How do I do this?


title: Plugin and theme script load order

text: I'm building a plugin that adds scripts to the page using `wp_register_script` and `wp_enqueue_script`. However, when the page loads, it's loading the plugin scripts before the theme's scripts. This is causing some errors because the theme is loading jQuery, which needs to be loaded first. Is there a way of making the plugin script load last, so that the theme script is loading first in the page?


title: How can I make my domain work with my site?

text: I host & run self-installed WP blogs, but in this instance I'm desperate for some help. I have a virtual server, via Digital Ocean setup running the latest version of WordPress. Here's my environment; Digital Ocean Ubuntu 14.04LTS droplet VPS PHP Zend Engine v2.5.0, Copyright (c) 1998-2014 Zend Technologies with Zend OPcache v7.0.3, Copyright (c) 1999-2014, by Zend Technologies mySQL Ver 14.14 Distrib 5.5.37, for debian-linux-gnu (x86_64) using readline 6.3 The site binds correctly via its IP, and I've setup Permalinks to be in the format domain/sample-post I also have a domain set up via Digital Ocean, and that directs to the blog, so mariodecristofanosblog.com correctly points to the WP install. So what I want to do now is to ensure the site fully resolves via domain name, and not IP. So posts and such like change from 178.62.47.214/my-post to mariodecristofanosblog.com/my-post. I'm technical. But I'm missing something, I'd really love some help. I modified the wp-posts sql database via PHPMyadmin to replace all instances of the IP with the full domain name. I used an online tool, to avoid serialization issues and I made sure to only touch the wp-posts database. I then changes the site URL and home URL settings (General > Settings) to be mariodecristofanosblog.com as opposed to the IP Finally, I then FTP'ed in and moved the files from the root (www) into a folder called mariodecristofansblog.com The above is basically a short summary of all the online guides which are available to achieve this. I'm doing something wrong or I'm missing something because I just can't get this to work. Could someone please please please help!?


title: Wordpress running on rasppi not displaying themes correctly

text: I have a Raspberry pi that I set up to be a webserver, and it works great. As far as I can tell, my only issue is that the themes do not display right. (The text seems to be okay, but its like the HTML never saw the CSS) I have the theme set to "Finch" and its displaying as plain HTML page. Being new to Wordpress, I would assume I am doing something wrong. I just don't know what. Has anyone had/resolved this problem for yourself?


title: Export Users and their Advanced Custom Fields

text: I've google it but i am still looking for a solution. Is there a plugin or method to export wordpress users with their advanced custom fields? I don't want to export ACFs structure but users' data.


title: have_posts is empty on category.php

text: All the applicable code is in this gist. I have a really simple `category.php` template. I have 3 posts, each belonging to the same parent category, and 2 belonging to one child category and the third belonging to the other child category. When I use `wp_list_categories` to generate the category links, it works fine. But when I click the link to look at any of the categories, I get the `else` from the `have_posts` `if` statement.


title: how to give a user a role?

text: How possible give a user the 'adminstrator' role? for example I made a user with wp_insert_user(array(..., 'role' => 'Administrator') but it doesn't effect on role of user. thanks.


title: Why I am not able to direct user to my blog section without login?

text: function wpse_41699_wp(){         if( is_page('Login')||is_page('register')||is_page('Blog')||is_page('blog') ){             return;         }else{             if(!is_user_logged_in()){                 $url = get_bloginfo('home').'/login';//ACW-login location need to be specified                 header('HTTP/1.1 403 Forbidden');                 header("Location: $url");                 exit;             }         }     }      In the function.php, I added above code, I used above code to disable user access to my site without login, but I want to make regular use able to access blog section which is a page named Blog. but I do not konw why still, I will be direct to login page, while register page is been successufully unblocked from been request to login. Can anyone help me on this one? Thanks!


title: Using a front controller in a Wordpress plugin, any suggestions?

text: My idea was to use a front controller in our plugin. has anyone done that already? The responsibilities of the controller should be   * initiate router class;    * provide access to objects registry, which will be responsible for finding and initializing other classes (possibly through factories);    * initiate class responsible for binding WordPress actions. I was thinking about following the standard martin fowler example but if someone has already tried it I might want to learn from him.


title: Move Multiple WP Installs on a single domain to WP Multisite

text: I have a domain with 18 WP Sites installed on it - all under different directories domain.com/site1 domain.com/site2 domain.com/site3 I want to try and get all of the sites migrated to a single WP Multisite Blog All the instructions I can find on this appear to be moving WP sites from different domains or sub domains First step : Go through all of the 18 sites and make a back-up Second step : Convert the WP site within root to WP Multiuser Third step (For each of the 18 sites) : Set up new "site" with MU Admin Fourth Step (For each of the 18 sites) : Import data from back-up The problem I have is how do I then check that everything has been migrated over correctly when the old site will no longer be visible ? Also, will MU let me set up a site on the same path if a site already exists, for example if old site was on path domain.com/site1 - I would want new site within MU to be also "site1" Hope this make sense Any tips and advice would be appreciated Thanks. David


title: Delete a custom post function value

text:
I'm having an issue with custom functions at the moment, once a value has been added to the database I can not delete the value, what's the best way to solve this? Basically I've created a custom post type for a games database, when adding a game there are several custom post functions; game developer, publisher, review score and a review URL, now if I enter a test URL it will save that but when I try to delete it, it still appears and wont save the deleted value. Here is the code I'm using:               <?php     function display_games_database_meta_box( $games_database ) {     // Retrieve information from the game     $game_publisher = esc_html( get_post_meta( $games_database->ID, 'game_publisher', true     ) );     $game_developer = esc_html( get_post_meta( $games_database->ID, 'game_developer', true ) );     $game_rating = intval( get_post_meta( $games_database->ID, 'game_rating', true ) );     $game_review_link = esc_html( get_post_meta( $games_database->ID, 'game_review_link', true ) );     $game_release = esc_html( get_post_meta( $games_database->ID, 'game_release', true ) );     ?>

             Game Publisher	             <input type="text" size="80" name="games_database_game_publisher" value="<?    php echo $game_publisher; ?>" />

             Game Developer	             <input type="text" size="80" name="games_database_game_developer" value="<?php echo $game_developer; ?>" />

             Game Rating	                              <select style="width: 100px" name="games_database_rating">                 <option value="No Score">No Score</option>                 <?php                 // Generate all items of drop-down list                 for ( $rating = 10; $rating >= 1; $rating -- ) {                 ?>                     <option value="<?php echo $rating; ?>" <?php echo selected( $rating, $game_rating ); ?>>                     <?php echo $rating; ?>/10<?php } ?>                      </select>

             Review Link (Use the full URL)	             <input type="text" size="80" name="games_database_review_link" value="<?php echo $game_review_link; ?>" />

             Game Release Date (Format: June 26th 2013)	             <input type="text" size="80" name="games_database_game_release" value="<?    php echo $game_release; ?>" />

     <?php     }     ?>     <?php     // Adds and saves the game to the database     add_action( 'save_post', 'add_games_database_fields', 10, 4 );     function add_games_database_fields( $games_database_id, $games_database ) {     // Check post type for games     if ( $games_database->post_type == 'games_database' ) {         // Store data in post meta table if present in post data         if ( isset( $_POST['games_database_game_publisher'] ) && $_POST['games_database_game_publisher'] != '' ) {             update_post_meta( $games_database_id, 'game_publisher', $_POST['games_database_game_publisher'] );         }         if ( isset( $_POST['games_database_game_developer'] ) && $_POST['games_database_game_developer'] != '' ) {             update_post_meta( $games_database_id, 'game_developer', $_POST['games_database_game_developer'] );         }         if ( isset( $_POST['games_database_rating'] ) && $_POST['games_database_rating'] != '' ) {             update_post_meta( $games_database_id, 'game_rating', $_POST['games_database_rating'] );         }         if ( isset( $_POST['games_database_review_link'] ) && $_POST['games_database_review_link'] != '' ) {             update_post_meta( $games_database_id, 'game_review_link', $_POST['games_database_review_link'] );         }         if ( isset( $_POST['games_database_game_release'] ) && $_POST['games_database_game_release'] != '' ) {             update_post_meta( $games_database_id, 'game_release', $_POST['games_database_game_release'] );         }     }     }      Can you see where I'm going wrong?


title: Change post date for testing purposes

text: Is there a way I can change a post date to preferably a different month and a year for testing purposes?


title: Which part of the plugin to change so the updater won't register the next version?

text: I have made a change in WP qTip plugin so only a specific `a.something[title]` instead of `a[title]` is affected. It's just a small plugin, but if there is a new version and my client wll update this plugin the changes will be lost. My question is what in the plugin should I change so the update will be not possible and plugin not recognized? Will be changing the name enough? E.g. from: `Plugin Name: WP jQuery qTip` to som thing like: `Plugin Name: WP jQuery qTip - No Update` ? Or I need to make additional changes in the plugin too?


title: How do I retrieve multiple values from a multidimensional array in wp_options?

text: I'm just starting to store data in multi-dimensional arrays in wp_options and I need some help to retrieve some data... My data is below and is stored as option_name "my_category_fields" I need to pull a string of category ids in which the my_cat_hide is set to true. I've stubbed my function here. How do I complete it?               function get_hidden_cats()     {     $my_cats = get_option('ce4_category_fields');         //how do I capture the list of category ids where my_cat_hide is 'true'?         $my_hidden_cats = ?         return $my_hidden_cats;     }      my_category_fields:               a:17:{         i:20;a:1:{s:13:"my_cat_title";s:30:"Black Tea is Good for the Soul";}         i:9;a:1:{s:13:"my_cat_title";s:58:"Herbal Chinese Tea is a spectacular blend of herbs and tea";}         i:44;a:1:{s:13:"my_cat_title";s:24:"This is my 9th category!";}         i:7;a:1:{s:13:"my_cat_title";s:0:"";}         i:19;a:1:{s:13:"my_cat_title";s:0:"";}         i:4;a:2:{s:13:"my_cat_title";s:28:"My test Title for Chai Tea 4";s:12:"my_cat_hide";N;}         i:37;a:1:{s:13:"my_cat_title";s:0:"";}         i:16;a:1:{s:13:"my_cat_title";s:0:"";}         i:5;a:2:{s:13:"my_cat_title";s:0:"";s:12:"my_cat_hide";N;}         i:6;a:1:{s:13:"my_cat_title";s:0:"";}         i:8;a:1:{s:13:"my_cat_title";s:0:"";}         i:3;a:1:{s:13:"my_cat_title";s:0:"";}         i:10;a:1:{s:13:"my_cat_title";s:59:"Iced Tea: The Great Southern Choice for Cooling Refreshment";}         i:36;a:1:{s:13:"my_cat_title";s:28:"Full title for this category";}         i:38;a:2:{s:13:"my_cat_title";s:0:"";s:12:"my_cat_hide";s:4:"true";}         i:39;a:2:{s:13:"my_cat_title";s:0:"";s:12:"my_cat_hide";s:4:"true";}         i:40;a:2:{s:13:"my_cat_title";s:0:"";s:12:"my_cat_hide";s:4:"true";}     }


title: Color palet in the Wordpress' front-end?

text: Recently I've been seeing a lot of premium wordpress themes that includes a palet to change background colors, like this one: http://pexeto.com/dandelion_wp/ and this one: http://kaptinlin.com/themes/striking/ Is the colour being saved in the database or is just changes in the current session? ### UPDATE (Copied from duplicate) Basically, I would like to add this color picker: ![enter image description here](http://i.stack.imgur.com/fDpnR.png) To a custom "Theme Options" to let the client pick, for instance, the color of links or company identity colors (maybe some divs' background). and how the code that modifies the CSS would look like? How to do that?


title: Javascript Solution Remove Specific Tag but leave the rest in a specific DIV

text:
I have a div structure that looks like this...

      This is done in the Wordpress Admin for the post and gets displayed when I use
<?php the_content(); ?>
      What I want to do is remove the `<a>` tags that show up ONLY between div class "gallery_lightview" and leave the `<img>` tag. So once its all stripped out it would look like...

      Basically making this a non clickable image. Is this possible? Its going on a Mobile site and I don't want this to be in the header. Really wanted it to be a self contained Javascript that sat above the `"the_content"` Wordpress call (which is where the `"gallery_lightview" div` code is. I choose to not use a jQuery because, since its mobile it would add to the load. And literally the only thing the library would be doing was removing the `<a>` tag. Any ideas? I wanted the Javascript to live in the .php page template so I didn't have to go into every single post and add the Javascript as well. Is this possible? **ADDITION** I basically want to deactivate any `<a>` tag in "`gallery_lightview`" so that just the "`img`" tag is left and displayed


title: trying to update post meta in bulk

text: I have been trying to arrange my site so that my URL structure is set to domain.com/collection/%collection%/%product-group% Where %collection% is a taxonomy term, collection is the index, and %product- group% is the product in question (its a group cause each group will list many product variations) Anyway, wordpress seems unable to handle this simple task, so I am switching methods in order to get my permalink structure correct. I am simply going to create the collection, product, and variant pages all under the same custom post type with no taxonomies to deal with. Then each will display a page template depending on the value of a custom field (collection, product, or variant) Well, since I already have the products and variants already uploaded to their respective custom post types, I don't want to go through all the data again to set featured images and content. (If it werent for that, I would just re import all the data.) So I created a function to switch post types in the data base for me. It works except for one part. here is the code               function change_post_type($from,$to,$value)     {     global $wpdb;          //change metadata     $post_id = $wpdb->get_results ('SELECT ID FROM wp_hyhg_posts WHERE post_type=pods_product_grps' , object);                    foreach ($post_id as $id){     $table='wp_hyhg_postmeta';     $data= array(         'post_id' => $id,         'meta_key' =>'input_type',         'meta_value' => $value     );          $wpdb->insert( $table, $data );                }           //UPDATE           $data2= array(               'post_type' => $to,                );            $where =array('post_type' => $from );                 $wpdb->update('wp_hyhg_posts', $data2, $where);                }                change_post_type ('pods_product_grps', 'uc-product', 'product');      So, I was able to get the post type to switch from 'pods_product_grps to uc- product easily enough, but I also need to add a meta value 'input_type' to every product I just switched. Since it is already changed, I can simply add input_type=>product to all products currently labeled as uc-product But I also need to run this code where the function is: change_post_type ('product_variant', 'uc-product', 'variant'); So I need to get the meta data figured out for the ones I just converted, before I add the new set of data to the mix. The product and Variants input type both have additional sets of meta data that are displayed conditionally based on the value selected. Products will have a field called group_id and variants will have a field (product sku) which contains the group_id plus a number So I need another query that finds all post marked 'product', gets the post_id, then compares the group_id to product_sku and updates the parent_id field to the cooresponding parent relationship. That is probably confusing. In other words, a product variant is a child of a product if group_id is in product_sku So I'd like to make a query that populates the parent field of the post table based on that condition. Hope someone can help with this one. Select group_id from


title: Is there a way for a plug-in to get it's own version number?

text: Is there an API I can call, inside my plug-in, to determine the plug-in's version? I just want to have my plug-in emit a html comment with it's own version number ... for diagnostic purposes.


title: Select two sums with single get_var statement

text: I am trying the following               global $wpdb;     $sum = $wpdb->get_var("select sum(first), sum(second) from table where id > 1");      I am unable to get the values from each request. I have tried               echo $test->sum(first);      I have tried to change the sql statement to include AS                $sum = $wpdb->get_var("select sum(first) as firstRequest, sum(second) as secondRequestfrom table where id > 1");          echo $test['firstRequest'];      I have tried a `foreach` statement               foreach($test as $tester){       echo $tester['sum(first')];     }      and               foreach($test as $tester){       echo $tester['firstRequest'];     }      How can I retrieve the sum of multiple rows from a single `get_var` statement? If not possible, and I need the sum of 5 different rows, would I have to create 5 separate `get_var` statements? Would this decrease the querying speed, if so, is it even noticeable?


title: Unregister post type from child theme

text: I'm trying to unregister a post type from a child theme but I haven't been able to do so, the code in the funcions.php file on the parent theme is something like this:               add_action( 'init', 'mc_projects' );     function mc_projects() {         register_post_type( 'project', array(             // Default options....         ) );          }      What I tried to do in my child theme was to remove the mc_project action from the init hook like this:               remove_action('init', 'mc_projects', 11);      But it didn't work, even when I set the priority to some higher value, am I doing something wrong?


title: General Settings for Wordpress Subdomain

text: I recently updated to the latest version of WP. One of my bloggers mentioned that the Preview link wasn't working for her anymore. I'm unsure whether the recent upgrade stopped it from working or if it was something else. So, I did some research and someone suggested making sure that the WordPress URL and the Blog URL matched in the General Settings http://wordpress.org/support/topic/post-preview-not-working-1 Mine did not... They were denschool.com/blog and blog.denschool.com. So, I changed the WordPress URL to blog.denschool.com. My blog stopped loading correctly. I changed it back in the database, but it's still not working. How do I fix this?


title: Links after moving my site to another domain

text: I'm going to move my site from development/staging environment (i.e. dev.example.com) to production environment (example.com). Probably, existing links in my pages and posts will still point to the old url, i.e. dev.example.com. how do i deal with this issue? is it possible correct all the links in one go? any suggestions? thanks!


title: Wordpress Custom File Permalink

text: Guys i have a custom file that is not part of the wordpress and its not a part of the plugins. How can i add it to the permalink solution? For example: Custom file name - example123.php Permalink solution - http://mysite.com/example


title: Using Taxonomies with Vote It Up plugin chart

text:
I am using the Vote Me Up plugin http://wordpress.org/extend/plugins/vote-it- up/ on my site. I have the MostVotedAllTime function showing the top 10 posts. Currently this displays the Post Title only. I am wondering if it is possible to display a custom taxonomy associated with the post here. for example it is a chart showing music albums where the post title is the album title. I have a taxonomy called artist which i would also like to display in the chart. Does anybody know if this is possible or if there are any better plugins for this? Here is the code for the MostVotedAlltime() function               function MostVotedAllTime_Widget() {     $a = SortVotes();     //Before          ?>

Most Voted
     <?php     $rows = 0;          //Now does not include deleted posts     $i = 0;     while ($rows < get_option('voteiu_widgetcount')) {     if ($a[0][$i][0] != '') {             $postdat = get_post($a[0][$i][0]);         if (!empty($postdat)) {             $rows++;                  if (round($rows / 2) == ($rows / 2)) {                 echo '
';             } else {                 echo '
';             }             echo '
'.$a[1][$i][0].' '.Pluralize($a[1][$i][0], 'votes', 'vote').'

guid.'" title="'.$postdat->post_title.'">'.$postdat->post_title.'
';             echo '
';         }     }     if ($i < count($a[0])) {     $i++;     } else {     break; //exit the loop     }     }     //End     ?>


title: wp_list_comments renders incorrectly nested <ul>

text: I'm trying to figure out how `wp_list_comments` works. So I made the simplest possible `callback` just to see the structure of the result:               function custom_comments_callback( $comment, $args, $depth ) {         $GLOBALS['comment'] = $comment;              ?>         <li <?php comment_class(); ?> id="li-comment-<?php comment_ID(); ?>">             Hello!         </li>         <?php         }      I thought this function would be structurally correct but the result seems to contain incorrectly nested `<ul>` elements: ![enter image description here](http://i.stack.imgur.com/pdCYk.png) I thought an `<ul>` in an `<ul>` always **had to** be enclosed in a `<li>` as explained here for instance. Should I modify my `callback` function or am I missing something else here?


title: Categories or Custom Post Type to Organize Content

text: Let's say I'm starting a martial arts website and I want to categorize content into themes:   1. philosophy   2. fitness   3. training   4. techniques   5. diet Etc. I keep going back and forth between using custom loops to display the content or making each a custom post type. Is there advantages to either? And is it worth the trouble of creating the custom post types? I know this is sort of a philosophical question, but was wondering if there are any solid reasons I can't think of to go either way. Thanks so much.


title: Display content from custom meta boxes in revisions

text: When I see a "revision" for a given post type, I only see the title, the content and the excerpt. How can I see the content of a custom meta box (or any other field, for that matter)?


title: Get latest 3 posts from multiple CPT in one query

text: I'm looking to create a site wide feed on my site and have multiple custom post types. I'd like to display say 3 posts from at least 3 different post types. I can get the latest 10 posts across each post type, and I can get the latest 10 overall, but I'd like to specify so that I only get 3 from each so things are even. Is the best way to do it do 3 different queries and then merge them? I get how to do this separately, but I want them all integrated and sorted by timestamp. Any suggestions?


title: Exclude newest post from category X but show rest

text: I would like to show all posts but only exclude the NEWEST post from the 'Featured' category, other posts from this cat should display. Any idea what I should add to the loop to achieve this? I want all other posts from other cats to be displayed aswell!


title: Add column to plugins table screen

text: I'm trying to add a column to plugin table screen using "manage_plugins_custom_column", but without success. This extra column will show a custom value that was placed inside the plugin file. I hope someone could help! Thanks! Daniel \---------------- edit ---------------- This is the working code that creates the column "Version":               function add_plugins_column( $columns ) {     $columns = array(     "name" => __( 'Plugin', '' ),     "version" => __( 'Version', '' ),     "description" => __( 'Description', '' ),     );     return $columns;     } add_filter( 'manage_plugins_columns', 'add_plugins_column' );          function render_plugins_column( $column, $plugin_file, $plugin_data ) {     switch ($column) {     case "version": echo $plugin_data['Version']; break;     }     } add_action( 'manage_plugins_custom_column' , 'render_plugins_column', 10, 3 );


title: Does Anyone Know How To Shard A MYSQL Database With HypderDB?

text: I have a woocommerce site with 80,000 products. It's on pretty speedy VPS (8GB RAM, 4CPUs, SD hard drives) and it's configured pretty well (nginx, php-opcode caching, w3 total cache, etc.) but when navigating individual products, it takes several seconds to load. I noticed this starting around the 40,000 product mark and it only worsened from there. I'm trouble shot just about every, and the only option left is the mysql database. I'm planning on sharding it with hyperdb to see if that improves performance. There's virtually no information out there on how to do this. These two articles do a good job of getting a master and slave scenario set up with hyperdb, but don't mention anything about sharding. (https://www.digitalocean.com/community/tutorials/how-to-set-up-a-remote- database-to-optimize-site-performance-with-mysql & https://www.digitalocean.com/community/tutorials/how-to-optimize-wordpress- performance-with-mysql-replication-on-ubuntu-14-04). At the moment I have the original wordpress install on one server, and another blank mysql server where I want to shard the product table onto. So ideally I would like the original install to keep everything except the product tables. Anyone know how I would go about sharding out one or two tables? Thanks in advance, I've been pounding my head against the wall with this for far too long!


title: Media Manager selectection state does not have thumbnail size

text: I have written a plugin that uses the new media manager UI to insert images into a custom gallery custom post type. Everything works 100% but on a specific user's site something strange is happending that I cannot reproduce locally. Here is the code:                   var attachments = FOOGALLERY.media_uploader.state().get('selection').toJSON();              $.each(attachments, function(i, item) {           if (item && item.id && item.sizes && item.sizes.thumbnail) {             var attachment = {                 id: item.id,                 src: item.sizes.thumbnail.url             };                  FOOGALLERY.addAttachmentToGalleryList(attachment);         } else {             //there was a problem adding the item! Move on to the next         }      As you can see on line 3, it does a check if the item is valid before it adds the thumb to the gallery. `item.sizes` has data, but it only contains `full` but I rely on it having `thumbnail` to insert the thumb. Basically, `item.sizes.thumbnail` is return false so it never adds the image to the gallery. So my question is "Why no thumbnail, dude?" I checked his media settings and he does have thumbnails set at 200x200. The media library itself is showing his thumbnail images in the modal too. As I said, I cannot reproduce this locally no matter what I try, and my `items.sizes` always contains `thumbnail`


title: Bootstrap drop down menu with wp_nav_menu

text:
I am trying to build a Wordpress theme with boostrap, but the nav menu is giving me some trouble. I would like the dropdown to work like boostraps dropdown, but I do not know how to do this. This is my menu:
        <?php wp_nav_menu( array( 'items_wrap' => '%3$s' ) ); ?>
      This is what I have in my functions.php for the menu:               add_action('after_setup_theme', 'blankslate_setup');     function blankslate_setup(){     register_nav_menus(     array( 'main-menu' => __( 'Main Menu', 'blankslate' ) )     );     }          function my_wp_nav_menu_args( $args = '' )     {         $args['container'] = false;         return $args;     } // function          add_filter( 'wp_nav_menu_args', 'my_wp_nav_menu_args' );      When I add a submenu item (via Appearance - Menus) this is what is currently generated:

Parent

Child

      For my menu to work with bootstrap I need the menu to be generated like:

Parent

Child

      **So I need:**   * To add the class "dropdown", if a menu-item has child-items.    * To add class="dropdown-toggle" data-toggle="dropdown" to the .dropdown a element    * To add `<b class="caret"></b>` after the Dropdown-menu name (inside the .dropdown a element)   * To add `class="dropdown-menu"` to `<ul class="sub-menu">` Hope someone can help!


title: How can I link a CSS file only on single posts?

text: If I understand `is_single()` correctly, it's only supposed to return `true` when the current "post" (in a generic sense) is a literal post (i.e., it has a `post_type` of `post`), and that it will return `false` when the current "post" is a page, attachment, etc. This is what the Codex says:               is_single() returns true if any single post is being displayed     is_singular() returns true when any page, attachment, or single post is being displayed.      But when I try to link a CSS file only into a _post_ , it's still included in attachment pages like `http://example.com/?attachment=123456789`. Here's the code I'm using:               <?php if ( is_single() ) { ?>         <link rel="stylesheet" href="style.css" />     <?php } ?>


title: Cache issues with redis and nginx

text: I have a problem with the rewrite rules in my nginx config file. I am running wordpress with nginx and redis to cache the site. I can get the redis to cache all pages not a problem, but as I am using jigoshop which when you add a product to the basket submits a form and then adds some javascript into the page to say 'Product has been added to basket' kind of thing. My problem is I want redis to cache all the pages event the product except for when a user adds a product to the basket we want to remove the product from the cache, so that it returns the 'Product has been added to basket' in the page. In the nginx config file I can add the following:               location /product {         index index.php;         try_files $uri $uri/ /index.php?$args;     }      This will stop all of the products from using redis it hits the index.php file, but what i want is something like:               location (\?[add\-to\-cart]+) {         index wp-index-redis.php;         try_files $uri $uri/ /wp-index-redis.php?$args;     }      The problem is the location does't seem to see the regex. Any ideas or help would be gratefully appreciated.


title: Wp_query...a type of term a different div

text:
![enter image description here](http://i.stack.imgur.com/x2y9n.png) I need to create a table like this image and I want a specific term in particular DIV but with my code appear all together. **Example** : One div brown with the 5 products. The effect I want is like an accordion "Hide and Show".   So if I do not have all the same hide and show the query does not work. The end result has to be like this image on a div for each term. At this point I have a div with all terms. how I can create a div and each has your term? Thanks for helping.               <?php             $args = array (                     'post_type'=> 'coleccoes',                     'tax_query' => array(                                                     array(                                                         'taxonomy' => 'tag-series',                                                         'field' => 'slug',                                                          'terms' => array('casegoods','rugs','lighting','seating')))); ?>
          <?php      $list_query = new WP_Query($args);             while ($list_query->have_posts()) : $list_query->the_post();                      if( has_term( 'rugs', 'tag-series' ) ) {                 echo '
';                 the_post_thumbnail();                 echo '
';                 echo '
';                 the_content();                 echo '
';     } elseif ( has_term( 'seating', 'tag-series' ) ) {                 echo '
';                 the_post_thumbnail();                 echo '
';                 echo '
';                 the_content();                 echo '
';     } elseif ( has_term( 'lighting', 'tag-series' ) ) {                 echo '
';                 the_post_thumbnail();                 echo '
';                 echo '
';                 the_content();                 echo '
';     } elseif ( has_term( 'casegoods', 'tag-series' ) ) {                 echo '
';                 the_post_thumbnail();                 echo '
';                 echo '
';                 the_content();                 echo '
';     }               endwhile;              wp_reset_query();             ?>
                 **It is thus** ![enter image description here](http://i.stack.imgur.com/KrjhV.png)


title: How do I control the fallback query after the original query returned cero posts?

text: I just figured out why WP developers expect you to create a separate 404.php page to control the output of that page. (and the silence about any attempt to do it otherwise) It's basically because they provided no good fallback (or I haven't found it?) to control the second query: the fallback query run if nothing is returned by the initial query. By directing us to create another document, WITHOUT A LOOP in it, you'd never notice the loop is still returning all the blog posts. That is the only reason (or worse) for which creating a whole new template could be seen easier than a (apparently simpler) filter to the_post, to show a specific text and title if nothing found. No new template needed. Yes, I can modify the main query but it makes no sense since all the posts will be retrieved anyway once nothing is found in the initial loop. Yes, I can modify the data before the loop, but ANY post retrieved by the traditional means would revert the 404 to a 301 (with a redirect) Does anyone know how to prevent/change the fallback query? I specifically need the loop to return null or 1 page, not many. (Changing posts_per_page is useless because it only affects the initial loop, but not the one WP runs once the first returns nothing) Thanks.


title: How to add terms to my tax_query based off of the current post

text:
I need the terms in my tax_query to be the ones from the current post. I am trying to this by using a variable. The value of the variable is given by using the get_terms() function. The problem is that it is not returning anything. It does however return the correct posts when I manually put the terms in the array. How do I grab the posts terms automatically and place them in the terms parameter? Here is the code that I am using.               <?php     //for use in the loop, list 5 post titles related to first tag on current post     $tags1 = get_terms($post->ID, 'b');     if ($tags1) {     echo '

PRODUCTS

';     $args = array(     'tax_query' => array(     array(     'taxonomy' => 'b',     'terms' => array('$tags1'),     'field' => 'slug',          )     )     );     $query = new WP_Query( $args );     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {     while ($my_query->have_posts()) : $my_query->the_post(); ?>
     <?php if ( has_post_thumbnail()) : ?>     title="<?php the_title_attribute(); ?>" >     <?php the_post_thumbnail( array(40,40) ); ?>     " rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title('' ); ?>
     <?php endif; ?>          <?php     endwhile;list     }     }     ?>


title: Disallow categories from this MySQL query

text: I'm trying to modify a plugin that generates an archive listing so it shows only one category, making it a single category archive. The old version of the plugin used a get_posts query, and so it was easy to disallow categories of posts:               $rawposts = get_posts( 'numberposts=-1&category=-4,-6,-7,-9' );      The new version of the plugin uses that database query:               SELECT ID, post_date, post_date_gmt, comment_status, comment_count FROM      $wpdb->posts WHERE post_status = 'publish' AND post_type = 'post' AND post_password =      How do I disallow several categories from a database query?


title: change headline of page

text: I have a web page which includes menu. In its menu I have some items when I click on each item it's gonna show some subitems in it. for example item name : A. It has A.1 and A.2 subitems. which has A.1.1 and A.1.2 subitems. Now the question is when I go to for example A.1.1 page it's gonna show the A.1.1 headline name. how can I change this headline? I don't wanna change the page name like A.1.1. I just wanna change the headline of this page Any help will be appreciated Thanks in advance


title: How to add a button that enables the user to insert a link in a textarea located in the front-end?

text: I'm using the following plugin: http://wordpress.org/extend/plugins/question-and-answer-forum/ It as a textarea which enables the user to post a question. The author told me how to allow html on it. But I was wondering how to add a buttons which enables the user to use html, say, attaching a link to a word (like you do here at StackExchange sites). I think the same should apply to commenting forms. Any suggestions?


title: County Finder form/plugin?

text: I'm developing a WP site for a client and need to build in a "county finder" for our state (VT). Users would type the name of a town into a field (or select the town from a drop-down menu), press the submit button, and the system would spit out the name of the county that the town is located in. Ideally the results are delivered within the page, no new page load required, but that's not essential. I'm not expecting to find a pre-made solution...I'll have to enter the towns and counties manually of course...but I wasn't even sure what to look for in this case. Any suggestions appreciated. Thanks!


title: Install WordPress MU outside htdocs

text: I would like to use WP's MU function to host multiple blogs on the same hosting. I intend to use the Domain Mapping plugin to make it work with different vhosts. My hosting structure is as follows :               web         includes         vhosts             domain                 htdocs      I would like it so that my Wordpress install is in the includes directory with my other CMS libraries. Is this possible knowing that I have access to httpd.conf and php.ini. Thank you


$comment = get_comment( $comment_id );     $post    = get_post( $comment->comment_post_ID );     $author  = get_userdata( $post->post_author );     $test = "***" . $comment_id . "***" . $post->ID . "***" . $author . "***";      How can I obtain the string `$test` without getting into the error `Object of class WP_Post could not be converted to string`?


title: Permalink remain the same on each page

text: I have displayed the post title within the anchor tag after which I've set the permalink. The permalink, however, is not working with the same title that came from the post. It's like getting the previous link that just clicked. It's going to the same address over and over again and not to exact post link.                   <a class="heading-link" href="<?php  the_permalink(); ?>">                     <?php                      query_posts('cat=4&showposts=1');                   if (have_posts()) :                 while (have_posts()) : the_post();                   the_title();                   endwhile;             endif;                  wp_reset_query();                       ?>            </a>


title: What does (10, 2) mean when used with add_filter

text: Please tell my what is 10, 2 in below mention code:               add_filter('nav_menu_css_class', 'add_active_class', 10, 2 );          function add_active_class($classes, $item) {          if($item->menu_item_parent == 0 && in_array('current-menu-item', $classes)) {              $classes[] = "active";          }          return $classes;          }


title: Add "Category" to Mysql Query

text: i need your help :) I've made this custom Mysql query on WordPress:                   $querystr = "        SELECT  DISTINCT meta_value  FROM $wpdb->postmeta WHERE post_id IN(             SELECT DISTINCT wpostmeta.post_id        FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta        WHERE wposts.ID = wpostmeta.post_id         AND wpostmeta.meta_key  = 'color'         AND wpostmeta.meta_value  = 'red'         AND wposts.post_type = 'post' ) AND meta_key ='size'         ORDER BY RAND()        LIMIT 4        ";      How can i ADD in the query search for "Category name" or "Category ID" ? Cheers ;)


title: Annoying notification when trying to create a new page

text: Whenever I try tomake a new page, I get an annoying block asking me so upgrade some plugin of some sort. Is there a way to get rid of this extremely annoying notification? ![enter image description here](http://i.stack.imgur.com/sbYLq.png)


title: 301 Redirect Code

text: I am currently trying to redirect a subdomain.blogger.com blog to a domain located on my hosted WordPress install. The code below is supposed to send a 301 redirect and then make that specific post appear on my blog but it appears to be directing the user only to the home page and not to the corresponding blog post.               /************** 301 REDIRECTION ***********************/     function labnol_blogger_query_vars_filter( $vars ) {       $vars[] = "blogger";       return $vars;     }          add_filter('query_vars', 'labnol_blogger_query_vars_filter');           function labnol_blogger_template_redirect() {       global $wp_query;       $blogger = $wp_query->query_vars['blogger'];       if ( isset ( $blogger ) ) {        wp_redirect( labnol_get_wordpress_url ( $blogger ) , 301 );        exit;       }      }           add_action( 'template_redirect', 'labnol_blogger_template_redirect' );           function labnol_get_wordpress_url($blogger_slug) {       global $wpdb;       if ( preg_match('@^(?:https?://)?([^/]+)(.*)@i', $blogger_slug, $matches) ) {        $q = "SELECT guid FROM $wpdb->posts LEFT JOIN $wpdb->postmeta             ON ($wpdb->posts.ID = $wpdb->postmeta.post_id)             WHERE $wpdb->postmeta.meta_key='blogger_permalink'             AND $wpdb->postmeta.meta_value='$matches[2]'";        $wp_url = $wpdb->get_var($q);       }       return $wp_url ? $wp_url : home_url();      }      /************** 301 REDIRECTION ***********************/      My Wordpress permalink structure is set to custom with the value:               /%year%/%monthnum%/%postname%.html      Any help would be greatly appreciated.


title: "The package could not be installed" when updating plugins, themes, and core files on WampServer

text: Whenever I update anything on my local WordPress development site, whether it be plugins, themes, or the WP 3.7.1 update, I get this error message: > Unpacking the update… > > The package could not be installed.: PCLZIP_ERR_BAD_FORMAT (-10) : Unable to > find End of Central Dir Record signature > > Installation Failed I'm using WampServer 2.4, with Apache 2.0.63, PHP 5.2.11, and MySQL 5.0.88.


title: Tabbed navigation for plugin options using same row in database for all?

text: I'm trying to use WordPress' native tabbed navigation on my plugin's options page, but I'm having trouble. I've managed to get the options to display, though it displays every plugin option on every tab. I also get the error message `ERROR: options page not found` whenever I try to save settings. I think I've traced this to the fact that I'm trying to use the same row in the database for all plugin options. The reason for this is that most of the options fields are dynamically generated from a remote API call, so the tabs may not be the same across all installations of the plugin. Therefore, I don't want to predefine database rows for each tab, in case certain tabs are not in use, or tabs are added or removed based on the API response after plugin installation. Is it possible to use a single row in the database for all plugin options in conjunction with WordPress' tabbed navigation? Here's the relevant block of code in the commit containing it. I've linked to it because it contains references to methods and properties elsewhere in plugin code that may be relevant for context.


title: wordpress redirect after password reset

text: I would like to able to redirect to `get_bloginfo('url');` after reseting password. But I cannot for life of me find any simple answer or function to do this. Does anyone know if this is possible? Thank Josh


title: How to Display pages with a Custom Fields in one page

text:
I am trying to display all the pages that have custom fields of a certain value. What I would like to do is use the current page title as the value for the custom field and get all pages that have that value defined. For example:   * Current Page is "`Surgery`".    * Custom Field Name is "`Section`".    * Custom Field Value is "`Surgery`". I have been able to do it with post using the following code but I cant seem to work out how to do it with pages.               <?php woo_loop_before(); ?>          <?php         if ( get_query_var( 'paged') ) {              $paged = get_query_var( 'paged' );          } elseif ( get_query_var( 'page') ) {              $paged = get_query_var( 'page' );          } else {              $paged = 1;          }              $query_args = array(                             'post_type' => 'post',                              'paged' => $paged                         );              // Do not remove. Used to exclude categories from displaying here.         $query_args = apply_filters( '', $query_args );               remove_filter( 'pre_get_posts', 'woo_exclude_categories_homepage' );              query_posts( $query_args );     query_posts('category_name='.get_the_title().'&post_status=publish,future');             if ( have_posts() ) {             $count = 0;             while ( have_posts() ) { the_post(); $count++;                      /* Include the Post-Format-specific template for the content.                  * If you want to overload this in a child theme then include a file                  * called content-___.php (where ___ is the Post Format name)                   * and that will be used instead.                  */                 get_template_part( 'content', get_post_format() );                  } // End WHILE Loop              } else {     ?>         <article <?php post_class(); ?>>
<?php _e( 'Sorry, no posts matched your criteria.', 'woothemes' ); ?>

     <?php } // End IF Statement ?>           <?php woo_loop_after(); ?>


title: Require tags for bbPress topics

text: I want to require my forum members to enter **at least one word into the "tags"-line** , when they are creating a new topic. As regards plugins and solutions, what I found so far is the **WyPiekacz- plugin** which works well for posts: You can define rules for the data entered. It did not work for the creation of forum posts. What I also found is the answer to " **require one tag for each post** " here in WordPress Answers which contains the code for a small plugin. While exploring the php-files of bbPress, I added the last two lines to the following snippet within **`bb_post.php`** :               $topic = trim( $_POST['topic'] );     $tags  = trim( $_POST['tags']  );          if ('' == $topic)         bb_die(__('Please enter a topic title'));          if ('' == $tags)         bb_die(__('Please enter tags'));      In my understanding, that should do the trick - but still it doesn't. Or am I using the wrong file? My installation uses bbPress within BuddyPress.


title: How to display articles based on composed tag

text: I'm encountering an issue when I want to display some articles based on a "composed" tag like "amnesty-international". The query doesn't return any results. The fact is I have two article tagged with this slug. This is the code I use in the template archive.php:               $current_tag =  single_term_title("", false);     $args= array(         'post_type' => 'adverts',         'tag' => $current_tag     );          $adsQuery = new WP_Query($args);      So this url doesnt return anything : http://www.mydomain.net/tag/amnesty- international/ Should I use another function ?


title: WP_Query () using taxonomy, custom post types

text: I want to implement this query using `WP_Query()`.               SELECT *          FROM wp_posts as posts              LEFT OUTER JOIN wp_postmeta as postmeta              ON (postmeta.post_ID = posts.ID)              LEFT OUTER JOIN wp_term_relationships as taxonomy_rel              ON (taxonomy_rel.object_id = posts.ID)          WHERE posts.post_type='care-agency'              AND posts.post_status = 'publish'              AND postmeta.meta_key = 'wpcf-listtype'              AND postmeta.meta_value = 'Enhanced Listing'          GROUP by posts.post_title          ORDER BY posts.post_title          ASC


title: Is it possible to put next and previous category links?

text: I'm not trying to navigate to the next post within a category, but to put previous category and next category under the category description on its archive page and navigate between archive pages. I've searched, but I'm not sure this is even possible without hardcoding categories, and I don't want to do that. I'd like to dynamically link. Not asking anyone to write any code for me, just asking does this sound like a good starting direction for what I need to look at doing: Build a get_next_category function by using the wp_list_categories, then pulling the adjacent from that list and turning it into a link? In short, I want a category archive page to show a category title, description (know how to do both of those), then next and previous category links before it shows the posts. I am not creating a list of categories, just navigation links. Hope that clarifies what I'm trying to do. Still searching codex and exchange.


title: Database migration issues - Error #1046 No database selected

text: i need to get my clients website online and have been able to figure everything out except of course the most crucial part which is the database upload. i can't figure out what i'm doing wrong since every tutorial and forum i've been on has basically told me to do the same things and still i get errors. i'm missing a crucial point that must be assumed. the test i've made was to locally move my database by simply copying my local site and renaming the database and adjusting my config.php file accordingly. after that i figured my database was set for upload but after uploading i get the error: #1046 = No database selected. how can there be no database selected?


title: Changing wp_insert_post() location

text: I know that `wp_insert_post()` insert posts into `wp_posts` table. I want to change that to insert posts into lets say `wp_posts2`. Can I do that? I need to do this because I don't want to mess data from 2 databases and I barely use them individually.


title: Help With Contact Form 7 Dynamic Extension Plugin

text: I have some posts in a specific category that has a custom field called email. I am getting the custom field values with the following code.               $email_values = get_post_custom_values("email",$post->ID);     if( is_array( $email_values ) )     {         foreach($email_values as $key => $email_value );          }      I want to put this into the contact form 7 "To:" field . I tried the following but I am only getting 1 email address for all posts.               [dynamichidden recipient-email "CF7_get_custom_field key='email'"]      This code displays only the email custom field of the last post. How can I get the custom field of all posts? Thanks


title: Fixed width and height for the thickbox

text: How can I set a fixed width and height for the WordPress thickbox? I am trying following code, it opens the thickbox but it does not respect the height and width. I am using this code in a plugin.               jQuery('#test').load(         function() {     tb_show("testing", "#TB_inline?height=300&width=100&inlineId=simple_div");      Edit: I forgot to mention that I'm trying to set the width and height for the `#TB_window`.


title: Remove default Wordpress styling from metaboxes on edit post pages?

text: Is there a way to prevent Wordpress from automatically wrapping every metabox in the postbox class? Or at least add my own outer div so I can make custom changes via css? Thanks!


title: "show option all" on list categories doesn't display taxonomy

text: I have a `wp_list_categories` list set to display my custom taxonomy. Everything works fine, and now I want to add a `show_option_all` link. However, when the link is clicked it displays all _default_ post type posts and _none_ of the custom taxonomy. Obviously, the intent is to display all of the posts in this taxonomy, and only those.               $args = array('post_type' => 'design_asset', 'show_count' => 1, 'taxonomy' => 'asset_type', 'show_option_all' => 'Show All');     wp_list_categories($args);      Can this work? How?


title: How can i create a tag with the template's name like below, and what is the purpose of using them?

text: I saw these in a lot of WordPress themes, what are they used for and how can I create my own? I mean for example the "twentythirteen" tag at the end, what contains the actual theme's name.               get_comments_number(), 'comments title', 'twentythirteen'     edit_post_link( __( 'Edit', 'twentythirteen' )


title: Can't Access Sessions or Variables through pages

text: So I'm trying to use a session to move a variable through pages. For some reason I literally cannot access anything from index.php to archive. I declare my session at the very top of my header.php like:               <?php         if(!isset($_SESSION))         {             $_SESSION['catID'] = 3;         }     ?>      Then I move to the archive.php which pulls in the header via `<?php get_header() ?>` and my session is suddenly gone. I try to echo it out and get nothing. Same thing happens with normal variables - like it's out of scope. Anybody else have a similar problem or a solution?


title: How to spam-filter a custom content type with the Akismet plugin?

text: I have several inputboxes and no textareas in my custom content type. Can I use Akismet that comes with WP for that? If I can, how to do that? E.g. If I have 5 inputboxes like: name, address, city, telephone, email in my form that is saved from the front page and is used for further processing. How to use Akismet on that? Is it possible? if the names of the inputbosex are: name, address, city, telephone and emai, how would you set up the Akismet plugin. What should be done so no spams are saved in my db? (I need to filter the data before being saved to data using akismet in my function in functions.php. So if I get the values like e.g.               $name = $_POST['name'];     $name = $_POST['address'];     $name = $_POST['city'];     $name = $_POST['telephone'];     $name = $_POST['email'];          // here I need if condition to use akismet database to redirect back to the post without executing the rest of my code in my function.      How to do such condition using the Akismet plugin that comes with Wordpress?


title: Can't install new plugins because of the error "Could not create directory"

text: A faculty member is having difficulties with a instructional wordpress install. Fixing individual permission problems has been hit and miss, and have become a perennial pain, so I'll ask here. What can I do to make WP Just Work? The kinds of errors they get: > Installing Plugin: Lightbox 2 2.9.2 Downloading install package from > http://downloads.wordpress.org/plugin/lightbox-2.2.9.2.zip… Unpacking the > package… Could not create directory. /home/CIM140/public_html/wordpress/wp- > content/upgrade/lightbox-2.tmp When I su as www-data (the user apache runs as in Ubuntu), I can make that directory just fine. My test wp instance installs this plugin just fine, so I'm at a loss as to why it fails for them.


title: WP Customer Reviews - Doesn't process form submission on home page?

text: I've scoured the internet for hours and cannot find any way to accomplish this. Am I missing something obvious or simple? I have installed the WP Customer Reviews plugin on the latest wordpress. It seems to work fine on every page but the home page. The one I'm using is the home.php one, not a custom page chosen in the wordpress admin for the home page. It displays fine, and shows the button, but when I fill it out and submit it, the page refreshes and the form becomes blank and nothing happened at all - no customer review was added. I've tried using the shortcodes listed in the config page in various ways, I've tried adding it right into the home.php with do_shortcode();. I've gone so far as to try adding a post_meta table row in my wordpress database using wpcr_enable set to 1 for the post id of 0 (if I go to [myurl.com]/?p=0 I get the home page), but that didn't work. Any help will be very appreciated. Thanks for your time!


title: Echo Category Nicename

text: I am trying to echo the category nicename to reference a category image stored in my images folder in another folder called categories. I am using this code:               $category = get_the_category();     echo 'category_nicename.'.png">';      But all it returns is this:                     What I want is:                     I haven't been able to figure out what is wrong with my code. Can I get some help please? Thanks!


title: Can I lock a post in position, so it always appears on the homepage?

text: I'm a complete noob when it comes to Wordpress, but I've joined a company who use it as their website and they need an answer quickly. I want to know if I can I lock a post in position, so it always appears on the homepage ? I don't want to use a plug-in (preferably) Any suggestions or advice is greatly appreciated. Thanks


title: How to create a page that isn't accessible via menus?

text: I need to create a page in my site that I am able to access via url, but that won't be included in any of the navigation menus which are generated using `wp_list_pages()` on my site. How can I accomplish this?


title: Why does akismet prevent jetpack comments from appearing in my moderation queue?

text: On the blog I run, when I have Akismet activated, it somehow prevents comments posted via Jetpack from appearing in the moderation queue. I know it's Akismet because I have disabled every plugin but jetpack and received comments in the moderation queue successfully. When I have both jetpack and aksimet activated simultaneously, however, the comments do not appear in my moderation queue.


title: What is this instance variable doing in the Widgets class

text: The lack of documentation for the WP_Widget class is driving me mad. Here is what I have salvaged off the codex:                   public function form($instance){             ?>                  <label for="<?php echo $this->get_field_id('title'); ?>">Title:              <input type="text" name="<?php echo $this->get_field_name('title'); ?>" value="<?php echo $instance['title']; ?>" id="<?php echo $this->get_field_id('title'); ?>" />             </label>                  <?php         }      What is this `$instance` variable? The docs say it is `The settings for the particular instance of the widget`. But then why isnt it just another property of `$this`. Why does `$this->get_field_name('title')` seem to know something about a title and suddenly when we want the goddamn title I have to start going into this `instance` variable. What am I missing here. Can you explain me where the `$title` is held, what the hell the `$instance` is different from `$this` and why we are using the title to get the field name? Thanks loads!


title: Slick Social Share Buttons plug-ins with Responsive theme - number of tweets link problem

text: I've just installed latest version of Slick Social Share Buttons on top of Responsive theme. In the settings page in Twitter Username I provided my twitter username. The number of the times the link was hared shows fine in the widget, but if I click on the link, I'm taken to URL `https://twitter.com/search/realtime?q=http%3A%2F%2Fwww.mysiteurl.com`, which it not found. I assume the proper url it needs to take me to should be something like `https://twitter.com/search/realtime?q=MyTwitterUsername` Am I missing something or its something wrong with plugins ? ![enter image description here](http://i.stack.imgur.com/jAKJT.png) **Clicking on number 1 takes me to page :** ![enter image description here](http://i.stack.imgur.com/2wzsQ.png) ![enter image description here](http://i.stack.imgur.com/L2Zjd.png)


title: Copy post to separate database with "add_action(....)"

text: I'm basically trying to have a copy of a post be sent to another database's table when it's published. I've gotten it to add a new row in the new table, with my own static arguments, but I'm not sure how to reference the actual post that's being published.               function run_when_post_published($post_ID)     {         echo "Hellooooo? Steve?";         echo "<br /> POST ID: " . $post_ID; // Won't even display "POST ID" with $post_ID in the string.         $con = new wpdb("password", "_________admin", "_______wp", "_______.com");         if (!$con)         {             die('Could not connect: ' . mysql_error());         }              mysql_select_db("wp", $con);              $result = mysql_query("INSERT INTO ________wp.featured_posts (post_domain, post_author, post_title, post_content)     VALUES ('3', '2', 'Sent from hook','Hello')");              mysql_close($con);     }          add_action('new_to_publish_featured', 'run_when_post_published');            add_action('draft_to_publish_featured', 'run_when_post_published');          add_action('pending_to_publish_featured', 'run_when_post_published');          add_action('new_to_publish', 'run_when_post_published');             add_action('draft_to_publish', 'run_when_post_published');           add_action('pending_to_publish', 'run_when_post_published');      I'd like to have the whole post just basically copied. Also I'd need to do this with attachments using:               add_action('add_attachment',....);      Again I've gotten the add_attachment action hook to add a row in the database, but I just don't know how to reference the attachment that the hook is being initiated from.


title: AJAX hash change problem

text:
I am using **All AJAX** theme by Cheris Coyier. But I want to change the URL. Current URL `http://localhost/wordpress/#/wordpress/sample-page/` and I want to replace `#/wordpress/sample-page/..`. My code for AJAX query (actually written by Coyier). I need help here:               $(function() {          $("#s").focus(function() {         if ($(this).val() == "Search...") {             $(this).val("");         }     });          if ($(".widget_categories li").length%2 != 0) {         $(".widget_categories ul").append("

");     }          if ($(".widget_tag_cloud a").length%2 != 0) {         $(".widget_tag_cloud").append(" ");     }          $(".home li.home").removeClass("home").addClass("current_page_item");     $("#column-wrap").append("");          var $mainContent = $("#main-content"),         URL = '',         siteURL = "http://" + top.location.host.toString(),         $internalLinks = $("a[href^='"+siteURL+"']"),         hash = window.location.hash,         $ajaxSpinner = $("#ajax-loader"),         $el, $allLinks = $("a");          function hashizeLinks() {         $("a[href^='"+siteURL+"']").each(function() {             $el = $(this);                  // Hack for IE, which seemed to apply the hash tag to the link weird             if ($.browser.msie) {                 $el.attr("href", "#/" + this.pathname)                 .attr("rel", "internal");             } else {                 $el.attr("href", "#" + this.pathname)                  .attr("rel", "internal");             }         });     };          hashizeLinks();            $("a[rel='internal']").live("click", function() {         $ajaxSpinner.fadeIn();         $mainContent.animate({ opacity: "0.1" });         $el = $(this);         $(".current_page_item").removeClass("current_page_item");         $allLinks.removeClass("current_link");         URL = $el.attr("href").substring(1);         URL = URL + " #inside";         $mainContent.load(URL, function() {             $el.addClass("current_link").parent().addClass("current_page_item");             $ajaxSpinner.fadeOut();             $mainContent.animate({ opacity: "1" });             hashizeLinks();            });     });          $("#searchform").submit(function(e) {         $ajaxSpinner.fadeIn();         $mainContent.animate({ opacity: "0.1" });         $el = $(this);         $(".current_page_item").removeClass("current_page_item");         $allLinks.removeClass("current_link");         URL = "/?s=" + $("#s").val() + " #inside";         $mainContent.load(URL, function() {             $ajaxSpinner.fadeOut();             $mainContent.animate({ opacity: "1" });             hashizeLinks();            });         e.preventDefault();     });          if ((hash) && (hash != "#/")) {         $("a[href*='"+hash+"']").trigger("click");     }          });


title: Where do you add code in custom fuctions so it works on a specific page?

text: Thanks for replying but I still can't get it to work. Is anything wrong with this code?                  <?php          class custom_loop extends thesis_custom_loop {     function page() {     if(is_page( array('career-work','happiness'))) {           global $thesis_design;     $thesis_design->home['body']['content']['features'] = 0;     $thesis_design->display['archives']['style'] = 'teasers';     $thesis_design->image['thumb']['y'] = 'after-headline';     $thesis_design->teasers['options']['date']['show'] = 0;     $thesis_design->teasers['options']['excerpt']['show'] = 1;           global $wp_query;         $saved_query = $wp_query;         thesis_loop::page();         wp_reset_query();         $args = array('category_in' => array(59,'62));         $loop = query_posts("cat=59,62");         thesis_loop::home();         wp_reset_query();         $wp_query = $saved_query;     } else         thesis_loop::page();     }     }     $custom_loop = new custom_loop();      The code above is to show teasers on a specific page. It obviously works for one page but where do I add this code, or what do I change it to, in order for it to work for any page I specify? I've tried creating a new PHP file in my theme and copying and pasting the code (changing the category ID etc) but it won't work. Thanks


title: Can I query posts by taxonomy conditionally based on post type?

text: I have a query based on multiple post_types and taxonomies that works well, however I would like to add a level of complexity and query a taxonomy only for a specific taxonomy. This query works as expected:               Array     (         [topic] => global-reach         [sections] => programs-and-services         [regions] => ghana         [post_type] => Array             (                 [0] => publications                 [1] => media_releases                 [2] => page             )         [posts_per_page] => 10     )      Now I would like to select only the 'pages' that have the taxonomy 'options' set to 'set-as-news-item' ... here is a somewhat unlogical pseudo query of what I would like to accomplish, but it should get the idea across.               Array     (         [topic] => global-reach         [sections] => programs-and-services         [regions] => ghana         [post_type] => Array             (                 [0] => aucc_publication                 [1] => aucc_media                 [2] => Array                           (                            [post_type] => 'page',                            [options] => 'set-as-news-item'                          (             )         [posts_per_page] => 10     )      I could use the first query above and filter out unwanted posts as I loop them, but then I could not use Wordpress' built-in pagination. I'm asking for too much out of WP_Query right?


title: Gravity forms how to display list of submitters on the post submitted page

text: * I am wondering if this could be done, we have thousands of restaurants on the wordpress site as a blog posts and one small request quote form on the bottom of every restaurant post page where job applicants asks for the job, they fill in the personal info about them and they send it to the author of the post and to the administrator via confirmation emails.    * For that purpose I have created job applicant's custom post type = portfolio and all submissions is also displayed on those portfolio CPT pages,    * After succesfull submission every job applicant's name is a title of every custom post type portfolio something like   URL: http://www.mywebsite.com/portfolio/petra-newman/ Title: Petra Newman   * I would like to display those names = titles of the custom post   types portfolio on those restaurants post pages where the form was submitted,   * **Purpose:** Other applicants can see how every virtual restaurant is   requested.   * I was thinking to create custom post field for every restaurant and   there store those submitters, so   * **Question is:** How can I tell to gravity form to store job applicants names = submitted form titles in those custom fields? Does exist any other option? How can I create list of submitters on every submitted post page?   * **Conclusion:** On every restaurant page where the form were submitted should be a list of applicant's names with links to every applicant portfolio.


title: Custom post type taxonomies URL rewrite

text: What I want to achieve is an online listing catalog with a URL like this:               www.example.com/drawing-tools/brand/type/material/color/      In this example, I have a custom post type named "drawing-tools" with 4 custom taxonomies for it: "brand", "type", "material", "color" When a user access a URL like:               www.example.com/drawing-tools/rotring/mechanical-pencil/plastic/black/      it gets all the items that match those criteria. The tricky part is that all of the taxonomies are required to be in a URL. So something like this:               www.example.com/drawing-tools/plastic/black/      would simply return an 404 error page. So my main question is: How exactly can I have all of the taxonomies in the URL in that form and return an 404 error page if one taxonomy is missing? I was thinking to write a rewrite rule that would take those uri segments and pass them as arguments to a query based on the 'Query Multiple Taxonomies' plugin and return that 404 error if one segment is missing. But I don't know how to accomplish this. Is there any solutions that you can give me? **[Update 1]** The rewrite rule would basically take this URL:               www.example.com/drawing-tools/rotring/mechanical-pencil/plastic/black/      and make it into:               www.example.com/?drawing-tools_name=rotring+mechanical-pencil+plastic+black      The above structure is required by the 'Query Multiple Taxonomies' plugin. **[Update 2]** I've given up to the Query Multiple Taxonomies plugin and instead I've switched to WP 3.1. Now, with the help from this previous question I've managed to get to work those taxonomies like I wanted. Here is the full code:               register_post_type('drawing-tools', array(         'labels' => array(                 'name' => __( 'Drawing Tools' ),                 'singular_name' => __( 'Drawing Tool' ),                 'add_new' => __( 'Add New' ),                 'add_new_item' => __( 'Add New Drawing Tool' ),                 'edit' => __( 'Edit' ),                 'edit_item' => __( 'Edit Drawing Tool' ),                 'new_item' => __( 'New Drawing Tool' ),                 'view' => __( 'View Drawing Tools' ),                 'view_item' => __( 'View Drawing Tool' ),                 'search_items' => __( 'Search Drawing Tools' ),                 'not_found' => __( 'No items found' ),                 'not_found_in_trash' => __( 'No items found in trash' ),                 'parent' => __( 'Parent Drawing Tool' ),                 ),         'public' => true,         'publicly_queryable' => false,         'show_in_nav_menus' => false,         'exclude_from_search' => false,         'show_ui' => true,         '_builtin' => false,         '_edit_link' => 'post.php?post=%d',         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => array("slug" => "drawing-tools/%brand%/%type%/%material%/%color%"), // Permalinks format         'has_archive' => false,         'menu_position' => 5,         'supports' => array('author')     ));            register_taxonomy('brand',array('drawing-tools'), array(         'hierarchical' => false,         'labels' => array(             'name' => _x( 'Brands', 'taxonomy general name' ),             'singular_name' => _x( 'Brand', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Brands' ),             'all_items' => __( 'All Brands' ),             'parent_item' => __( 'Parent Brand' ),             'parent_item_colon' => __( 'Parent Brand:' ),             'edit_item' => __( 'Edit Brands' ),              'update_item' => __( 'Update Brand' ),             'add_new_item' => __( 'Add New Brand' ),             'new_item_name' => __( 'New Unit Brand' ),             'menu_name' => __( 'Brands' ),                     ),         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'drawing-tools' ),       ));            register_taxonomy('type',array('drawing-tools'), array(         'hierarchical' => false,         'labels' => array(             'name' => _x( 'Types', 'taxonomy general name' ),             'singular_name' => _x( 'Type', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Types' ),             'all_items' => __( 'All Types' ),             'parent_item' => __( 'Parent Type' ),             'parent_item_colon' => __( 'Parent Type:' ),             'edit_item' => __( 'Edit Types' ),              'update_item' => __( 'Update Type' ),             'add_new_item' => __( 'Add New Type' ),             'new_item_name' => __( 'New Type' ),             'menu_name' => __( 'Types' ),                     ),         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'drawing-tools/%brand%' ),       ));           register_taxonomy('material',array('drawing-tools'), array(         'hierarchical' => false,         'labels' => array(             'name' => _x( 'Materials', 'taxonomy general name' ),                 'singular_name' => _x( 'Material', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Materials' ),             'all_items' => __( 'All Materials' ),             'parent_item' => __( 'Parent Material' ),             'parent_item_colon' => __( 'Parent Material:' ),             'edit_item' => __( 'Edit Material' ),              'update_item' => __( 'Update Material' ),             'add_new_item' => __( 'Add New Material' ),             'new_item_name' => __( 'New Material Name' ),             'menu_name' => __( 'Materials' ),                     ),         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'drawing-tools/%brand%/%type%' ),       ));           register_taxonomy('color',array('drawing-tools'), array(         'hierarchical' => false,         'labels' => array(             'name' => _x( 'Colors', 'taxonomy general name' ),             'singular_name' => _x( 'Color', 'taxonomy singular name' ),             'search_items' =>  __( 'Search Colors' ),             'all_items' => __( 'All Colors' ),             'parent_item' => __( 'Parent Color' ),             'parent_item_colon' => __( 'Parent Color:' ),             'edit_item' => __( 'Edit Color' ),              'update_item' => __( 'Update Color' ),             'add_new_item' => __( 'Add New Color' ),             'new_item_name' => __( 'New Color Name' ),             'menu_name' => __( 'Colors' ),                     ),         'show_ui' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'drawing-tools/%brand%/%type%/%material%' ),       ));                 function filter_post_type_link($link, $post)     {         if ($post->post_type != 'drawing-tools')             return $link;              if ($cats = get_the_terms($post->ID, 'brand'))             $link = str_replace('%brand%', array_pop($cats)->slug, $link);              if ($cats = get_the_terms($post->ID, 'type'))             $link = str_replace('%type%', array_pop($cats)->slug, $link);              if ($cats = get_the_terms($post->ID, 'material'))             $link = str_replace('%material%', array_pop($cats)->slug, $link);              if ($cats = get_the_terms($post->ID, 'color'))             $link = str_replace('%color%', array_pop($cats)->slug, $link);               return $link;     }          add_filter('post_type_link', 'filter_post_type_link', 10, 2);      Now, when a user access the link:               www.example.com/drawing-tools/rotring/mechanical-pencil/plastic/black/      everything works as expected. The problem is that the user can also access a partial structure like this               www.example.com/drawing-tools/rotring/      and still get results according to those taxonomies. How can I restrict a user from accessing such a URL and instead returning a 404 error message?


title: Create a category archive page in TwentyTen Child Theme

text: I would like to create a page that will show all the posts from one particular category. I want to show the post title with the post thumbnail and content and nothing else ..no other meta ..no post date, no author, no excerpt , nothing I have tried to follow various answers/tutorials without success leading me to feel somewhat confused. Do I create a loop-category.php and add an if-category() statement for that category?? If so what statement please ?? please could someone explain clearly step by step Thank You