Display Tags of Child Pages

I'm trying to display tags of child pages on the parent page. In my functions.php:               // add tag support to pages     function tags_support_all() {     register_taxonomy_for_object_type('post_tag', 'page');     }          // ensure all tags are included in queries     function tags_support_query($wp_query) {     if ($wp_query->get('tag')) $wp_query->set('post_type', 'any');     }          // tag hooks     add_action('init', 'tags_support_all');     add_action('pre_get_posts', 'tags_support_query');      In my page template:
      <?php          $pages = get_pages('child_of='.$post->ID.'&sort_column=menu_order');     $count = 0;     foreach($pages as $page)     {         $content = $page->post_content;         $images = get_field('gallery', $page->ID);         $thumbnail = $images[0];          ?>

<a href="<?php echo get_page_link($page->ID) ?>" target="_blank"><img src="<?php echo $thumbnail['url'] ?>"/>

<a href="<?php echo get_page_link($page->ID) ?> "target="_blank"><?php echo $page->post_title ?>

<?php echo $page->post_tag ?>

          <?php     }     ?>
      This displays the thumbnails and titles of the child pages, but not the tags. What could be the issue?


Mapping Domains to Permalinks (not multisite)

I am trying to do this on a standalone WP installation (not multisite). What I am trying to achieve is:   1. User saves `domain.com` on usermeta. (done)   2. User creates a new CPT, say `company`. Which is accessible via by default `original.com/company/example-company` (done - by default)   3. I need all the posts created by the user to make available also via `domain.com/company/example-company` when the usermeta `domain` is set. I understand that the DNS and domain should be pointed to current WP installation (irrelevant), but not sure how to map the domain to a permalink. **Algorithm Should Be Something Like This**   1. Check if `company` CPT single page is shown.   2. Check if the author set a domain.   3. If `domain` is set, modify the permalink.


Count Words using tinymce in the front-end

i am using a front built in (article directory plugin) tinymce with wp_editor.   what ever i tried i cant get the word counter to work automatically.. i can count the words fine in the HTML tab using a jquery word counter but not   in the wysisyg tab since its an iframe... i got some new white hairs dealing with this issue and would really appreciate   your input / help or even a gr8 reference to a solution. **Here is the code i currently have (relevant part of the page) including   the jquery counter which i would rather not use and would rather use wordpress   or to be precise tinymce build in plugin / ability to count words as if inside the dashboard.**                    <?php             wp_print_scripts('quicktags');             require_once(ABSPATH . '/wp-admin/includes/post.php');             function richedit() { return true; }             add_filter('user_can_richedit', 'richedit');                 //wp_tiny_mce( false, array( 'height' => '370' ) );             if ($options['default_editor'] == 'html') {                 add_filter( 'wp_default_editor', create_function('', 'return "html";') );             } else {                 add_filter( 'wp_default_editor', create_function('', 'return "tinymce";') );             }             wp_editor($_POST['post'], 'minword' , array('textarea_name' => 'minword', 'editor_class' => 'count[50,0]'));         } else {             echo '';             wp_editor($_POST['post'], 'minword' , array('textarea_name' => 'minword', 'editor_class' => 'count[50,0]'));         }     ?>      . **REVISED TO BETTER EXPLAIN @bueltge AND OTHER'S MY PROBLEM...**   i have uploaded a temp version online so i can show you the problem. The website is in hebrew so you need to login   with the demo user / pass combination which is: temp / temp Url: HERE Then Click the last button meaning the first from the left...   there you would see the editor. trying to write it would results   with the chars counter not changing but if you click the HTML tab you   would see the chars counter is working.. **So.. How can i get the counter to count when in wysisyg mode?** this example uses the code buelge suggested which a minor change   to the id - here is the revised top two lines which i have changed               var comment_input = $( '#articleSubmit textarea' );     var submit_button = $( '#articleSubmit #submit' );


Switching MultiSite installation from HTTP to HTTPS

I installed MultiSite with the URL set as _http://example.com_ , but now I want to force all requests to go over HTTPS, so I'm trying to change the URL to be _https://example.com_. I've gone through the database and updated all the `siteurl` and `home` values to have _https_ , but the site still loads over HTTP, instead of being redirected to HTTPS. I know that I could setup some htaccess rules, but that's prone to errors. In regular installations WordPress will automatically redirect all requests to the canonical URLS defined in the `siteurl` and `home` settings, so I'm assuming that MultiSite does too.


Wordpress admin post meta boxes RESPONSIVE

is it possible to add custom post type meta box under text editor when I am in less then 600px width ? Because after text editor goes right sidebar.


Reset default roles and capabilities

I've been having a difficult time adding custom post type capabilities to roles (Adding capabilities to default roles) and I suspect that my muddling around may have caused some problems. I also have installed and de-installed various plugins some of which added capabilities. As a result My WP Role object is a bit of a mess. Does anyone know of a way to reset capabilities or do I need a fresh install?


URL to download latest version of WP for other languages than English

I'm considering he possibility of automating/scripting a basic WP install. Part of it will include downloading the latest WordPress version. The en-us version can be obtained by downloading http://wordpress.org/latest.zip (or tar.gz), is there any way to get an always up-to-date file URL for other languages?


Customized title tag for each page in pagination?

**With the reference of below questions.**   How to change title tags on paginated posts?   Paginate tags page   How to change title tags on paginated posts?   Add Page number to Meta Description in Wordpress SEO by Yoast   I am using **WP Page Numbers** plugin for pagination But plugin didn't offer different options. I would like to add different **title tag** for each page in my **pagination pages**. Below are different pages **Pagination for all Index pages (50 pages and increasing)**   http:// domain.com/page/2/ **Pagination for all Categories(20 pages each in 4 categories and increasing)**   http:// domain.com/this-is-category-no-1/page/2/   http:// domain.com/this-is-my-cat-no-2/page/3/


Use a hierarchical custom post type for a main blog and subblogs?

After some trouble with custom post type/custom taxonomy permalinks I'm trying out custom post types with hierarchy = true and capability_type = 'page'. Would I miss out on any blog capabilities or go against some unspoken WordPress rule if I used this structure for my blog and my subblogs?   * Blog (hierarchical CPT)      * Subblog nr1 (CPT page)        * Blogpost nr1       * Blogpost nr2       * ...etc     * Regular blog post (page!) in the 'main blog'     * Another regular blog post (page!) in the 'main blog'     * Subblog nr2 (CPT page)        * Blogpost nr1       * Blogpost nr2       * ...etc Would this be a bad idea for some reason - I'm used to blogposts being _posts_ but maybe this is just as good? The reason why I want this structure is because it's easy to rewrite the permalinks the way I want them. For instance, I will create a tag taxonomy for each subblog and then it's easy to rewrite the tag archives like this: /blog/subblog_nr1/tags/tag_name Also, of course, the subblog posts will automatically have the most obvious permalink: /blog/subblog_nr1/blogpost My only problem then is how to show the subblog archive. I guess I could hack the single-blog.php to show the blogpost children if the blogpost has children. Any other ideas?


How to add just one page in Arabic

Hi I have a WordPress site where all the content is in English, however I need just one page to be in Arabic with left to right text, plus some bullets which obviously appear on the right instead of on the left, how do I go about creating such a page?


How to change the text of link 'Home' in bbPress forum breadcrumb?

I just installed bbPress 2.0.2 forum plugin for WordPress, and would like to change the text of link `Home` to `iGeek` (or anything else, for that matter). So the breadcrumb `Home › Community` becomes `iGeek › Community` (or something like that). How do I do that? In case it helps, this is the code in `\wp-content\plugins\bbpress\bbp- includes\bbp-common-template.php` that determines the text:               /** Home Text *********************************************************/          // No custom home text     if ( empty( $args['home_text'] ) ) {              // Set home text to page title         if ( $front_id = get_option( 'page_on_front' ) ) {             $pre_front_text = get_the_title( $front_id );              // Default to 'Home'         } else {             $pre_front_text = __( 'Home', 'bbpress' );         }     }      ![bbPress Breadcrumb](http://i.stack.imgur.com/Ki4qD.png)


How to let users choose where to search for posts?

I have no code to let you correct/see, I'm still in 'thinking stage'. What i would like to achieve is this: A real estate website with a few search functionalities. This new agency (REALLY NEW we have no office actually!) will split the city in 4 (or more) parts, in each one of these part there will be different houses, each house will have different number of rooms or will be available only to girs/boys. So the user when reach my website have to be able to choose: Search Form 1   * Which Part of the city      * Accept boy/girls/both     * Budget Search Form 2   * Accept boy/girls/both      * Budget     * Which part And so on... Maybe the best way to have a simpler search query would be to use Custom Field, Am I wrong? Is there anyone who can help me to find a tutorial, or can point me to the right direction or has/know a plugin to do something similar?


How to change the "All Categories" label within the panel of my custom post type?

I just created a custom post type and a custom taxonomy:               // === CUSTOM TAXONOMIES === //     add_action('init', 'my_custom_taxonomies', 0);          function my_custom_taxonomies() {         register_taxonomy(             'location',     // internal name = machine-readable taxonomy name             'static_content',       // object type = post, page, link, or custom post-type             array(                 'hierarchical' => true,                 'labels' => array(                     'name' => __( 'Location' ),                     'singular_name' => __( 'Location' ),                     'add_new_item' => 'Add New Location',                     'edit_item' => 'Edit Location',                     'new_item' => 'New Location',                     'search_items' => 'Search Location',                     'not_found' => 'No Location found',                     'not_found_in_trash' => 'No Location found in trash',                 ),                 'query_var' => true,    // enable taxonomy-specific querying                 'rewrite' => array( 'slug' => 'location' ), // pretty permalinks for your taxonomy?             )         );              wp_insert_term('Footer', 'location');         wp_insert_term('Header', 'location');     }               // === CUSTOM POST TYPES === //     add_action( 'init', 'create_my_post_types' );          function create_my_post_types() {         register_post_type( 'static_content',             array(                 'labels' => array(                     'name' => __( 'Static Content' ),                     'singular_name' => __( 'Static Content' ),                     'add_new_item' => 'Add New Static Content',                     'edit_item' => 'Edit Static Content',                     'new_item' => 'New Static Content',                     'search_items' => 'Search Static Content',                     'not_found' => 'No Static Content found',                     'not_found_in_trash' => 'No Static Content found in trash',                 ),                 '_builtin' => false,                 'public' => true,                 'hierarchical' => false,                 'taxonomies' => array( 'location'),                 'supports' => array(                     'title',                     'editor',                     'excerpt'                 ),                 'rewrite' => array( 'slug' => 'static_content', 'with_front' => false )             )         );     }      But when I enter the edit page of my custom post type, on the sidebar it says "All Categories." It should say "All Locations." How do I change that label?


How to display retweet count and likes in the meta above the excerpt

There are several plugins that insert buttons to retweet and like into a post. You can see the count of retweets and likes at the top of single blog posts. What I want to do is show the retweets and likes in the blog home page, which has excerpts and thumbnails Like this Fabuous Post Title Retweet (button) - 45 18 likes [excerpt] There must be a way to edit functions.php for this but I don't know what to do. How is this done? THanks Examples of desired display: http://epiclaunch.com/ http://wptricks.net/


Last post in loop - custom post types

I added the below code to my index.php and it's working fine. Then I added it to my type-[post_type].php file and it's still displaying the code for the last post on the page. I can't figure out why. Should I be doing it a different way?                   <?php if( $wp_query->current_post < $wp_query->post_count-1 ): ?>         <img src="<?php bloginfo('template_directory'); ?>/images/fezhr.png" />         <?php endif; ?>      Here is my loop for one of the post types:                   <?php if (have_posts()) : ?>

Latest

EVERYTHING | GAMES | ENTERTAINMENT | TECH | PODCASTS

                  <?php while (have_posts()) : the_post(); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title_attribute(); ?>"><?php the_title(); ?>

Posted by: <?php the_author_posts_link(); ?> on <?php the_time('F j, Y'); ?> at <?php the_time('g:i a'); ?>

<?php if(function_exists('the_views')) { the_views(); } ?> | <a href="<?php comments_link(); ?>"><?php comments_number('0 Comments', '1 Comment', '% Comments'); ?>

                  <?php             if ( has_post_thumbnail() ) {                 $image_id = get_post_thumbnail_id();                 $image_url = wp_get_attachment_image_src($image_id, 'large', true);                 echo 'ID) . '" title="' . get_the_title($post->ID) . '">ID) . '" alt="' . get_the_title($post->ID) . '" class="aligncenter" />';             }             ?>                  <?php                ob_start();                the_content('Read the rest of this article...');                $postOutput = preg_replace('/]+./','', ob_get_contents());                ob_end_clean();                echo $postOutput;             ?>

             <?php if( $wp_query->current_post < $wp_query->post_count-1 ): ?>             <img src="<?php bloginfo('template_directory'); ?>/images/fezhr.png" class="fezHR" />             <?php endif; ?>                  <?php endwhile; ?>                           <?php wp_pagenavi(); ?>                        <?php else : ?>
             <img src="<?php bloginfo('template_directory'); ?>/images/FEZ404.png" />

God dammit! FEZ why do you always ruin all the fun. Sorry the page you requested has been eaten! You will just have to find something else, deal with it.
              <?php endif; ?>


How can I get rid of the the category suffix--NOT "prefix" (i.e. foo-1, foo-2, etc)

I just added a new category to my WordPress site, but the WP is adding a "-2" to the url as if there was an existing category with the same name. But there isn't. There was, but I deleted it. How can I resolve this? I'm don't mind mucking around with the database in order to manually change the values (if necessary) but I would appreciate some guidance form somebody who knows what they are doing.


How to show specific year archive into dropdown list

Here is my current code which shows a dropdown list of all years daily post archive.               <select name="archive-dropdown" onChange='document.location.href=this.options[this.selectedIndex].value;'>        <option value=""><?php echo attribute_escape(__('Select Issue')); ?></option>        <?php wp_get_archives('type=daily&format=option'); ?> </select>      But i want to show a specific year daily post archive into dropdown list. (eg. only 2010 daily post archive will show into dropdown list) Pls help me. Thanks in advance, Onirban


Wordpress slugs and 404 handling takes preference over folders in site root?

I have wordpress installed and permalink structure set to /%postname%/ In addition to WordPress folders, I also have a public_html/beta folder where I wanted to copy the same site and test some unreleased features. However, whenever I navigate to http://mysite.com/beta , I get the WordPress message saying "Sorry, but you're looking for something that isn't there". So the question is how do I make the folder take higher priority/preference than the wordpress slugs? :/ Thanks! Edit: here's the .htaccess file:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


Value from custom field is not being displayed?

For some reason this custom field is not being shown in the page. This is the template file:               <?php          /**      * Template Name: bbPress - Topics (Newest)      *      * @package bbPress      * @subpackage Theme      */          ?>          <?php get_header(); ?>

                          <?php do_action( 'bbp_template_notices' ); ?>                          <?php while ( have_posts() ) : the_post(); ?>

                                     <?php the_content(); ?>
                                      <?php get_template_part( 'loop', 'bbp_topics' ); ?>

                          <?php endwhile; ?>                          <?php if ( get_post_meta($post->ID, 'note', true) ) : ?>

<?php echo get_post_meta($post->ID, 'note', true); ?>

                     <?php endif; ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      As you can see everything is set: ![enter image description here](http://i.stack.imgur.com/BAftU.png)


Featured Image Inherited from Parent Page

What I would like to do is have my parent page's featured images display, unless a child page has its own featured image, then I would like that image to become the featured image from that page and the rest of its children pages.               -Page 1     -Page 2       -Sub Page 1       -Sub Page 2         -Sub Sub Page 1          -Sub Sub Page 2      So in the example above:   **Page 1** and **Page 2** would have a featured image set that would display in the header.   **Sub Page 1** would inherit **Page 2** featured image.   **Sub Page 2** would have its own featured image, which **sub sub page 1** would inherit.   **Sub Sub Page 2** would have its own featured image.   I have tried placing this code in my header, where the image needs to go and it did not draw in any featured images, it just brought in the image slider.:               <?php if ( has_post_thumbnail($post->post_parent, 'pagethumb') ) {                      echo get_the_post_thumbnail($post->post_parent, 'pagethumb');                      } else {                      echo do_shortcode('[rev_slider header-slider-bw]');                  } ?>      I also tested to make sure the image was there and working with this code (and it was):               if ( has_post_thumbnail() ) {     the_post_thumbnail();     }       Does any one have an advice on how to make this happen? I appreciate any help. Thanks in advance!


Splitting One Big WordPress Site into Multiple Small Sites

I have a very big WordPress site and I am facing speed issue and server resources issues. Specially numbers of MySQL records are so high. So, I want to split the big WordPress site into multiple small sites. I have URL structure like this   1. `http://example.com/this-is-first-post.html` (category1)   2. `http://example.com/this-is-second-post.html` (category2)   3. `http://example.com/this-is-third-post.html` (category1 and category2) I want to separate the WordPress according to category, I am thinking about two solutions   1. Either I create two DBs for each categories, e.g. `db_cat1` and `db_cat2` and I divide the data using some logic.   2. Or I create subdomains and install different WP instances like this:     * `http://category1.example.com/this-is-first-post.html`     * `http://category2.example.com/this-is-second-post.html` My questions are:   1. If I try the first logic, then how can I divide the databases into different categories db?   2. If I try second logic, then how can I manage the URL structure and keep SEO juice there? How can I divide the common tags and categories?   3. How I will manage resources such as image etc after splitting the WordPress?   4. Is there any better way to do this job? I don't want change the server or work on server because I already tried different types of server and all servers have the MySQL resources issues. I prefer second logic because it is easy to handle.


Ajaxify Form That Submits To Same Page To Display Post Data

I have a drop down menu that submits one of several filter options. The options are submitted to the same page, where post titles are displayed based on these options. The form is working fine, but I want to make it AJAX, to only load the post titles, not the rest of the page. The only answers/tutorials I've found deal with submitted e-mails, or forms to ANOTHER page, and I can't seem to figure out how to do it on the same page. (This is WP specific because i know wordpress has a built-in AJAX functionality)


Problem with permalink structure for Wordpress custom post_type archive template

I have looked at other similar answers to this question but not finding my way. I am using Custom Post Types plugin for a custom post_type called 'product' and has_archive is set to 'true' in the settings I am using an archive template called archive-product.php The archive template is used and works as long as the permalink structure is default. However, I want it to be the postname permalink structure. If I change it to this in permalinks then the page for products uses the standard loop (maybe archive template or index loop) What is the fix for this? I have seen some posts talk about an issue with flush_rewrite_rules() ? but this is implemented anyway when you save the permalink page so how can that be the problem? Thanks in advance.


Database slowdown after update to 3.4.1

I own a wordpress installation, and Updated to 3.4.1. After the upgrade, I got a very strange slowdown to my wordpress. After all, I used the               define('SAVEQUERIES', true);      in my wp-config.php with combined with the following code in my theme footer.php               global $wpdb;     echo "<pre>";     print_r($wpdb->queries);     echo "</pre>";      and I found that while I don't have many queries (49 queries I got), there are   * 4 Quiries took more than 9''   * 3 Quiries took more than 8''   * 4 Quiries took more than 7''   * 4 Quiries took more than 6''   * 8 Quiries took more than 5''   * 1 Quiry took more than 4'' Here I will show you some of the queries:               /* Execution time 7.0095062E-5 */     SELECT t.*, tt.* FROM wp_terms AS t INNER JOIN wp_term_taxonomy AS tt ON t.term_id = tt.term_id WHERE tt.taxonomy IN ('category') AND tt.count > 0 ORDER BY t.name ASC          /* Execution time 5.3167343E-5 */     SELECT post_id, meta_key, meta_value FROM wp_postmeta WHERE post_id IN (77375,77379,77381)          /* Execution time 9.2029572E-5 */     SELECT wp_posts.* FROM wp_posts WHERE ID IN (77381,77379,77375)      In most of the queries there query is simple, with no complexity, and I cannot imagine why that queries are so slow. The WordPress database contains in about 60.000 records and running on percona. Any idea for that issue and how maybe can I fix it ?


How to get duplicate array count with custom post type

After printing array I am getting output like this:               Array     (         [0] => WP_Post Object             (                 [ID] => 8                 [post_author] => 1                 [post_date] => 2014-01-31 15:20:56                 [post_date_gmt] => 2014-01-31 15:20:56                 [post_content] =>                  [post_title] => Surin Beach                 [post_excerpt] =>                  [post_status] => publish                 [comment_status] => open                 [ping_status] => open                 [post_password] =>                  [post_name] => surin-beach                 [to_ping] =>                  [pinged] =>                  [post_modified] => 2014-01-31 15:20:56                 [post_modified_gmt] => 2014-01-31 15:20:56                 [post_content_filtered] =>                  [post_parent] => 0                 [guid] => http://localhost/wp/?post_type=destination&p=8                 [menu_order] => 0                 [post_type] => destination                 [post_mime_type] =>                  [comment_count] => 0                 [filter] => raw             )          )     Array     (         [0] => WP_Post Object             (                 [ID] => 10                 [post_author] => 1                 [post_date] => 2014-01-31 15:21:33                 [post_date_gmt] => 2014-01-31 15:21:33                 [post_content] =>                  [post_title] => Bangtao Beach                 [post_excerpt] =>                  [post_status] => publish                 [comment_status] => open                 [ping_status] => open                 [post_password] =>                  [post_name] => bangtao-beach                 [to_ping] =>                  [pinged] =>                  [post_modified] => 2014-01-31 15:21:33                 [post_modified_gmt] => 2014-01-31 15:21:33                 [post_content_filtered] =>                  [post_parent] => 0                 [guid] => http://localhost/wp/?post_type=destination&p=10                 [menu_order] => 0                 [post_type] => destination                 [post_mime_type] =>                  [comment_count] => 0                 [filter] => raw             )          )     Array     (         [0] => WP_Post Object             (                 [ID] => 9                 [post_author] => 1                 [post_date] => 2014-01-31 15:21:16                 [post_date_gmt] => 2014-01-31 15:21:16                 [post_content] =>                  [post_title] => Layan                 [post_excerpt] =>                  [post_status] => publish                 [comment_status] => open                 [ping_status] => open                 [post_password] =>                  [post_name] => layan                 [to_ping] =>                  [pinged] =>                  [post_modified] => 2014-01-31 15:21:16                 [post_modified_gmt] => 2014-01-31 15:21:16                 [post_content_filtered] =>                  [post_parent] => 0                 [guid] => http://localhost/wp/?post_type=destination&p=9                 [menu_order] => 0                 [post_type] => destination                 [post_mime_type] =>                  [comment_count] => 0                 [filter] => raw             )          )     Array     (         [0] => WP_Post Object             (                 [ID] => 10                 [post_author] => 1                 [post_date] => 2014-01-31 15:21:33                 [post_date_gmt] => 2014-01-31 15:21:33                 [post_content] =>                  [post_title] => Bangtao Beach                 [post_excerpt] =>                  [post_status] => publish                 [comment_status] => open                 [ping_status] => open                 [post_password] =>                  [post_name] => bangtao-beach                 [to_ping] =>                  [pinged] =>                  [post_modified] => 2014-01-31 15:21:33                 [post_modified_gmt] => 2014-01-31 15:21:33                 [post_content_filtered] =>                  [post_parent] => 0                 [guid] => http://localhost/wp/?post_type=destination&p=10                 [menu_order] => 0                 [post_type] => destination                 [post_mime_type] =>                  [comment_count] => 0                 [filter] => raw             )          )      Now I want to get duplicate count of `[post_title]`. I want output like this:               Surin Beach(1)     Bangtao Beach(2)     Layan (1)      My PHP Code:               <?php         // First lets set some arguments for the query:         // Optionally, those could of course go directly into the query,         // especially, if you have no others but post type.         $args = array(             'post_type' => 'book',             'posts_per_page' => -1             // Several more arguments could go here. Last one without a comma.         );              // Query the posts:         $obituary_query = new WP_Query($args);              // Loop through the obituaries:         while ($obituary_query->have_posts()) : $obituary_query->the_post();                  $name = get_field('name');                  echo "<pre>";                 print_r($name);             echo "</pre>";              endwhile;              // Reset Post Data         wp_reset_postdata();     ?>      I will appreciate if someone guide me.


Are transients private or public?

Are WP transients specific to the user-session or can they be accessed from any session anywhere? Since they are written to the DB, I would imagine they are public and accessible everywhere, but is there a way to limit their scope to only one user's session? The website I am building does not offer a login/memmbership option. By _user_ I mean anyone that is viewing the website - I'm **not** talking about `wp_users`! Example:   * I load the home page which generates a random number and stores it into a transient which should be accessible within that same session.   * However, even from the same computer, but from a different browser, or different IP, I should not be able to access this transient... Is this possible?


How to remove the category from post slug

I want to remove the category from post slug, for example a post slug like "http://my_site.com/uncategorized/hello-world/" would become "http://my_site.com/hello-world/". My search only gives results about how to remove the word "category" from slugs, which is a different problem.


Use menu class in walker function

Is there anyway, using the custom menu css classes that are turned on in the option, to apply those via a walker function to the `span` instead of the `li's`? My custom walker:               class ik_walker extends Walker_Nav_Menu {              function start_lvl(&$output, $depth) {             $GLOBALS['ik_walker_counter'] = 0;             $output .= ''.                 '
';         }              function end_lvl(&$output, $depth) {             $output .= '
'.                 '<button id="menu" class="menu-button" type="button" role="button" aria-label="Menu Toggle">'.                 ''.                 '</button>'.                 '
';         }              function start_el(&$output, $item, $depth, $args) {             global $wp_query;             $GLOBALS['ik_walker_counter']++;             $indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';             $class_names = $value = '';             $classes = empty( $item->classes ) ? array() : (array) $item->classes;             $class_names = join( ' ', apply_filters( 'nav_menu_css_class', array_filter( $classes ), $item ) );             $class_names = ' class="' . esc_attr( $class_names ) . '"';             $output .= $indent . '
ID . '"' . $value . $class_names .'>';             $attributes  = ! empty( $item->attr_title ) ? ' title="'  . esc_attr( $item->attr_title ) .'"' : '';             $attributes .= ! empty( $item->target )  ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->xfn )        ? ' rel="'  . esc_attr( $item->xfn      ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';             $attributes .= ' class="c'.$GLOBALS['ik_walker_counter'].'"';             $item_output = $args->before;             $item_output .= '';             $item_output .= $args->link_before . apply_filters( 'the_title', $item->title, $item->ID ) . $args->link_after;             if(strlen($item->description)>2){ $item_output .= '
' . $item->description . ''; }             $item_output .= 'classes .'">';             $item_output .= '';             $item_output .= $args->after;             $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }     }      I was trying this:               $item_output .= 'classes .'">';      But i just get:                     This would enable me to control the class via the menu css option so that each can have a unique class. Any help would be much appreciated.


Custom Post Type Search

I am new to wordpress and need to modify the default search functionality. What file do I have to look for or provide me with some tutorials.. Any help would be much appreciated


Delete all the custom post types when deleting user

![delete all custom post type when delete user](http://i.stack.imgur.com/bNDQS.png) I have a problem in custom post types, when I remove user, I can't deleted there post or attribute all posts.


How can create a pagination fpr my CPT Template

I create a template for my book cpt archiv. How can creat a Pagination Page prev 1 2 3 next to the E-Paper Archiv Template? Twenty Ten Template                   <?PHP                 /*         Template Name: EPaper-Archive         */              // Wordpress Kopfbereich laden         get_header();                   /* Get the page content*/             the_post();              echo '
'. get_the_title() .'
';         echo '
'. get_the_content() .'
';             ?>

          <?php               // Intro Text (from page content)              $args = array(             'post_type' => 'book', // enter your custom post type             'orderby' => 'menu_order',             'order' => 'ASC',             'posts_per_page'=> '2',  // overrides posts per page in theme settings         );              $loop = new WP_Query( $args );              if( $loop->have_posts() ):                       while( $loop->have_posts() ): $loop->the_post(); global $post;                           $linktext1 = "Wanderführer zum Online durchbl&aumltern";                 $linktext2 = "Wanderführer als Download";                 $linktext3 = "Wanderführer Tourdaten ansehen";                       $my_content1    = get_post_meta( get_the_ID(), '_my_meta_value_key', true );                 $my_content2    = get_post_meta( get_the_ID(), 'pdfurl', true );                 $my_content3    = get_post_meta( get_the_ID(), 'artikelurl', true );                      $the_post       = get_post($post_id); //Gets post ID                      $the_excerpt    = $the_post->post_excerpt; // Auszug anzeigen                 $the_content    = $the_post->post_content; // Content anzeigen                  ?>

                                                       <?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
                         <?php the_title(); ?>

                              <?php if ( $the_excerpt != "" ) { ?>
<?PHP echo $the_excerpt ?>
                          <?php } else { ?>
<?PHP echo $the_content ?>
                          <?php } ?>                                   <?php if ( get_post_meta( get_the_ID(), '_my_meta_value_key', true ) ) : ?>                         <a href="<?PHP echo $my_content1 ?>"><?PHP echo $linktext1;  ?>
                         <?php endif; ?>                              <?php if ( get_post_meta( get_the_ID(), 'pdfurl', true ) ) : ?>                         <a href="<?PHP echo $my_content2 ?>"><?PHP echo $linktext2;  ?>
                         <?php endif; ?>                              <?php if ( get_post_meta( get_the_ID(), 'artikelurl', true ) ) : ?>                         <a href="?p=<?PHP echo $my_content3 ?>"><?PHP echo $linktext3;  ?>
                         <?php endif; ?>

                  <?PHP                  endwhile;              endif;              ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      Webpage: http://www.wandernimsaaletal.de/?page_id=705


Conditional config WP_HOME/WP_SITEURL does not update bloginfo('template_url')?

## The scenario: This question relates to Wordpress theme development on a local environment via MAMP. In order to enable mobile device testing via xip.io, I have modified my local Wordpress `wp-config.php` file with the following:               require_once('b5f-browsers.php');     if( b5f_browser_check('mobile')) {         define('WP_HOME','http://mysite.dev.'.$_SERVER['SERVER_ADDR'].'.xip.io');         define('WP_SITEURL','http://mysite.dev.'.$_SERVER['SERVER_ADDR'].'.xip.io');     }      _NOTE: Credit for this solution goes tobrasofilo in this related post._ * * * ## The problem: My custom theme's HTML head and footer blocks contain calls to CSS and JavaScript files using the standard `bloginfo('template_url')` function. This works normally when browsing on the host computer. But on mobile devices, the main site base domain as defined under _WP Admin > Settings > General_ is used in the 'template_url' instead of the conditional override as specified in the `wp-config.php` file above. So I get lines like this:               <link rel="stylesheet" href="http://mysite.dev/wp-content/themes/mytheme/style.css">      Instead of this:               <link rel="stylesheet" href="http://mysite.dev.HOST-IP-ADDRESS.xip.io/wp-content/themes/mytheme/style.css">      * * * ## A workaround: Interestingly, I noticed that `bloginfo('wpurl')` returns the correct **xip.io** URL for mobile, and other core Wordpress functions such as `bloginfo('rss_url')` obey the URL override. But `bloginfo('template_url')` just doesn't seem to want to do it. So as a workaround, I am using `bloginfo('wpurl')` then adding the full path to the theme directory instead:               <link rel="stylesheet" href="<?php bloginfo('wpurl'); ?>/wp-content/themes/mytheme/style.css">      But this doesn't seem like the right way to go about it... * * * ## The question: Is there a better/correct way to handle this?


Trying to customize wordpress drop down categories

I'm having some problems on how to display the categories that i want in wp_dropdown_categories. Here is an image of the drop down - > > ![](http://i255.photobucket.com/albums/hh140/testament1234/customizeddropdown_zps8d2fe3c7.png) Here is the code for the dropdown - **HTML:**               <?php wp_dropdown_categories( $args ); ?>       **JS:**               <script type="text/javascript">     var dropdown = document.getElementById("cat");     function onCatChange() {         if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {             location.href = "<?php echo get_option('home');     ?>/?cat="+dropdown.options[dropdown.selectedIndex].value;         }     }     dropdown.onchange = onCatChange;     </script>      I tried placing this code in my functions.php and customize it but it doesn't seem to work. PHP is not my strong point.               <?php $args = array(     'show_option_all'    => '',     'show_option_none'   => '',     'orderby'            => 'ID',      'order'              => 'ASC',     'show_count'         => 0,     'hide_empty'         => 1,      'child_of'           => 0,     'exclude'            => '',     'echo'               => 1,     'selected'           => 0,     'hierarchical'       => 0,      'name'               => 'cat',     'id'                 => '',     'class'              => 'postform',     'depth'              => 0,     'tab_index'          => 0,     'taxonomy'           => 'category',     'hide_if_empty'      => false,         'walker'             => ''     ); ?>


Woocommerce "read more" instead of "add to cart"

Right now my shop have this "add to cart" button. How can I replace this with a "read more" or "show more" button? The "read more" button should link to the product page instead of just add it to the cart. Can I add a something to the `functions.php` to call this? I guess this function is built into the system?


How make theme css be first and not plugin css

I have in theme `<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo( 'stylesheet_url' ); ?>" />` I had 3.6 wordpress with my own theme and plugins witch have css. Since on update changes in plugin css i made changed on plugin update then i put just what i change in theme css. Now i did wordpress 3.7.1 update and somehow now plugin css is overtaking my theme css changes. PS maybe helps. Also Previously admin menu on beeing logged in was just showing 25px space. Now this top admin menu shows up in my theme when im logged in.


Get wordpress page link with Post ID & Paged Number provided

how can i get page link with Post ID & Page number provided. our current way to get page link is just by using `get_pagenum_link` but this function only consume page number, and escape. is there any function that give ability to get page link with both post id & page number? Thank you


BuddyPress - Get a List of Defined xProfile fields

"How can I retrieve all xProfile fields?"


Add a button to users.php

I am working on a plugin that adds meta data for each user to the users.php table that is displayed by adding columns. I have that done but I would like to also add a button that will delete the meta data of the users when pressed. I'm not sure how I can add it. I would like it to be to the right of the 'change' button. I thought that the behavior would be to reload the page but when it does, I'll have it delete the meta data for each user. Where would I start to add that button to the page? Is this the best way to go about this? Thanks!


WooCommerce using wrong template - how do I change it?

I use the Responsive Child Theme - and its parent - for my website. It seems that WooCommerce is using the content with sidebar template for the store and product pages. I think it will look better using the full page template, but I cannot see where I select the template of choice. Can anyone direct me?


Manually Insert Title & Meta Description for Pagination pages?

This is second version of question Customized title tag for each page in pagination? answered by @joostvanhoof . I would like to add customized **title tag** `<title>` and different **meta description** `<meta name="description" content="this is description">` for each page in my pagination pages. Below are different pages i meant. Pagination for all Index pages (65+ pages) `http://abc.com/page/2/` Pagination for all Categories(22+ pages each in 4 categories)   `http://abc.com/this-is-category-no-1/page/2/`   `http://abc.com/this-is-my-cat-no-2/page/3/` Below is the code i will be using for index pagination pages.               function titles(){         if(is_home() && $paged == 2){ return 'Manually inserted title for Page 2'; }     else if(is_home() && $paged == 3){ return 'Manually inserted title for Page 3'; }     else if(is_home() && $paged == 4){ return 'Manually inserted title for Page 4'; }          if(is_category('category_title_here') && $paged == 2){ return 'title for Cat Page 2'; }     }      I can use it in the theme pages `<title><?php echo $titles; ?></title>`


jquery slider video

$(function(){ $('#slider1').bxSlider({ pager: true, buildPager: function(slideIndex){ switch (slideIndex){ case 0: return '![](/sites/all/themes/bx/images/pic_velvet1_thumb.jpg)'; case 1: return '![](/sites/all/themes/bx/images/pic_velvet2_thumb.jpg)'; case 2: return '![](/sites/all/themes/bx/images/pic_velvet3_thumb.jpg)'; case 3: return '![](/sites/all/themes/bx/images/pic_velvet4_thumb.jpg)'; } } }); });


the_post_thumbnail scaling not hard cropping

Lately I wanted to upgrade my blog with featured images/post thumbnails. I'm using a custom theme build on the roots theme (this is not a roots theme issue, I believe). The image I upload is 1024x768 and shall be cropped to letterbox format 1024x512. This is the code I'm using in the theme-file:               <?php         if ( has_post_thumbnail() ) {         the_post_thumbnail(array(1024, 512), array('class' => 'img-responsive')); // add post thumbnail             }         ?>      Now, the problem is, that on my local XAMPP box it works perfectly well. But on the webserver images aren't cropped and, they do not span the entire width of the primary content area, as they do on the local install. Checking the code with Firebug, the image is 682px wide and 512px tall (1024 x 512px on the XAMPP box). So what happens is that the image is scaled, not cropped. I re-uploaded the theme and I disabled all plugins. And of course I searched related topics, tried other code samples, checked that GD is enabled - it is and regenerated thumbs. None of this solved the problem. Any ideas greatly appreciated.


Can I use %category% like Templates in my Plugin?

I have seen that Wordpress uses `%category%` like strings to create url templates. Is there an easy way to allow such mechanism in a plugin? For example in the plugin's settings page user specifies an option               `<a href=%my_url%>Click here</a>`      And in my plugin I replace `%my_url%` with an actual URL before `echo`ing it. Is there a function/mechanism in wordpress that I can use to achieve this?


what code to add to search.php

what line of code can i add to my search page in order to display the results up to 3-5 pages per "search


Display Custom Post Type in Custom Taxonomy URL

I have created a custom post type with two custom taxonomies, which will eventually be used to filter the results in the custom post type. The problem I am having is that I would like the URL to read: site-url/custom-post-type/custom-taxonomy I've tried using some of the suggestions for people with similar problems on here, but I cannot get it working in this instance. This is the code I have at the moment, I've stripped it back as the attempts to get this working were in vain:               //Custom Post Types          add_action( 'init', 'create_post_type' );     function create_post_type() {     register_post_type( 'listing',         array(             'labels' => array(                 'name' => __( 'Listings' ),                 'singular_name' => __( 'Listing' )             ),         'public' => true,         'has_archive' => true,         'show_ui' => true,         'capability_type' => 'post',         'hierarchical' => false,         'rewrite' => array( 'slug' => 'directory', 'with_front' => false ),         'query_var' => false,         'supports' => array( 'title', 'editor' )         )     );     }          //Region Taxonomies          function region_taxonomy() {       register_taxonomy(       'region',       'listing',       array(           'hierarchical' => true,           'label' => 'Regions',           'query_var' => true,           'rewrite' => array('slug' => 'region', 'with_front' => true )       )       );       }            add_action( 'init', 'region_taxonomy' );          //Qualifications Taxonomies     function qualification_taxonomy() {       register_taxonomy(     'qualification',       'listing',       array(           'hierarchical' => true,           'label' => 'Qualifications',           'query_var' => true,           'rewrite' => array('slug' => 'qualification' )       )       );       }      Currently this produces: site-url/region/ or /qualification/ Would be great if someone can help me out with this, wasted hours going round in circles!


$wpdb doesn't appear to work on page inside of a plugin

I have a plugin folder foobar. Inside this plugin I have a page called foobar.php. Inside this page I have               global $wpdb;               $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'name'; //If no sort, default to title               $sql = "SELECT * FROM wp_nc_location ORDER BY " . $orderby;               $data = $wpdb->get_results($sql);       This query works inside of my foobar.php page. However, in the same folder I have another page called process.php, and when I include the _identical_ code:               global $wpdb;               $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'name'; //If no sort, default to title               $sql = "SELECT * FROM wp_nc_location ORDER BY " . $orderby;               $data = $wpdb->get_results($sql);       I get the error message:               Fatal error: Call to a member function get_results() on a non-object in...      Why doesn't the global $wpdb appear to work in the other page? (process.php)?


frontend image post uploader

I've set up image uploader on front end custom form for users with some text input, textareas etc .Everything works fine, untill I decide don't upload any image. Then my "thank you" page gets blank. No head data, no body content just                <html>        <head>        </head>        <body>        </body>      </html>      Here's the code                 //SAVE THE POST     $pid = wp_insert_post($new_post);         if (!function_exists('wp_generate_attachment_metadata')){                 require_once(ABSPATH . "wp-admin" . '/includes/image.php');                 require_once(ABSPATH . "wp-admin" . '/includes/file.php');                 require_once(ABSPATH . "wp-admin" . '/includes/media.php');             }              if (!empty($_FILES)) {                 foreach ($_FILES as $file => $array) {                     if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {                        return "upload error : " . $_FILES[$file]['error'];                         }                     $attach_id = media_handle_upload( $file, $pid );                 }                    }          if ($attach_id > 0){                 //and if you want to set that image as Post  then use:                 update_post_meta($pid,'_thumbnail_id',$attach_id);             }           I think It is related with image uploader validation, becouse when I deleted that part                  if ($_FILES[$file]['error'] !== UPLOAD_ERR_OK) {                    return "upload error : " . $_FILES[$file]['error'];          It redirects me to "thank you" page and displays everything well, but in admin posts in thumbnail box I receive                    Catchable fatal error: Object of class WP_Error could not be converted to string in      But ther is nothing to be converted, becouse I didn't upload anything... Can anyone help me with this one :) ?


Duplicate a Multi-Site Subdomain

just 1 click ..and it duplicates ALL content, settings, css, plugins.. im looking for a plugin that adds a new link to Sites admin; Edit | Dashboard | Deactivate | Archive | Spam | Delete | Visit | **DUPLICATE**... it should copy ALL settings/configs. and create a new subdomain instance in the **existing** Multisite


Upgrading WordPress (File permission group owner)

I have a problem when i want to upgrade Wordpress or install plugin via the Admin. It's say that I don't have the permission to write. but I can upload images and other things... but i cannot install plugin and/or update plugin/WordPress. I know that my user server is not the file owner but is part of the group owner.


two active templates for one post

I wanna have   * `example.com/post-name` -> uses template1.php   * `example.com/post-name/details` -> uses template2.php I found this discussion, so I implemented the codes in my theme’s `functions.php`. I also made the changes from the older replies but I get this error > Warning: call_user_func_array() expects parameter 1 to be a valid callback, > function 'detail_rewrite_rules' not found or invalid function name in > /public_html/wp-includes/plugin.php on line 173 I didn’t edit `plugin.php` and on line 173 is:               $value = call_user_func_array($the_['function'], array_slice($args, 1, (int) $the_['accepted_args']));      I hope someone can help me, it seems a fairly easy job but I might be wrong.


Separate registration and login for different roles

I've set 2 new roles for my site using the "Members" plugin - "sellers" and "buyers". Each role should have its own registration page and login. A visitor can register as both a buyer and a seller but he can only be logged in as one of them. So, if a visitor has logged in as a seller and then goes to the buyer page he'll be able to login as a buyer and when he does so he will automatically be logged out as a seller. I've searched for hours for a plugin that will give me the option to do this but couldn't find one. Sounds like a pretty common configuration in websites with different role registrations. Does a plugin such as this even exist? And if not how can this be done?


Custom meta fields for specific custom type only

I've got a custom post type `curiculum` and a metabox that saves a value to a custom field. However this custom field is added to another custom post type (created by an e-commerce plugin) `wpsc-product`. This is a snippet of the code that deals with the metabox. The question is, how to prevent the custom field being added to the `wpsc-product`?               /* Curiculum Date Metabox */     function curiculum_date_fields() {     if ( get_post_type() == 'curiculum'):         global $post;         $custom = get_post_custom( $post->ID );         $curiculum_date_from = $custom["curiculum_date_from"][0];         ?>
             Date:
             <input size="32" type="text" name="curiculum_date_from" id="curiculum_date_from" value="<?php echo $curiculum_date_from; ?>" />     <?php     endif;     }          function add_curiculum_date_box() {         add_meta_box("curiculum_date_info", "Event Date", "curiculum_date_fields", "curiculum", "side");     }          function save_curiculum_date() {         global $post;         update_post_meta($post->ID, "curiculum_date_from", $_POST["curiculum_date_from"]);     }     add_action('admin_init', 'add_curiculum_date_box');     add_action('save_post', 'save_curiculum_date');     add_action('publish_post', 'save_curiculum_date');      EDIT: Code for the `curiculum` custom post type:               add_action('init', 'curiculum_register');          function curiculum_register() {          $labels = array(         'name' => _x('CV Events', 'post type general name'),         'singular_name' => _x('CV Event', 'post type singular name'),         'add_new' => _x('Add New', 'testimonials item'),         'add_new_item' => __('Add New Event'),         'edit_item' => __('Edit Event'),         'new_item' => __('New Event'),         'view_item' => __('View Event'),         'search_items' => __('Search Events'),         'not_found' =>  __('Nothing found'),         'not_found_in_trash' => __('Nothing found in Trash'),         'parent_item_colon' => ''     );          $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,         'query_var' => true,         'rewrite' => true,         'capability_type' => 'post',         'hierarchical' => false,         'menu_position' => 7,         'exclude_from_search' => true,         'supports' => array('title','editor', 'custom-fields')           );              register_post_type( 'curiculum' , $args );      }


Add frontend "Restore" link

I am using `get_delete_posts_link($postid)` to let users send their posts to the trash from the frontend. Now I'm trying to replicate the same functionality for them to "untrash" or restore the posts as well. `get_delete_posts_link($postid)` seems to generate a URL like this: http://mysite.com/wordpress/wp- admin/post.php?post=555&action=trash&_wpnonce=0d6fc30f3b And when I go to wp-admin and look at what link the Restore link uses, it looks to be same EXCEPT that is uses action=untrash instead of action=trash. Since there doesn't seem to be a function the mirrors the delete post link function, I thought that perhaps manually creating the URL with variables and using the "untrash" action would do it, but it doesn't seem to work that way, restoring won't work. What's the best way to put a link to "restore" a post on the frontend? EDIT: This is the markup I am using the create the "restore" link (not working):               <?php     $untrashurl = get_bloginfo('wpurl') . '/wp-admin/post.php?post=' . $postid . '&action=untrash';     ?>     <a class="db-post-link" href="<?php echo wp_nonce_url($untrashurl); ?>">Untrash


Add buttons to "teeny" editor

I managed to create a TinyMCE plugin and add it to WordPress editor (which is the same as bbpress). So far so good. Using `$ args ['teeny'] = false;` config, my tinymce plugin’s button show normal. But, I need to be displayed in the default editor for bbpress, in teeny editor. Any ideas?


Can't get Category link inside get_posts

I created a simple function to display the latest posts. Inside the function there is a conditional to display the post category. I found that to display the category name, using               $category = get_the_category($post->post_ID);           $category[0]->cat_name; // I want to display only the first category      do the job, but can't find how to display the link to the category. Tried to use `get_category_link($post->post_ID)` but no changes, the link still redirects to the current page. The goal is to redirect to category archive. Appreciate any help.


Pagination when using multiple loops

I've populated my index.php with various post loops and I want to be able to get pagination working. The reason for multiple loops is because I'm pulling in posts from different categories in different locations. Here's an example (screenshot of the code): ![enter image description here](http://i.stack.imgur.com/3BCu3.png) How do I get a working pagination for this way of using loops? Hope I've explained myself adequately enough, and if anybody needs any more information please let me know. Thanks.


How do I override a parent theme's language files with a child theme?

I have a parent theme and a child theme, I would like to override the spanish .mo and .po files in the parent theme (or add them if they are not present in the parent theme) with the es_ES ones in my child theme. I added the folder with the modified mo and po files in the child theme with the same folder name as in the parent theme but this is not working. How can I come about this? Thanks!


add conditionals to a displayed external xml feed

I found the following code online and customized it to pull the xml feeds from our online calendar software and display event information on several different WP pages.               function otpl_add_class_feed() {         if ( is_page(48) ) {             $url = "http://orion.lib.mi.us/evanced/lib/eventsxml.asp?ag=&et=Computer+Class&nd=31&dm=exml&alltime=1";             $xml = simplexml_load_file($url);             foreach($xml->item as$item)                 {                     echo "
";                     echo "
link."'>".$item->title."
";                     echo "
".$item->date." from ".$item->time." to ".$item->endtime."
";                     echo "
".$item->description."
";                     echo "
link."'>Register Online.
";                     echo "
";                 }         } // END IF     }      How can I include a conditional statement so that if $item->date. is populated the above code will run but if $item->date. is empty then another code stating that there are no events scheduled will run? I'm sure it's something simple but my understanding of syntax isn't very strong. My few attempts have broken my functions page.


Custom meta boxes for different custom post type on multisite WP

I have two custom post type defined ('acting' and 'voiceover') and custom met boxes defined for both of them. I'm able to save, update and delete on the acting custom post type. But if I add the voiceover custom post type then I'll be not able to save the data on the acting anymore. The two piece of code are similar but not the same. I'll need to add more field to the voiceover. After many hours spent in looking for solution and trying many things, I'm asking your help. **Acting custom meta boxes**                  add_action ('admin_init','acting_meta_boxes');                   function acting_meta_boxes() {     add_meta_box( 'reels_form', 'Acting Details', 'reels_form', 'acting', 'normal', 'high' );         }              function reels_form() {     $post_id = get_the_ID();     $reel_data = get_post_meta( $post_id, '_reel', true );     $client_name = ( empty( $reel_data['client_name'] ) ) ? '' : $reel_data['client_name'];     $agency = ( empty( $reel_data['agency'] ) ) ? '' : $reel_data['agency'];     $production_company = ( empty( $reel_data['production_company'] ) ) ? '' : $reel_data['production_company'];     $director = ( empty( $reel_data['director'] ) ) ? '' : $reel_data['director'];     $video_id = ( empty( $reel_data['video_id'] ) ) ? '' : $reel_data['video_id'];            wp_nonce_field( 'acting', 'acting' );     ?>
         YouTube video ID
         <input type="text" value="<?php echo $video_id; ?>" name="reel[video_id]" size="20" />

         Client's Name (optional)
         <input type="text" value="<?php echo $client_name; ?>" name="reel[client_name]" size="80" />

         Agency Name (optional)
         <input type="text" value="<?php echo $agency; ?>" name="reel[agency]" size="80" />

         Production Company (optional)
         <input type="text" value="<?php echo $production_company; ?>" name="reel[production_company]" size="80" />

         Director (optional)
         <input type="text" value="<?php echo $director; ?>" name="reel[director]" size="80" />
          <?php          }              add_action( 'save_post', 'reels_save_post', 10, 2 );              function reels_save_post( $post_id ) {               if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )         return;          if ( ! empty( $_POST['acting'] ) && ! wp_verify_nonce( $_POST['acting'], 'acting' ) )         return;          if ( ! empty( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {         if ( ! current_user_can( 'edit_page', $post_id ) )             return;     } else {         if ( ! current_user_can( 'edit_post', $post_id ) )             return;     }          if ( ! wp_is_post_revision( $post_id ) && 'acting' == get_post_type( $post_id ) ) {         remove_action( 'save_post', 'reels_save_post' );              wp_update_post( array(             'ID' => $post_id,         ) );              add_action( 'wp_inset_post_data', 'reels_save_post' );     }          if ( ! empty( $_POST['acting'] ) ) {         $reel_data['client_name'] = ( empty( $_POST['reel']['client_name'] ) ) ? '' : sanitize_text_field( $_POST['reel']['client_name'] );         $reel_data['agency'] = ( empty( $_POST['reel']['agency'] ) ) ? '' : sanitize_text_field( $_POST['reel']['agency'] );         $reel_data['production_company'] = ( empty( $_POST['reel']['production_company'] ) ) ? '' : sanitize_text_field( $_POST['reel']['production_company'] );         $reel_data['director'] = ( empty( $_POST['reel']['director'] ) ) ? '' : sanitize_text_field( $_POST['reel']['director'] );         $reel_data['video_id'] = ( empty( $_POST['reel']['video_id'] ) ) ? '' : sanitize_text_field( $_POST['reel']['video_id'] );              update_post_meta( $post_id, '_reel', $reel_data );     } else {         delete_post_meta( $post_id, '_reel' );     }         }      **Voiceover custom meta boxes**                   add_action ('admin_init','voiceover_meta_boxes');                   function voiceover_meta_boxes() {             add_meta_box( 'reels_voiceover_form', 'Voiceover Details', 'reels_voiceover_form', 'voiceover', 'normal', 'high' );             }                       function reels_voiceover_form() {             $post_id = get_the_ID();             $reel_data = get_post_meta( $post_id, '_reel', true );             $client_name = ( empty( $reel_data['client_name'] ) ) ? '' : $reel_data['client_name'];             $agency = ( empty( $reel_data['agency'] ) ) ? '' : $reel_data['agency'];             $production_company = ( empty( $reel_data['production_company'] ) ) ? '' : $reel_data['production_company'];             $director = ( empty( $reel_data['director'] ) ) ? '' : $reel_data['director'];             $video_id = ( empty( $reel_data['video_id'] ) ) ? '' : $reel_data['video_id'];               $audio_id = ( empty( $reel_data['audio_id'] ) ) ? '' : $reel_data['audio_id'];                        wp_nonce_field( 'voiceover', 'voiceover' );             ?>
                 YouTube video ID
                 <input type="text" value="<?php echo $video_id; ?>" name="reel[video_id]" size="20" />

                 Soundcloud ID
                 <input type="text" value="<?php echo $audio_id; ?>" name="reel[audio_id]" size="20" />

                 Client's Name (optional)
                 <input type="text" value="<?php echo $client_name; ?>" name="reel[client_name]" size="80" />

                 Agency Name (optional)
                 <input type="text" value="<?php echo $agency; ?>" name="reel[agency]" size="80" />

                 Production Company (optional)
                 <input type="text" value="<?php echo $production_company; ?>" name="reel[production_company]" size="80" />

                 Director (optional)
                 <input type="text" value="<?php echo $director; ?>" name="reel[director]" size="80" />
                  <?php         }              add_action( 'save_post', 'reels_save_voiceover_post', 10, 2 );              function reels_save_voiceover_post( $post_id ) {             if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )                 return;                  if ( ! empty( $_POST['voiceover'] ) && ! wp_verify_nonce( $_POST['voiceover'], 'voiceover' ) )                 return;                  if ( ! empty( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {                 if ( ! current_user_can( 'edit_page', $post_id ) )                     return;             } else {                 if ( ! current_user_can( 'edit_post', $post_id ) )                     return;             }                  if ( ! wp_is_post_revision( $post_id ) && 'acting' == get_post_type( $post_id ) ) {                 remove_action( 'save_post', 'reels_save_voiceover_post' );                      wp_update_post( array(                     'ID' => $post_id,                 ) );                      add_action( 'save_post', 'reels_save_voiceover_post' );             }                  if ( ! empty( $_POST['voiceover'] ) ) {                 $reel_data['client_name'] = ( empty( $_POST['reel']['client_name'] ) ) ? '' : sanitize_text_field( $_POST['reel']['client_name'] );                 $reel_data['agency'] = ( empty( $_POST['reel']['agency'] ) ) ? '' : sanitize_text_field( $_POST['reel']['agency'] );                 $reel_data['production_company'] = ( empty( $_POST['reel']['production_company'] ) ) ? '' : sanitize_text_field( $_POST['reel']['production_company'] );                 $reel_data['director'] = ( empty( $_POST['reel']['director'] ) ) ? '' : sanitize_text_field( $_POST['reel']['director'] );                 $reel_data['video_id'] = ( empty( $_POST['reel']['video_id'] ) ) ? '' : sanitize_text_field( $_POST['reel']['video_id'] );                 $reel_data['audio_id'] = ( empty( $_POST['reel']['audio_id'] ) ) ? '' : sanitize_text_field( $_POST['reel']['audio_id'] );                            update_post_meta( $post_id, '_reel', $reel_data );             } else {                 delete_post_meta( $post_id, '_reel' );             }         }      I'm running the whole thing in a multisite WP environment. I hope somebody can help me to figure it out.


Hide custom image sizes from media library

I want to hide a few custom image sizes from the media uploader: ![enter image description here](http://i.stack.imgur.com/2Qm9q.png) The following code (posted here) works **only** for the default image sizes:               function remove_image_sizes($sizes) {         unset($sizes['image-name']);         return $sizes;     }     add_filter('image_size_names_choose', 'remove_image_sizes');      Is there a similar solution to unset custom image sizes?


Tag page only display 10 posts

I've had a problem with this for quite some time now and cannot for the life of me figure it out. I am using Multi-site and not sure if that has anything to do with it or not, so keep that in mind. # Problem: When clicking on tags on a post or custom post type, I only get the default post count set by WP which is 10 posts as results. Pagination shows at the bottom for next post and older posts, but when I click on either link, page 2 is not found and it sends me to 404 page. There is a mix of regular posts and then custom posts types that should be showing, but regardless the post type, it only shows 10 even though there are hundreds. At first I was using the Twentyten way of showings tags which was using `get_template_part()` and redirecting to a loop.php page. I have sense eliminated that process and created my own tag.php page and use the default wordpress loop to query for posts.               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>      However I had to use this bit of code to query for all posts types and not just the regular ones.               global $wp_query;     $args = array_merge( $wp_query->query, array( 'post_type' => array('post, cool_tools, tribe_events') ) );     query_posts( $args );      My pagination code for the page reads :

<?php next_posts_link( __( '← Older posts', 'twentyten' ) ); ?>

<?php previous_posts_link( __( 'Newer posts →', 'twentyten' ) ); ?>

      The url to the missing page is:               /tag/tagname/page/2/      Can anyone tell me why WP wont find any more tags? ## **Update As per Chip's example, here is how I have it setup now.               $paged = ( get_query_var('paged') ) ? get_query_var('paged') : 1;          $args = array(         'post_type' => 'post',         'tag_slug__and' => $tagname,         'paged' => $paged     );          $query = new WP_Query($args);          if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();      Yet when I click newer posts at the bottom, it still takes me to a 404 page and no page 2 found for tags.


Plugin or script to apply updated media settings to all featured images

I need to know if there exists a script or plugin that will add a button the "Settings > Media Settings" that will rebuild all thumbnails to match the current media size settings. The problem this seeks to solve is when the site owner decides he/she would like different thumbnail and featured image sizes after having uploaded several at the wordpress default settings of 150px, 300px, 1200px This solution would allow users to auto resize the images in one click to match the current settings.


Create a folder if it doesn't already exist

I've run into a few cases with wordpress installs with bluehost where I've encountered errors with my wordpress theme because the uploads folder (wp- content/uploads) was not present. Apparently the bluehost cpanel WP installer does not create this folder, though HostGator does. So I need to add code to my theme that checks for the folder and creates it otherwise.


loop not displaying posts on custom template page

I have a site using a static homepage, and a posts page called Press(`press.php`). The template is being pulled up correctly, however no posts are shown. Any ideas why? Thanks in advance. Live site. **press.php**               <?php     /*     Template Name: Press     */     ?>               <?php get_header(); ?>
         <a href="<?php bloginfo('url'); ?>"><img src="<?php echo get_template_directory_uri(); ?>/img/parlour_side.png" alt="Parlour Salon logo" id="logo" />

             <?php if(have_posts()) : while(have_posts()) : the_post(); ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
                 <?php the_content('read more...'); ?>
<?php the_date(); ?>
             <?php endwhile; ?>             <?php else : ?>
I'm not sure what you're looking for.
             <?php endif; ?>
          <?php get_footer(); ?>


Will deleting WP's code in .htaccess cause problems?

I need to use the following redirect on my site:               RewriteEngine on     RewriteCond %{HTTP_HOST} name.com     RewriteCond %{REQUEST_URI} ^/(1[0-9]{3}|200[0-9]|201[0-3])      RewriteCond %{REQUEST_URI} !/2013/12      RewriteRule ^([0-9]{4})/([0-9]{2})/(.*)$  http://v2.name.com/$1/$2/$3 [NC,R=301]      However, it only works if I delete the code Wordpress put in my .htaccess (I've tried putting it both before and after this code with no luck):               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress      What sort of problems is this going to cause if I delete it permanently? And is there some way around this?


Custom Post Type Rewrite Rule

My theme uses the following code:               'rewrite' => array('slug' => $this->safe_name . '-detail'),      which produces this slug:               http://www.example.com/estate-detail/4-bedroom-property-for-sale/      I need to get rid of the 'estate-detail' part so I changed the rule to just:               'rewrite' => array('slug' => ' '),      This produces the slug as:               http://www.example.com//4-bedroom-property-for-sale/      How do I get rid of the double forward slash?


new_excerpt_more link not working properly

My "Read More" button is linking to the current page page instead of the excerpt page it is suppose to be linking to. Here is my function in function.php file:               function new_excerpt_more($more) {        global $post;     return ' ID) . '"> ...Read More';     }     add_filter('excerpt_more', 'new_excerpt_more');      This is occurring in in excerpts being displayed from a custom walker for wp_list_pages.


Vague Errors from VIP Scanner Plugin

I am building a site with WordPress 3.4.2, have made a child theme of WooTheme's Canvas 5 (http://www.woothemes.com/2012/06/canvas/) and am now using the VIP Scanner plugin (http://wordpress.org/extend/plugins/vip- scanner/). I managed to resolve the majority of the errors outputted for my child theme, but one or two of them are vaguely worded and I cannot figure out a way to solve them:   1. Warning: Possible output of restricted variables   2. Warning: Attribution link missing or not well formatted Any advice? Thanks


How to sort a custom wordpress query by combination of meta values?

I'm trying to build a custom query that's a combination of custom key values. For example, with the code below I'm able to sort my posts by how much money they've received (paidusd) and how much tips they've received (totaltips). This code is working great. But what I'd like to do is add another sort for "most profitable" which would be the ratio of paidusd to totaltips. Where would I perform that division equation? I'm stumped. Any help is greatly appreciated - thanks!!!!               if ( $_GET['sort'] == 'mostexpensive'){         //query_posts('&meta_key=paidbtc&orderby=meta_value');         $args = array(                        'meta_key' => 'paidusd',                        'orderby' => 'meta_value',                        'posts_per_page' => 10,                        'paged' => $paged                        );         query_posts($args);     }          if ( $_GET['sort'] == 'mosttipped'){         $args = array(                        'meta_key' => 'totaltips',                        'orderby' => 'meta_value',                        'posts_per_page' => 10,                        'paged' => $paged                        );         query_posts($args);     }


Display revision if post status is pending

I'm trying to display the latest post revision if the page is "pending", by default the page displays a 404 if it is pending. But I want it to show the latest revision until the page is updated. The code below doesn't seem to display anything but the title, I have used a hook to the `wp_insert_post_data` function which changes the status of the post to "pending" if the users role isn't admin. The post is set to pending in the database, but I cannot get the below code to show the latest revision? I also don't know how to prevent it from redirecting to a 404 page? If I am logged in it will show the post otherwise a 404 page.                   <?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
                                       <?php              echo get_post_status(); //echo's pending             if(get_post_status() == 'pending') {                 $query = new WP_Query(array('post_type' => 'revision', 'post_parent' => '7', 'posts_per_page' => 1)); // 7 is the current page ID                 if ($query->have_posts()) {                                      while ($query->have_posts()) {                                               $query->the_post();                                              the_content();                         echo $post->ID;                     }                 }                 wp_reset_postdata();             } else {                 the_content();              }                            ?>                    <?php endwhile; ?>     <?php endif; ?>      Any advice? Is there an easier way to show the revision if the page is pending? Thanks ! **Edit:** Okay I seem to have it working using the code below:               if(get_post_status() == 'pending') {        $query = 'SELECT ID FROM `wp_posts` WHERE `post_parent` = '.$post->ID.' AND `post_type` = "revision" AND `post_status` = "pending" AND `post_title` <> "Auto Draft" AND TRIM(`post_content`) <> "" AND `post_name` NOT LIKE "%autosave%" ORDER BY `post_modified` DESC LIMIT 1';        $revision_id = $wpdb->get_var($query);        $revision = wp_get_post_revision($revision_id);        $content = $revision->post_content;                      $content = apply_filters('the_content', $content);        $content = str_replace(']]>', ']]>', $content);        echo $content;        wp_reset_postdata();     } else {        the_content();      }      So now the question is - **How can I prevent a page which is set as pending to redirecting to the 404 page?**


Theme deactived html and css styling on home page posts

I'm a designer trying to learn php, so I can't fully understand where the problem is coming from. That being said, I have a theme that has deactivated the use of css styling on the main page where posts are mainly displayed. This is the (f8) lite theme by the way. I want to create links useing divs and what not, but when i throw in the code it dosent show up. But when you enter the post the css is rendered out perfectly. I think the culprit has something to do with the plugin it comes ingrained with called "get the image". And no there arn't any options to turn off the plugin. Please if anyone has any ideas, please fire away. And TIA


Restrict the number of images to upload per post

Is there an easy way to limit to one (per post) the number of images to upload through media upload?


General advice on addressing content-centric pages

I'm looking to port a site into Wordpress that contains not just an About page, but an entire About section with various pages highlighting particular details about the company. Each of these pages vary in terms of layout and content but none are what could be described as being amendable to a custom post type. This is mainly because the site should only have one instance of each of these pages at any given time. So I'm looking for some advice on how to handle pages like these. As far as I know the two options are custom templates and custom post types, but both seem to have drawbacks:   * custom templates would allow the author to make pages and associate them to the appropriate template, but I'd like to add extra metaboxes for certain aspects of these pages. But it seems (correct me if I'm wrong) adding metaboxes to pages would apply them to all pages.   * custom post types - I could define a custom post type for each 'type' of about page. This would give me my metabox flexibility but this seems like a 'heavy' approach. Also, not sure I could establish parent/child pages within a CTP? Any advice on the best approach here? I'm leaning towards CTPs but would love to know of any best-practices for these types of pages. Thanks in advance


Unusual behaviour in my wordpress due to htaccess

I discovered that wordpress/buddypress stopped working (a blank page), and the problem is related to htaccess issues . I found that those lines were added may be automatically (I don't remember adding them) :               <IfModule mod_rewrite.c>     RewriteEngine On          RewriteRule ^wp-admin/includes/ - [F,L]     RewriteRule !^wp-includes/ - [S=3]     RewriteCond %{SCRIPT_FILENAME} !^(.*)wp-includes/ms-files.php     RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]     RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]     RewriteRule ^wp-includes/theme-compat/ - [F,L]          RewriteCond %{REQUEST_METHOD} POST     RewriteCond %{REQUEST_URI} ^(.*)wp-comments-post\.php*     RewriteCond %{HTTP_REFERER} !^(.*)myswebsiteadress.*     RewriteCond %{HTTP_REFERER} !^http://jetpack\.wordpress\.com/jetpack-comment/ [OR]     RewriteCond %{HTTP_USER_AGENT} ^$     RewriteRule ^(.*)$ - [F,L]          </IfModule>      Do you know where those lines come from ? If it is safe to remove them? If not, how can I modify them so wordpress continue working without problems .


Query connected posts from 2 diffrent post types (using posts2posts)

Let's say I've got 3 post types: Posts, agenda and charity. I use the plugin Posts2posts from scribu to connect certain posts and certain agenda items to some charity items. On the single page of charity I want to display posts and agenda in the sidebar. I have two problems: **1st problem:** I want them mixed, but still sorted on date **2nd problem:** I want to display _only_ the posts and agenda items connected to my charity post. It will look something like -Last post item connected to this charity -Last agenda item connected to this charity -Forlast post item connected to this charity -Forlast agenda item connected to this charity When using wp_query, I have no idea how to mix those post types and let them display in the right order, only using connected ones. When using scribu's example, I still have no idea how to mix them... :( Does someone has an idea of how I can do this? * * * **UPDATE** I got the query working with jleander's answer. I used `'orderby' => 'date'` and `'order' => 'DESC'` to display the latest posted item first. But I want to display them alternatly, like: last post last agenda item forlast post forlast agenda item * * * Code after great help of jlaender:
         <?php             $post_types = array('post','agenda');             $connection_types = array('post_to_doel','agenda_to_doel');             $args = array(                 'connected_type' => $connection_types,                 'connected_items' => get_queried_object_id(),                 'post_type' => $post_types,                 'order'  => 'DESC',                 'orderby' => 'date'                 );             $connected_stuff = new WP_Query($args);             if ( $connected_stuff->have_posts() ) :             ?>
Related pages:
                  <?php                  $posts = array();             $agendas = array();             $results = array();             $posts[0] = 'first post';             $posts[1] = 'second post';             $posts[2] = 'third post';             $agendas[0] = 'first agenda';             $agendas[1] = 'second agenda';             $agendas[2] = 'third agenda';             while(!empty($posts) || !empty($agendas)) {                 if(!empty($posts)) {                     $results[] = array_shift($posts);                 }                 if(!empty($agendas)) {                 $results[] = array_shift($agendas);                 }             }             foreach($results as $result){                 echo $result; ?>

                  <?php } ?>                  <?php              // Prevent weirdness             wp_reset_postdata();             endif;         ?>


Add Incrementing ID to each paragraph in the_content

I need to loop through each paragraph in the_content and add an ID to each paragraph with an incremental value.               function incrementparagraphs( $content ) {         for ($i = 0; $i <count($content); $i++) {             return str_replace( "<p>", "<p data-section-id=" . $i . ">", $content );         }     }     add_filter( 'the_content', 'incrementparagraphs', 10, 1 );


Category checkboxes in upload modal

In a project I'm working on, I've enabled categories for attachments using:               register_taxonomy_for_object_type('category', 'attachment');      In the edit attachment screen in the Media Library you see the normal list of checkboxes, but in the upload modal categories are presented as a comma- separated list of slugs in a textfield, as if they were a non-hierarchical taxonomy. I'm wondering if it's possible to replace this textfield with a list of category chechboxes. I'm trying to do it myself, but there is little documentation about the 3.5 upload modal. Any ideas? Thanks in advance


How to publish some default pages in Multisite creation?

In multi site environment, I need to publish some pages by default while creating a new site , is this possible?


Posts Duplicating due to Pagination and Custom Query

I have a custom meta field named “price” and I would like my main query to order the posts from highest to lowest price. Currently I have it setup like this:               <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      query_posts ("orderby=meta_value_num&meta_key=price&order=DESC&paged=".$paged); ?>              <?php if ( have_posts() ) : ?>                  <?php while ( have_posts() ) : the_post(); ?>                      <?php                     get_template_part( 'content', get_post_format() );                 ?>                  <?php endwhile; ?>                  <?php paging_nav(); ?>              <?php else : ?>                  <?php get_template_part( 'content', 'none' ); ?>              <?php endif; ?>      The issue I am running into is having a post duplicate when going to the second page Let’s say I have 6 posts in total and I have it setup to load 3 posts at a time.   1. $100   2. $90   3. $50   4. $50   5. $25   6. $10 It will load the first three posts no problem and in order by price descending. However when I go to the next page to get the next three posts, Post number 3 would sometimes repeat itself as post number 4 and the original post number 4 would not appear and 5 and 6 would follow like intended. How do I prevent the query from repeating post number 3 just because it have the same price value as post number 4 when I go to the next page? Note this only happens about 50% of the time and the order is usually correct. If post number 3 and 4 were different values, this issue would not happen and it would order correctly 100% of the time. The issue lies in the fact that they are the same value and are separated by pagination since I have it setup to only load 3 at a time. When retrieving the second page of posts, the query does not register the fact it already used post 3 and duplicates it as post 4 seeing they have the same price value. I have tried the "pre_get_posts" function as well as the "new Wp_Query" function, the problem still persists.


reducing the amount of wp_query calls

I'm working on a site where we're introducing drop down panels from the menu which will display thumbnails from various tags on the site. Each panel has a left column displaying a featured post, and a right column displaying 6 thumbnails; on each tab then I'm doing two wp_query loops, the first to display the featured post image, and the second to display the 6 thumbnails (with featured post excluded). I'm wondering though if this is the most efficient way of doing things, as there are 10 tabs, so that's 20 uses of wp_query in the main menu. Example code for one of the tabs below:

                  <?php              global $quote_id;             $quote_id=array(); // setup an array to store post ids to exclude from future queries             $argsformainquotes=array(             'posts_per_page' => '1',             'post_status' => 'publish',             'tag' => 'quotes',                       );                       $mainquotes = new WP_Query($argsformainquotes);             while ($mainquotes->have_posts()) : $mainquotes ->the_post();     $idforquote=get_the_id(); $quote_id[]=$idforquote; // add the id of this post to exclusion array             $post_thumbnail_id = get_post_thumbnail_id();         $post_thumbnail_url = wp_get_attachment_image_src( $post_thumbnail_id,'bigfeature'); ?>
<a href="<?php the_permalink();?>" target="_blank"><img src="<?php echo $post_thumbnail_url[0];?>" alt=" <?php the_title();?>"  class="thumblist"  height="240" width="240" />
<a href="<?php the_permalink();?>" title="<?php the_title();?>" class="tablinktitles"><?php the_title();?>

<?php $small_excerpt=get_the_excerpt();echo substr($small_excerpt,0,100);?>

<a href="<?php the_permalink();?>" class="tablinktitles">read more...
<?php endwhile;?>

<?php $argsforquotes=array(             'posts_per_page' => '6',             'post_status' => 'publish',             'tag' => 'quotes',             'post__not_in' => $quote_id,                            );                       $quotes = new WP_Query($argsforquotes);             while ($quotes->have_posts()) : $quotes ->the_post();?>
<?php                             $post_thumbnail_id = get_post_thumbnail_id();         $post_thumbnail_url = wp_get_attachment_image_src( $post_thumbnail_id,'smallfeature' ); ?><a href="<?php the_permalink();?>" target="_blank"><img src="<?php echo $post_thumbnail_url[0];?>" alt=" <?php the_title();?>" height="140" width="140" class="thumblist" />
<a href="<?php the_permalink();?>"><?php $trunctitle=get_the_title();echo substr($trunctitle,0,20);?>...
<?php endwhile;?>

More Quotes...


Redirect year month day postname permalink structure to category postname structure

I have a Wordpress site with a `/%year%/%monthnum%/%day%/%postname%/` permalink structure, and now the client wants it changed to `/%category%/%postname%/`. How do I do a generic redirect for the old permalink structure to the new structure? I checked out https://yoast.com/wp-content/permalink-helper.php, but it creates redirect code for `/%year%/%monthnum%/%day%/%postname%/` to `/%postname%/`, instead of to `/%category%/%postname%/`


trying to use wp_handle_upload with ajax

I've used this tutorial to build an option page form with Ajax. Now, i want to use the wp_handle_upload to upload an image. i tried this http://pastebin.com/35HW8RSZ but with no success. help will be appreciated. Asaf.


How to work with AJAX and Wordpress?

I'm working on my first plugin. I would like to add a follow button for the posts, so the logged in users can follow the authors. I placed the following lines into functions.php               function add_query_vars_filter( $vars ){            $vars[] = "userID";            return $vars;       }     add_filter( 'query_vars', 'add_query_vars_filter' );          // The code to display the button     function show_follow_button() {         $author_ID = get_the_author_meta('ID');         $current_user = wp_get_current_user();         if ( is_user_logged_in() && $current_user->ID != $author_ID ) {             return 'Follow';         }     }          // The update function, I know I have to use array for the ids, it's for only test     $userID = (get_query_var('userID')) ? get_query_var('userID') : false;          if(is_numeric($userID)) {         $current_user = wp_get_current_user();         update_user_meta($current_user->ID, 'following', $userID);     }          // jQuery     $('.follow-user').click(function(e) {         e.preventDefault();         var userID = $(this).attr('href').slice(1);         $.ajax({                      type: "GET",                 url: "index.php",                 data: 'userID='+userID,                 success: function(msg){                     $('.follow-user').html('Followed');                 }                  });     });      After I click to the follow button I see on the net tab: index.php?userID=X, but nothing happens in the database. Where is the problem?


Using a rich text editor for category description?

is it possible in Wordpress to have the category description use a rich text editor rather than a standard text area? If so any idea how to make it use one? Thanks!


Custom random quote widget breaks when used in multiple sidebars

I've created a custom widget and placed it in functions.php. You can see the widget here: http://pastebin.com/3uWpeaFx (I've also created a similar widget that grabs a random image; it's included with the pastebin.) The widget allows users to plug in up to ten blocks of text/HTML, stores them in an array in JS, and displays one at random using JS. These are super simple widgets that are based on the default text widget that ships with WP. (I'm no PHP expert, so there's probably a more elegant way to create them, but they're simple to use, which is what the client needed.) The problem I'm having is this: Using more than one Random Text widget, even on multiple different sidebars displayed on different pages, causes all but the original to return 'undefined'. The text that you put in the box seems to store properly, and is editable through the WP admin interface; but when it comes to displaying it on the front-end, it doesn't echo the text properly. I'm sure it's something simple that I'm missing in the widget...any clues? Thanks!


Nginx WordPress Multisite Rewrite rules

I am having trouble with my rewrite rules with my new nginx install. If I access the image manually like here, incredible.devpreview.co/wp- content/blogs.dir/2/files/2011/05/stockvault-colorful-illustration108811.jpg It shows up But WordPress is looking for it here incredible.devpreview.co/files/2011/05/stockvault-colorful- illustration108811.jpg Here is what is in my nginx config file.               server {          listen   80;     server_name  www.devpreview.co;     rewrite ^/(.*) http://devpreview.co/$1 permanent;          }               server {          listen   80;     server_name devpreview.co *.devpreview.co;          access_log /var/www/devpreview.co/logs/access.log;     error_log /var/www/devpreview.co/logs/error.log;          location / {      root   /var/www/devpreview.co/public/;      index  index.html index.htm index.php;      if (!-e $request_filename) {             rewrite ^.+/?(/wp-.*) $1 last;             rewrite ^.+/?(/.*\.php)$ $1 last;             rewrite ^(.+)$ /index.php?q=$1 last;             }      }           location ~* ^.+\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js)$             {             root  /var/www/devpreview.co/public/;             rewrite ^/.*(/wp-.*/.*\.(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$ $1 last;                  rewrite ^.*/files/(.*(html|jpg|jpeg|gif|png|ico|css|zip|tgz|gz|rar|bz2|doc|xls|exe|pdf|ppt|txt|tar|mid|midi|wav|bmp|rtf|js))$/wp-includes/ms-files.php?file=$1 last;             expires 30d;             break;             }


wp_usermeta key problem

I am trying to add a meta key to wp_usermeta but it does not work at all. The key would get value from a checkbox. I used the code from Wordpress codex tutorial and it's not adding anything. I will show you the code (it's from a woocommerce file, but I am adding this as a standard WordPress user meta data, so it really does not matter). I checked the database and there is no 'giodo' meta key in wp_usermeta. Could anyone show me what I am doing wrong?               <?php            //1. Add a new form element...         add_action('register_form','myplugin_register_form');         function myplugin_register_form (){             $giodo = ( isset( $_POST['giodo'] ) ) ? $_POST['giodo']: '';             ?>
                 <?php _e('First Name','mydomain') ?>
                     <input type="checkbox" name="giodo" id="giodo" class="input" value="<?php echo esc_attr(stripslashes($giodo)); ?>" size="25" />
             <?php         }              //2. Add validation. In this case, we make sure giodo is required.         add_filter('registration_errors', 'myplugin_registration_errors', 10, 3);         function myplugin_registration_errors ($errors, $sanitized_user_login, $user_email) {                  if ( empty( $_POST['giodo'] ) )                 $errors->add( 'giodo_error', __('ERROR: You must include a first name.','mydomain') );                  return $errors;         }              //3. Finally, save our extra registration user meta.         add_action('user_register', 'myplugin_user_register');         function myplugin_user_register ($user_id) {             if ( isset( $_POST['giodo'] ) )                 update_user_meta($user_id, 'giodo', $_POST['giodo']);         }     ?>


Two admins in Users and one in the database?

While moving a client's WP site to a new host (single site, not multi), I found that Dashboard>>Users lists two admin accounts (above the detailed shows All(2) Administrator (2) ) but only shows one in the detailed list below; and only one admin account shows in the wp_users table with the ID of 1. Where is this extra admin account? And how do I remove it? (No need to warn me about security: there are no signs of hacking to the account, and in moving to the new host, all passwords have been changed, security tweaked up, fresh 3.0.4 core files uploaded and the database dump shows only one admin.)


Set custom messages for post update/save

I am trying to make a custom message instead of the default message when i save a post, does anybody know how to do it!