title: Admin top level menu, pointing to an external url

text: I want to create a entirely new top level menu in the admin menu section, and have that be an external link, is this even possible with the current system? The solution that t31os provides in this thread works if you put the link as a submenu under, for example, the dashboard. But this is not what I want to do. Adding an Arbitrary Link to the Admin Menu?


title: Disable (or limit) queries when certain content (or data) is not needed (or showed)

text: Currently I am making a custom design for a site. The problem I'm seeing in Wordpress is about almost all data pulled out from the database. While in certain pages - like front-page.php - it only needs, for example, title, category, two metas and the excerpt, WP gets everything. Hell, the post content is only visible in post-single.php, but instead WP pulls out all the content, tags, guid, tags, etc. where it can (print_r helps a lot). The question is about how to limit Wordpress data pulled out from his queries. I think that I should make a net "WP_Query" (or override it) based on $wpdb and use it for the site, instead of using the default one. Well, at least functions like query_posts, WP_Query and get_posts doesn't allow me to limit the data pulled out. I am also interested in caching the data, because is really small, but this is first. **Update 1:** Tried to "minimize data":                   add_action( 'pre_get_posts', 'disable_main_query' );     function disable_main_query( $query ) {         if( $query->is_main_query() && $query->is_front_page() ) {             add_filter('posts_fields', 'minimized_data');         }     }          function minimized_data($fields) {         global $wpdb;         $fields = "             $wpdb->posts.ID,             $wpdb->posts.post_title,             $wpdb->posts.post_excerpt,             $wpdb->posts.comment_count,             $wpdb->posts.guid,             $wpdb->posts.post_status,             $wpdb->posts.post_name,             $wpdb->posts.post_date,             $wpdb->posts.post_type         ";         return $fields;     }      Mow the default loop is plagued with "Undefined property: stdClass::$post_XXXX" and other things. I think the_post is to blame now, so I'm cheking. **Update 2:** Has expected, it was. Changed the `while` loop for `foreach ($posts as $post)` no more undefined properties, but as earlier I can't _get rid_ of `ob_end_flush() [ref.outcontrol]: failed to delete buffer zlib output compression`. **Update 3:** `define( 'SAVEQUERIES', FALSE );` and no more failed buffer (for WAMP).


title: Does releasing a plugin under the AGPL force people to open source their whole WordPress installation?

text: I'm thinking about releasing a plugin under the AGPL license. Would this force people to make public the source code of _other_ unrelated parts of their WordPress installations? (I've tried to read the AGPL license but I'm not sure.) For example, if they install my AGPL plugin, would they have to make available the source code for any other plugins and themes they've installed? (Which are probably licensed under the GPL.) Would it have any legal effects if I publicly stated that I, the copyright holder, don't consider other plugins and themes and WordPress being part of a combined work? (If other pugins etcetera were not part of a combined work, other people would not have to publish source code for their other plugins etcetera.) (PS. Since most people aren't lawyers, I'd take any advice with a grain of salt :-) )


title: How do you remove hard coded thumbnail image dimensions?

text: How can I remove the width and height attributes from the post_thumbnail when inserting with `<?php the_post_thumbnail(); ?>`?               <img width="800" height="533" src="http://domain.com/wp-content/uploads/2011/02/image.jpg" class="attachment-post-thumbnail wp-post-image" />


title: Wordpress "Page not found error" when I edit a page

text: On a Wordpress based website, when I add text using wordpress visual editor or HTML source to a particular page - it gives "page not found error". I tried by adding some other text and its working fine. Then I typed all the text again and in between kept checking if it is giving any errors. Finally I am able to point to the exact word that is causing problem - from. If I put frm , rom or from it works. Only when I use "from" - it gives page not found error. Another thing, the error is only this page not on any other page. I have used "from" on many other pages and there is no problem at all. Its a client website and I do not have access to the server. I only have wordpress login/password. Any help would be appreciated. Update: I even tried HTML entities and it does not work. Right now we are using "fróm" instead of "from" as a workaround.


title: using the loop with a custom table

text: I have a table in my WordPress db called wp_featuredposts. How can I make a query to output the posts in that table into the loop on a custom wordpress page template?


title: Ajax function returns -1

text: I have a question. I made a simply ajax function. When I'm logged in, it works perfectly. When I'm logged out, it returns me -1 (since Wordpress 3.1) Why ? I don't understand. Precisely, it returns -1 and my entire HTML code. (lol) I'm gonna be crazy again. **PHP (in functions.php)**               function say_coucou(){     check_ajax_referer( 'hello', 'nonce' );     echo "Hello";     die(); // this is required to return a proper result     exit;     }     add_action('wp_ajax_hello_hello', 'say_coucou');     add_action('wp_ajax_nopriv_hello_hello', 'say_coucou');      * _JAVASCRIPT / JQUERY / AJAX (in footer.php) *_               function blabla(){         var toSend = {           action:"hello_hello",           post_id: "<?php echo $wp_query->post->ID; ?>",           nonce: "<?php echo js_escape( wp_create_nonce('hello')); ?>"         };         url_action = 'http://www.***********/wp-admin/admin-ajax.php';         $.ajaxSetup({cache:true});         $.ajax({           url: url_action,           type:'POST',           data: toSend,           cache: false,           success:function(results)           {             alert(results)           }          });      }       Any help, please ? Thanks.


title: How to add taxonomy in menus?

text: * Book (Custom Post Type)      * Fiction (Tax)      * Science (Tax)      * History (Tax)  ----------OR-----------    * Book      * Genre (Tax)        * Fiction (Term)        * Science (Term)        * History (Term) Which of these is "good way" of doing it? With the former one( which is what i have currently in my admin menu, i've 'register_taxonomy' functions for each of them ) i can't choose the 'Tax' to show in menus. Whereas with the later one i can add them to menus and need only one 'register_taxonomy' function.


title: How to limit WordPress pages during updates?

text: I will be doing upgrades to the design and content of my Wordpress site. During this time I only want the homepage to be available. Is there a good way to lock this down (through a plug-in, etc.). I'm having trouble coming up with answers from Google. Thanks, Jason


title: How to create an user defined page?

text: I have created a file example.php in the default site directory. I want to have the facilities of an Dashboard-Created-Page like the theme,navigation bar,navigation bar, header,footer etc..


title: how do I determine which image is the featured image in the database

text: I've queried all children of the post, and two records are shown. This is ok because there are 2 images in the gallery, but I can see no field in the database which makes it clear which one is the featured image. I have joined the wp_postmeta table also, but there is no meta_key which indicates which of the 2 is the featured image. Note: I do not want to look in the admin panel, I need a programmatic way to determine from the current database setup. **Does anyone know how the system knows which is the featured image in the db?**


title: Order posts using a custom array

text: I have an array of post ids which I'm passing to query_posts using 'post__in'. My question is how can I use the order from my array rather than ordering by 'date' etc?


title: Override custom menu widget

text:
I would like to override some mark-up and css (like `<div class="soma_container"><ul class=""></ul></div>`)styling on a chosen custom menu widget. How would I do that? Should be hooked as the main navigation in `functions.php` or if there is good tutorial on this would be really appreciated I think a some of the thing I can make on widget poition init                 register_sidebar(array(         'name'          => __('Sidebar Menu', 'roots'),         'id'            => 'sidebar-primary',         'before_widget' => '
',         'after_widget'  => '
',         'before_title'  => '
',         'after_title'   => '
',       ));      but how would override the list css for the custom menu


title: How to validate this deprecated function

text: I want to validate this deprecated function:               add_filter('user_has_cap', array(&$this, 'filter_user_has_cap'), 10, 3);      It needs to use roles or capatibilies, so I guess 10 is the admin level, so I could use "edit_pages":               add_filter('user_has_cap', array(&$this, 'filter_user_has_cap'), 'edit_pages', 3);      But what is argument "3"? Thank you Oliver


title: Adding nofollow to a PHP generated Nav

text: if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly          global $wp_query;          if ( $wp_query->max_num_pages <= 1 )         return;     ?>     <nav class="woocommerce-pagination">         <?php             echo paginate_links( apply_filters( 'woocommerce_pagination_args', array(                 'base'         => str_replace( 999999999, '%#%', get_pagenum_link( 999999999 ) ),                 'format'       => '',                 'current'      => max( 1, get_query_var( 'paged' ) ),                 'total'        => $wp_query->max_num_pages,                 'prev_text'    => '←' ,                 'next_text'    => '→',                 'type'         => 'list',                 'end_size'     => 3,                 'mid_size'     => 3             ) ) );         ?>      </nav>      I need to add _Nofollow_ to the list items generated in this PHP script. How would i go about doing that?


title: Allow anonymous user to access Themes Customizer

text: i create a themes and use themes customizer, is there any way i can give anonymous user access to themes customizer without ability to save it? it will be very convenience in term of user experience if user able to know what kind of themes customizer we offer and how they can change it. Thank you


title: Walker_Nav_Menu doesn't work in wp_page_menu_args filter

text: I need to hide certain nav items from the menu (based on the password protection functionality) and I'm having trouble getting my custom Walker to work. In fact, I can't even get the standard Walker_Nav_Menu to work when I add it via a filter. I've created a plugin as follows:               <?php     function myplugin_page_menu_args( $args ) {         $args['walker'] = new Walker_Nav_Menu;         return $args;     }          add_filter( 'wp_page_menu_args', 'myplugin_page_menu_args' );     ?>      There's no other code in the plugin file, just those 6 lines. I've added this plugin to a brand new install of WordPress (http://dev.matt- howe.co.uk/wordpress/) and the menu rendering is completely broken - all the items are on the same level, and none of them have any text. The right number of `<li>` elements are generated, and the ids are correct, but the rest is wrong. I've tried using a custom class with a .walk() method, as so:               class myplugin_walker {         function walk ( $elements, $to_depth ) {             return 'test';         }     }          function myplugin_page_menu_args( $args ) {         $args['walker'] = new myplugin_walker;         return $args;     }          add_filter( 'wp_page_menu_args', 'myplugin_page_menu_args' );      This works exactly as expected - the menu renders as 'test'. But trying to use either my own class which extends `Walker_Nav_Menu`, or the core `Walker_Nav_Menu` class itself, results in a flat list of empty `<li>` tags. I've tried a few other ways to achieve the same result - I've tried adding filters for `wp_nav_menu_objects` and `wp_get_nav_menu_items` but neither of my functions seem to get called at all. Am I barking up the wrong tree here - is this something that won't work as part of a plugin, and needs to be elsewhere in the code? Or am I just missing something obvious?


title: Is there a quick way to view the wp-cron schedule

text: I'm trying to work which plugin is triggering wp-cron. I know about the code: http://codex.wordpress.org/Function_Reference/wp_get_schedules , but I'd prefer to do something in the sql backend rather than write a plugin.


title: Add Input Field in Simple Model Contact Form (smcf) plugin

text:
I am using nice SMCF (Contact Form) want to add a wordpress post list Drop Down menu in "Simple Model Contact form" here what i added on line '195' to try look.               $output .= "
*" . __("Message", "smcf") . ":              <select name="">       <option>Post1</option>       <option>Post2</option>       <option>Post1</option></select>

";      after saving / uploading file, it showing               Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in plugins/simplemodal-contact-form-smcf/smcf.php on line 201      please help me how to get post list in form. ?


title: I need a custom search page to lead to search.php but it goes to index.php

text: I built a custom search page with a form like:               <form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>">      trouble is I want the results to appear in search.php whereas I m led to index.php How can I force to always go to search.php ?


title: How to use multiple database in wordpress?

text: I want to fetch some post from another wordpress site which is hosted in the same server. How can I fetch those post? Is multiple database connection is possible in wordpress?


title: Use safety filters even if after applied intval?

text: I have some values to save into postmeta and usermeta table. Before save, I already done this: `$value = intval($value)` . I think this is enough. But I see some plugins still use filters on those numbers. I want to make sure that I can do with `intval` and without safety filter.


title: Wrap the "show_post_count" between div

text:
How can I wrap the "show_post_count" between a div? (from the wp_get_archives())   Do I need to edit the function for that? Or could I do something like this with pseudo css?
         March 2012 (1)
      Css:               .post_count a:after (all the content in the div and after the .post_count){      float: right;     }


title: How to add custom button to new media upload interface

text: I am developing a plugin and i want to add my own button to the wordpress media upload interface (WP version 3.5). Right next to the standard 'insert into page' button, i want my button to be there, let's call it 'insert special image'. Can anyone point me in the right direction, where should i look? which WP source files are defining the functionality of this button? Basically my 'insert special image' button should do pretty much the same thing like the standard 'insert into page' button - take an attachment and insert it into post, only with some added data.


title: Running a python script within wordpress

text: I have a WordPress install for a personal blog and I'm gradually porting all of the little web bits I have written over the years to pages on the blog. One such page is http://www.projecttoomanycooks.co.uk/cgi- bin/memory/majorAnalysis.py which is a simple python script that returns a list of words - I'd like to embedd that behavior within a wordpress page - could someone point me in the right direction for the easyist way of running a spot of python within wordpress? EDIT - following the wonderful answer below, I have got a lot futher... but unfortunately still not quite there... I have python that executes on server...               projecttoomanycooks server [~/public_html/joereddington/wp-content/plugins]#./hello.py      Hello World!      and it's in the same directory as the activated plugin... The python code... which has the following code...               #!/usr/bin/python     print("Hello World!")      The php:               <?php     /**      * Plugin Name: Joe's python thing.      * Plugin URI: http://URI_Of_Page_Describing_Plugin_and_Updates      * Description: A brief description of the Plugin.      * Version: The Plugin's Version Number, e.g.: 1.0      * Author: Name Of The Plugin Author      * Author URI: http://URI_Of_The_Plugin_Author      * License: A "Slug" license name e.g. GPL2      */     /*from http://wordpress.stackexchange.com/questions/120259/running-a-python-scri     pt-within-wordpress/120261?noredirect=1#120261  */     add_shortcode( 'python', 'embed_python' );          function embed_python( $attributes )     {         $data = shortcode_atts(             array(                 'file' => 'hello.py'             ),             $attributes         );         $handle = popen( __DIR__ . '/' . $data['file'], 'r');         $read   = fread($handle, 2096);         pclose($handle);              return $read;     }


title: Media (images, videos, etc.) not showing on Category page

text:
I'm having a problem where media isn't showing up on the Category page. (It's actually the exact same problem that's described in this WordPress.org forum post, but it's so out of date that the solution doesn't appear to apply anymore.) I've checked `category.php` and I'm guessing it's something to do with `<?php get_template_part( 'entry' ); ?>` ? I'm using the Blankslate theme. Contents of `entry.php`:               <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>          <?php if ( is_singular() ) { echo '
'; } else { echo '
'; } ?><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" rel="bookmark"><?php the_title(); ?><?php if ( is_singular() ) { echo '
'; } else { echo '
'; } ?> <?php edit_post_link(); ?>     <?php if ( !is_search() ) get_template_part( 'entry', 'meta' ); ?>          <?php get_template_part( 'entry', ( is_archive() || is_search() ? 'summary' : 'content' ) ); ?>     <?php if ( !is_search() ) get_template_part( 'entry-footer' ); ?>
      Thanks for any help!


title: Remove metabox from specific page template in admin

text: I would like to programatically remove some meta boxes when a user is editing a specific page in the admin. The page itself is using a template (tpl- about.php). I know I can remove all meta boxes from all pages with this function:               function remove_post_meta_boxes() {      if(!current_user_can('administrator')) {       remove_meta_box('tagsdiv-post_tag', 'post', 'normal');       remove_meta_box('categorydiv', 'post', 'normal');       remove_meta_box('postimagediv', 'post', 'normal');       remove_meta_box('authordiv', 'post', 'normal');       remove_meta_box('postexcerpt', 'post', 'normal');       remove_meta_box('trackbacksdiv', 'post', 'normal');       remove_meta_box('commentstatusdiv', 'post', 'normal');       remove_meta_box('postcustom', 'post', 'normal');       remove_meta_box('commentstatusdiv', 'post', 'normal');       remove_meta_box('commentsdiv', 'post', 'normal');       remove_meta_box('revisionsdiv', 'post', 'normal');       remove_meta_box('authordiv', 'post', 'normal');       remove_meta_box('slugdiv', 'post', 'normal');      }     }     add_action( 'admin_menu', 'remove_post_meta_boxes' );      But I need to do this for a specific page only. So how can I test on what template is being displayed in the admin?


title: 404 error using Meta for Permalink rewrite

text: I'm trying to rewrite my permalinks using meta data from my post. The permalink rewrite works fine but I'm getting the 404 error when I try to view the post. Could someone offer a clue as to why this wouldn't work?               add_action('init', 'new_rewrite');     function new_rewrite(){        add_rewrite_tag("%mls%", '([a-zA-Z0-9])');     }          add_filter('post_link', 'mls_permalink', 10, 3);     add_filter('post_type_link', 'mls_permalink', 10, 3);          function mls_permalink($permalink, $post_id, $leavename) {         if (strpos($permalink, '%mls%') === FALSE) return $permalink;              $post = get_post($post_id);         if (!$post) return $permalink;              $mls = get_post_meta($post->ID, 'mls_number', true );         if (!is_wp_error($mls) && !empty($mls)) $mls_slug = $mls;         else $mls_slug = '';              return str_replace('%mls%', $mls_slug, $permalink);     }


title: Appending code to the_content

text: I'm trying to append some php code to `the_content` in a custom loop. I do not want to add a function because I only want to append the code to one instance of `the_content`, not throughout the whole site. I'm using the Read More Right Here plugin to enable viewers to read a whole post (after clicking the more tag) that displays on the page (without going to single post). And I'm using the Advanced Custom Fields plugin to output some content (when a check box is ticked in the back end) that I want to display at the end of each post. If I place my code to output the check box data AFTER `the_content` in my template, the info is displayed underneath the more tag. My aim is to append this to the bottom of `the_content` so that it is hidden (along with the rest of the post after the more tag) until you click 'read more' (and the rest of the post is revealed). The code I am trying to append to the end of `the_content` is:               <?php     if( in_array( 'frazer-barton', get_field('who_specialises') ) )     {     echo '';     }     if( in_array( 'sarah-simmers', get_field('who_specialises') ) )     {     echo '';     }     else {     echo '';     }     ?>      I am not a PHP developer so any help on this is hugely appreciated.


title: How do I remove inline style in featured image markup?

text: When I create featured images, the markup that wordpress produces has inline css. The image tag for the image has width and height parameters. This is very frustrating: I'd like to control the image style with my own css. How can I remove the inline style?


title: Extra Text in URL

text: I'm redesigning my website. The blog posts and everything were fairly easy to move to the new wordpress install. The URL of the test site is this: http://www.NathanTornquist.com/wordpress When I go to that URL I have this URL show up in the address bar: http://www.NathanTornquist.com/NathanTornquist/wordpress but when I hit the home button at any time the site goes to NathanTornquist.com/wordpress as it should. What do I need to do to correct this behavior?


title: How do I prefix blog post urls as mysite.com/blog/%postname%/ but allow authors to still be located at mysite.com/authors/%nicename%?

text: I've tried a bunch of things but cannot find a solution that works. I want my site to have the structure:               mysite.com/ = homepage     mysite.com/blogs/ = blog archive     mysite.com/blogs/year/ = blog archive (in a specific year)     mysite.com/blogs/year/month/ = blog archive (in a specific month)     mysite.com/blogs/year/month/postname = blog post     mysite.com/authors/ = authors archive     mysite.com/authors/nicename = author profile     mysite.com/customposttype/ = custom post type archive     mysite.com/customposttype/postname = custom post type post      Currently, with `/blogs/%year%/%month%/%postname%/` set as the permalink structure, everything works correctly except the authors part. It forces it to `mysite.com/blogs/authors/` and `mysite.com/blogs/authors/nicename`, which is not desireable, since most authors will be making custom post types and not blogs. Some posts I checked here but without the right answer: How to properly prefix blog post URL's Permalinks Question: Adding a prefix ONLY in front of the posts Possible to change the URL for the regular post type without affecting the URL of other custom post types?


title: How can I safely increase the character limit for post passwords?

text: When I want to protect a post on one of my blogs, I like to use a passphrase instead of a password (albeit purely for the sake of creativity, not security — they're stored plainly anyway). However, these passphrases often get very long, and when I enter a passphrase that's too long, it gets silently truncated to 20 characters, much to my disdain. Looking in the `wp_posts` table, I see that the `post_password` column is a `VARCHAR(20)`. That explains the arbitrary truncation, but at the same time it raises a concern: if I want to increase the character limit so I can use longer post passwords, it would have to involve altering `wp_posts.post_password`, besides possibly overriding any validation or processing routines (which is trivial by using filter hooks). Altering the column directly using SQL doesn't seem like a smart idea. Is there a safe way to increase the maximum character limit for post passwords, that won't cause problems with my database when it comes to things like upgrades? (Better still if I can turn this functionality into a plugin, as I don't see such a plugin available yet...)


title: get_permalink() always returns empty

text: I suddenly have a bug in my plugin, and I don't know what on earth could be causing it. This code is failing because `get_permalink()` is returning empty at all times:               $select = "SELECT * FROM `".DB_NAME."`.`wp_posts` WHERE `post_status` = 'publish'";     $result = mysql_query($select);     while($meta_posts = mysql_fetch_array($result, MYSQL_ASSOC) ){         $menu .= "<option value=\"".get_permalink($meta_posts['ID'])."\">".$meta_posts['post_title']."</option>\n";     }      It used to work just fine, all it does is return a dropdown menu of all the published WP posts/pages. Now I get the dropdown full of titles, but there is no permalink in the option value. Anyone have any ideas why `get_permalink()` would be empty? I've even tried hardcoding a known postid into it, and it's still empty.


title: Are Nonces Useless?

text: This is probably a noob question BUT hear me out - isn't the point of using Nonce to protect from things like scrappers (phpcurl scrappers etc.)? But my Nonce prints out in the head of the document like so:               /* <![CDATA[ */     var nc_ajax_getpost = {         ...stuff...         getpostNonce: "8a3318a44c"     };     /* ]]> */      So if I was building a quick scrapper I would just get the nonce value from that page and then use it in my POST...making the whole exercise of using a Nonce useless... What am I missing here?


title: Custom meta boxes not saving

text:
I am trying to create a custom meta box with 12 fields. there are 3 groups of 4 fields so i am using a for loop to create them to save on typing etc. for some reason i can't seem to get them to save. i am not sure if my coding is correct? i checked to see if they were being saved by doing a var dump of `var_dump($linktext[1]);` to see if it was being saved and that returned null. this is the call back for the add metabox to output the fields in the back end in the meta box:               function home_callout_meta_box_cb($post) {         global $post;         wp_nonce_field('home_callout_nonce', 'home_callout_meta_box_nonce');         $values = get_post_custom($post->ID);              for ($i = 1; $i <= 3; $i++) {                  $imagefield1[$i] = isset($values['imagefields'][$i]) ? esc_attr($values['imagefields'][$i]['image1'][0]): '';             $imagefield2[$i] = isset($values['imagefields'][$i]) ? esc_attr($values['imagefields'][$i]['image2'][0]): '';                  $linktext[$i] = isset($values['linktext'][$i]) ? esc_attr($values['linktext'][$i][0]): '';             $link[$i] = isset($values['link'][$i]) ? esc_attr($values['link'][$i][0]): '';                       echo '
Call out box ' . $i .' image 1
';             echo '
';             echo '<input type="text" id="imagefields'. [$i] . '[image1]" name="imagefields' . [$i] . '[image1]" class="upload-url image_url" readonly="readonly" value="' . $imagefield1[$i] .'" />';             echo '<input id="st_upload_button" class="st_upload_button button-secondary upload_image" type="button" name="upload_button" value="Upload" />';             echo '
';                  echo '
Call out box ' . $i .' image 2
';             echo '
';             echo '<input type="text" id="imagefields' . [$i] . '[image2]" name="imagefields' . [$i] . '][image2]" class="upload-url image_url" readonly="readonly" value="' . $imagefield2[$i] .'" />';             echo '<input id="st_upload_button" class="st_upload_button button-secondary upload_image" type="button" name="upload_button" value="Upload" />';             echo '
';                  echo '
Call out box ' . $i .' link text
';             echo '<input type="text" id="linktext' . [$i] . '" name="linktext' . [$i] . '" value="' . $linktext[$i] . '" />';                  echo '
Call out box ' . $i .' link
';             echo '<input type="text" id="link' . [$i] . '" name="link' . [$i] . '" value="' . $link[$i] . '" />';              }     }      and this is my save function:               function home_callout_save($post_id) {         if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;         if(!isset($_POST['home_callout_meta_box_nonce']) || !wp_verify_nonce($_POST['home_callout_meta_box_nonce'], 'home_callout_nonce')) return;         if(!current_user_can('edit_pages')) return;              if(isset($_POST['imagefields'])) {             update_post_meta($post_id, 'imagefields', $_POST['imagefields']);            }              if(isset($_POST['linktext'])) {             update_post_meta($post_id, 'linktext', $_POST['linktext']);         }         if(isset($_POST['link'])) {             update_post_meta($post_id, 'link', $_POST['link']);         }     }     add_action('save_post', 'home_callout_save');      i think ive been staring at this same code for so long i think it might be a small mistake ive made and can't seem to see it. thanks for reading and any help is very much appreciated. **Edit:** here is what i get from a vardump of $values['linktext'] string(75) "a:3:{i:1;s:11:"link text 1";i:2;s:11:"Link 2 text";i:3;s:11:"Link 3 text";}" i cant see how to put that returned value into the fields


title: How to remove in the wordpress database all posts revisions except the last three?

text: here is the commonly recommended sql command for removing posts revisions and cleaning up the wp database:               DELETE a,b,c     FROM `wp_posts` a     LEFT JOIN `wp_term_relationships` b ON (a.ID = b.object_id)     LEFT JOIN `wp_postmeta` c ON (a.ID = c.post_id)     WHERE a.post_type = 'revision';      how can i modify it to keep let's say the last 3 revisions ?


title: Why aren't my posts/pages showing up in my WordPress Theme?

text:
i built a custom wordpress theme, and for some reason don't know why the posts/pages are not showing up in the theme, but they show up in all other themes. Here is the index.php code:               <?php get_header( ); ?>

                  <?php if ( have_posts() ) : ?>                 <?php /* Start the Loop */ ?>                 <?php while ( have_posts() ) : the_post(); ?>                     <?php get_template_part( 'content', 'page' ); ?>                 <?php endwhile; ?>                 <?php twentyeleven_content_nav( 'nav-below' ); ?>             <?php endif; ?>

 Cafe Coyote

 (619)291-4695

 3:30PM to 6PM:      $2 tacos, $3 beers & $4 margaritas.

 Cafe Coyote

 (619)291-4695

 3:30PM to 6PM:      $2 tacos, $3 beers & $4 margaritas.

         <?php get_sidebar( ); ?>

      <?php get_footer( ); ?>                here is the page.php code:               <?php get_header( ); ?>

         <?php the_post(); ?>         <?php get_template_part( 'content', 'page' ); ?>         <?php get_sidebar( ); ?>

      <?php get_footer( ); ?>


title: WordPress is stripping escape backslashes from JSON strings in post_meta

text: I thought I was making my life easy and being future-conscious by saving some content as bits of JSON in custom post_meta fields. Unfortunately, WordPress doesn't agree and is making my life incredibly difficult. I have a JSON string that looks essentially like this. This is just one bit, and the comment string is just some dummy unicode entities. The whole thing is generated w/ json_encode.               {         "0": {             "name": "Chris",             "url": "testdomain.com",             "comment": "\u00a5 \u00b7 \u00a3 \u00b7 \u20ac \u00b7 \u00b7 \u00a2 \u00b7 \u20a1 \u00b7 \u20a2 \u00b7 \u20a3 \u00b7 \u20a4 \u00b7 \u20a5 \u00b7 \u20a6 \u00b7 \u20a7 \u00b7 \u20a8 \u00b7 \u20a9 \u00b7 \u20aa \u00b7 \u20ab \u00b7 \u20ad \u00b7 \u20ae \u00b7 \u20af \u00b7 \u20b9"         }     }      Unfortunately after I save it with `update_post_meta`, it comes out looking like this:               {         "0": {             "name": "Chris",             "url": "testdomain.com",             "comment": "u00a5 u00b7 u00a3 u00b7 u20ac u00b7 u00b7 u00a2 u00b7 u20a1 u00b7 u20a2 u00b7 u20a3 u00b7 u20a4 u00b7 u20a5 u00b7 u20a6 u00b7 u20a7 u00b7 u20a8 u00b7 u20a9 u00b7 u20aa u00b7 u20ab u00b7 u20ad u00b7 u20ae u00b7 u20af u00b7 u20b9"         }     }      And with the slashes stripped, it can't be `json_decode`d back into useful content. Any ideas why WordPress might be doing this, and if there is a way to avoid it? I can't use the JSON_UNESCAPED_UNICODE flag because this is a PHP 5.3.x install, and I've already tried encoding with `htmlentities` before the content is passed to `json_encode`, but that only captures a small subset of UTF-8 entities. Thanks in advance! (EDIT: FWIW, I know I could just save an array directly to post_meta and it'd be serialized and magic would happen but I just like the idea of having the data stored as JSON. If there isn't an easy, elegant solution I'll cave, but I'm very much hoping there _is_ an easy, elegant solution!)


title: Display selected category on post page

text: Lets assume that we have a post which belongs to 2 or more categories and we wish to display, on the post page, the selected category through which we reached to the post page. What is the best method? Keep the category id in a session or in a querystring temporarily? Or any other? THX


title: Pulling posts tagged with similar title name

text: I'm trying to pull in posts in a page that are tagged with the same page title. For example, if the page is called Banana Pants, then I can call all associated posts manually like this:                   <?php         query_posts( array(         'tag_slug__in' => array('Banana Pants')         ));          while (have_posts()) : the_post (); ?>      However, I'd like to do this automatically. When I try to place it as a variable, it doesn't work:                   <?php         var $project_title = the_title();         query_posts( array(         'tag_slug__in' => array($project_title)         ));          while (have_posts()) : the_post (); ?>      What am I doing incorrectly? Or, is there a better method?


title: Conditional tag is_page with a custom post type

text: Accordingly to the is_page documentation, supplying the slug as an argument WP can tell me whether the current page is the one represented by the slug. Perhaps I am using the wrong slug? However I did try both the path used in the rewrite argument as well as the bit I consider to be the "slug" or in other words the element used to register the CPT. Please find below a code snippet to let you understand:               'rewrite'               => array( 'slug' => 'faqs/archivio' )       );          register_post_type( 'faqs', $args );      I did this a go using the slug used for a custom post type, but I wasn't able to get this working. So two questions?   1. Is the is_page supposed to work in this case?   2. if not, what the best alternative? Thanks Andrea


title: Custom/separate categories for custom post type

text: How can I achieve a separate "data space" for the categories of my custom post type? I don't want the general post categories to appear in my custom post type and vice versa. The `register_taxonomy` function seems to add a "tagging system" (bottom panel in the screen) to the post type but not the same small window the "real" categories have (upper panel in the screen). ![custom categories vs custom tags](http://i.stack.imgur.com/YTd0x.png)


title: How to handle parent and child pages?

text: I want to list episodes of a series I am making of instructional videos with content. The patent page "series" will list episodes weekly. Ie: episodes 1, 2, etc. I'm thinking to setup a template to loop through the series parent page to display the episodes children content in a loop. Then on each series page there will be 3 panels. A long one with the video and other episodes thumbnails, one on the left and one on the iught with content. Just trying to work out how to display the children > children post content as above. Problem 1: displaying related thumbnails to other children? Problem 2: displaying the 3 panels. Do I set these up as individual children elements? If so, how can I style each one differently as it loops through? Any code examples would be amazing! Unless there's a plugin for this? Thanks!


title: Wrap all default widget into div tag

text: I want wrap all default widget into a div tag, so i can add a suffix class to define style for each widgets               <div class="suffix-class">      // widget     </div>      And in widget form, we have a input field to input this class. It like module of joomla. What can we do ? override all default widget ?


title: W3 Total Cache debug shows page caching not working, DB and Object caching works

text: I have nginx, apc running on my server and configure nginx according to this tutorial: http://codex.wordpress.org/Nginx I installed and activated w3 total cache and was done with all setting with no error displayed in the wp3 total cache admin page. I enabled the debug mode to check if caching worked on the front end. However, no matter how I tweaked the w3 total cache setting, only "W3 Total Cache: Db cache debug info" and 'W3 Total Cache: Object Cache debug info" are displayed in the source code of a page(whater page I tried). I just did not see the "Page cache info" being displayed. **But the /wp-content/cache/ folder, cache files were generated.** **Checks** :   * Server: ngxin 1.0.15, PHP 5.3.3 (Hosted in my unmanaged vps)   * nginx configuration file .conf file is in place with all the rules needed for W3 Total cache. (Pretty permalinks are working.)   * W3 Total Cache plugin itself not showing any warning or error.   * No other cache plugin enabled.   * Also made sure I'm checking the correct site.   * wp-config.php file has define('WP_CACHE', true);   * Theme has wp_footer() in footer.php **Compatibility Test:** > Server Modules & Resources: >   >   >     Plugin Version: 0.9.4 >     PHP Version: 5.3.3; >     Web Server: nginx >     FTP functions: Installed (required for Self-hosted (FTP) CDN support) >     Multibyte String support: Installed (required for Rackspace Cloud Files > support) >     cURL extension: Installed (required for Amazon S3, Amazon CloudFront, > Rackspace CloudFiles support) >     zlib extension: Installed (required for compression support) >     Opcode cache: Installed (APC) >     Memcache extension: Not installed >     HTML Tidy extension: Not installed (required for HTML Tidy minifier > suppport) >     Mime type detection: Installed (Fileinfo) (required for CDN support) >     Hash function: Installed (hash) (required for NetDNA / MaxCDN CDN purge > support) >     Safe mode: Off >     Open basedir: Off >     zlib output compression: Off >     set_time_limit: Available >   > > Additional Server Modules >   >   >     New Relic >     PHP version: Supported >     Operating System: Supported >     Web Server: Not Supported. (nginxcgi-fcgi See NewRelic Requirements > page.) >   > > WordPress Resources >   >   >     /home/micbus/public_html/micbus_w3-total-cache.conf: OK >     /home/micbus/public_html/wp-content: OK >     /home/micbus/public_html/wp-content/uploads/2014/04: OK >     Fancy permalinks: /%postname%/ >     WP_CACHE define: Defined (true) >     URL rewrite: Enabled >     Network mode: No >   Clicked "emtpy all caches" several times, switched page cache mode between basic and enhanced for a couple of times, but page cache debug info was still not shown. Could anyone please tell me whether page caching is working? If not, how to fix this?


title: How to restrict Front-End Editor on a page?

text: I am working on a site where the user can do everything from the front end. I am using the plugin from scribu called front-end editor. My problem, is that I have a dashboard page with all the options for the user and I do not want the user to be able to edit it. How do I restrict a page from being able to be edited by Front-End Editor. I have read the wiki on github for it here https://github.com/scribu/wp-front-end-editor/wiki/Actions-and-filters and can't find anything about restricting pages. Only categories.


title: How to make my feed tidy

text: I looked up 'how to get the rss feed for your wordpress blog' ...and discovered I just need to add /feed to the url of my blog. So that's this: http://richardclunan.com/blog/feed/ It looks really messy though. What do I need to do to make it tidy? Or is there another way to get a feed url for my blog that will already be tidy?


title: Wordpress plugin won't show on some themes

text: I have made a wordpress plugin following standard wordpress tutorials. This plugin add a file upload to the comment form by using simply this function:               add_action( 'comment_form_logged_in_after', array(&$this, 'add_to_comment_form') );      . But when I activate some themes it won't show on the comment form. Any Help how to make it show on comment form?


title: list posts of a person by a variable?

text: Basically I have some portfolio code that runs user bio pages in my site. here is the link Entechpc.com Meet Our Agents . When you click on an agents image, it takes you to his bio which is really just a post. All of that works fine. What I want to do, is list this persons listings as posts and assign the posts to a category of their name and then have them display below his bio in a separate div container. So all of the posts that are in his cat will display under his bio but if another agent is displayed it will only show their listings I have tried using multiple loops, wp_query and get posts by cat and a few other tactics to get this to work, but basically all i have been able to do is display all of the posts by everyone at once, meaning, it always just displays all of the posts in the db, lol. Now I am not a good php coder at all. I am really good with html and css and photoshop and illustrator. So is there anyway to achieve this? Basically my code right now is just a basic loop with the thumbnail, a couple of custom fields displayed and the_content for the main bio. I have erased all of the other code for the second part so I dont have any examples of what I was trying to do. Any help would be appreciated.


title: How to trigger function on preview a wordpress post?

text: I've created a plugin that fetch the featured image of post when a user Publish a post with featured image. The step by step process is,   1. A user create a new post with 'Add New' post   2. He choose featured image with 'Set Featured Image', give title and/or content   3. Then the user publish the post. I set a function on 'save_post' action, when post is published my function fetch the 'Featured Image' and make some different copy of them and show them in the same post. Now so far It is working without any problem. But now I found that when I preview the post the post is not showing the images in 'Preview Box' that my function makes. Actually my function triggers on "Publish Button" ('save_post' hook) pressing. But before publishing when one preview the post by clicking on 'Preview' it is yet to be triggered so the post doesn't show in the manner in the way that it is after publish. Can anyone tell how to trigger the function on 'Previewing Post'.


title: How can I make front page to display custom taxonomy page?

text: If I have this URL for my custom taxonomy term `http://example.com/work_type/vehicle-transporting/` how can I show it as the main page `http://example.com/` like it is available to do for the static pages at `Setings` > `Reading` menu? `.htaccess` solutions are acceptable, changing theme's `index.php` is not. Update:               # 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]     RewriteCond %{REQUEST_URI} ^/work_type/vehicle-transporting/     RewriteRule ^(.*)$ / [P]     </IfModule>     # END WordPress      Why it didn't help?


title: Link button is not working while editing a post in Firefox

text: One of our admins started experiencing a weird issue when editing a post. When the link button is clicked inside the post editor in visual mode, the box appears with the content inside, but it is grayed out and nothing is clickable. This is only currently happening in Firefox. I already instructed the admin to clear the cache, logout/login, restart the computer, etc, but nothing has seemed to do the trick. Any ideas? **Edit** : For reference, here is a picture of the grayed out link box http://i.imgur.com/H7wD7.jpg


title: wordpress home is gone

text: i'm new to wordpress AND to php and web coding in general. i've done my wordpress theme in local, and now i like it. then i moved to a host, created the user and the database in the host server, changed wp- config.php and replace all "http://localhost/wordpress" with "http://my-new- cool-host.org/blog" in wordpress.sql (dump of all db with phpmyadmin). everything seems right: if i open http://my-new-cool-host.org/blog there is my theme, if i click on the title (that i have linked to wordpress instance home with this code:                   <title><?php bloginfo('name'); ?><?php wp_title(); ?></title>      ) it link me on http://my-new-cool-host.org/blog and if i click on a post it link me on the post. BUT: after entered on a post, if i click on one of the links.. it has this ahref:               <a href="../../wordpress.1">      why that? why after seeing a post all links seem broken? ### EDIT: after some trials i realized that if i use as permalinks the 'Default' options everything was ok (well.. everything, only the posts, because the pages are broken again) but if i use the options 'Post names' the wordpress.1 error appears again.. some hints?


title: Pros and Cons of Post Types vs. Multiple Blogs

text: I currently have 3 WordPress instances. One is primarily a coding blog (with samples/tips, and a few personal insights). One is a photo blog. One is a general quote type blog, small snippets of text and that is it. However, after reading up on Post Types, and seeing some of the newer themes featuring multiple post types in order to change the presentation, I'm wondering how practical/effective this route may be. I realize this can be a highly subjective question, so let's keep it to the basics. What are the pros and cons of running a single site with multiple post types as opposed to simply running multiple blogs, and having each one focus on the type?


title: Check if current page has given tag ID

text: I am using custom taxonomies. How to check if current page has `tag_ID = "XXX"` ? If that is any help the URL form WordPress admin looks like this:                 http://localhost/website/wp-admin/edit-tags.php?action=edit&taxonomy=company&tag_ID=13&post_type=news       * * * Update. Here is code which I'm currently using. Does not work.               <?php     function insert_news($company = 0)     {         global $post;              $count       = 0;         $news_query  = new WP_Query(array(             'post_type' => 'news',             'posts_per_page' => -1,             'orderby' => 'date',             'order' => 'ASC',             'company' => $company         ));         $total_count = $news_query->post_count;         while ($news_query->have_posts()):             $news_query->the_post();                  $count++;                  $tag_id = get_query_var('tag_id');                  if ($tag_id && $tag_id == '14') {                 // ID 14                  } else if ($tag_id && $tag_id == '13') {                 // ID 13                       } else if ($tag_id && $tag_id == '12') {                 // ID 12                       }         endwhile;     }     ?>


title: Adding a featured image to a foreach Wordpress loop

text:
I just found a clever piece of code on line which allows Wordpress posts to be displayed in side by side columns and works great with the title and post excerpt that I want to display. However I would like also to display a specific featured image that I defined in the functions file in each post. Here is the code that works fine apart from a lack of output for the featured image. I'm guessing my syntax is incorrect at that point.                               <?php                         // Custom loop that adds a clearing class to the first item in each row                         $args = array('numberposts' => -1, 'order' => 'ASC', 'post_type' => 'treatments' ); //For this example I am setting the arguments to return all posts in reverse chronological order. Odds are this will be a different query for your project                         $allposts = get_posts($args);                         $numCol = 2; // Set number of columns                              // Start Counter                         $counter = 0;                         foreach ($allposts as $post) {                             $content = '
'; // Add class to the columns depending on if it is odd or even                             $content .= '
';                             $content .= '
';                             $content .= 'the_post_thumbnail->small).'" />';                             $content .= '
';                             $content .= '
'.$post->post_title.'
';                             $content .= $post->post_excerpt;                             $content .= '
';                             $content .= '
';                             echo $content;                             $counter ++;                         }                     ?>      I'd like a fallback image if the user hasnt specified a featured image too. I'd guess an if else statement similar to the short hand used to add a class to the columns would be appropriate? Here is the featured image code that is in the functions file.               <?php     // add featured image     add_theme_support( 'post-thumbnails' );     set_post_thumbnail_size( 120, 120, true );     add_image_size( 'small', 120, 120, true );     add_image_size( 'medium', 330, 330, true );     add_image_size( 'front_page', 460, 350, true);     add_image_size( 'header', 660, 200, true);     add_image_size( 'large', 600, 390, true );     ?>


title: How do I get link URLs from the Wordpress links backend into an array?

text: I'm currently running a blogroll on a site I'm working on by defining a variable with an array that has all the rss feed urls I want to pull from. Like this for example:               <?php // Get RSS Feed(s)     include_once(ABSPATH . WPINC . '/feed.php');     $rsslist = array(   'http://jordanshipman.lt11.com/rss',                 'http://feeds.feedburner.com/climbingnarc',                 'http://jonglassberg.lt11.com/rss'                     );     $rss = fetch_feed($rsslist);     if (!is_wp_error( $rss ) ) :      $maxitems = $rss->get_item_quantity(25);      $rss_items = $rss->get_items(0, $maxitems);      endif;     ?>      What I would like to figure out is rather than entering in each feed url in the code as above I want to pull the rss links from the wordpress links backend. Using something like the wp_get_bookmarks() function. Any help would be greatly appreciated! Thanks much!


title: Replacing all attachment links in post with media file link

text: I'm working on a Wordpress site, where all images inside posts are linking to the corresponding attachment pages. I want to use a lightbox but obviously this would require changing all the links back to the media files directly (e.g. xyz.jpg). The site has a significant number of posts and images so it would be impossible to do this manually. Does anyone know of solution that would simply replace - in bulk - all of the image links to link to the media file, instead of the attachment page?


title: Current URL path variable

text: WordPress has a built-in variable `$pagename` that will give the current page. I am looking for something that will give the full url including the path before the current page. Details below. I am using a page template to display a folders contents depending on which page someone is on. Right now this method is working for top level paths, but not for anything nested. I understand why it isn't working, but I am not sure how to fix it. Here is an example of what I am doing now: `$dir = "wp-content/uploads/Docs/".$pagename;` So that will give me the correct path to the top level pages, but anything below them will not work. I know the easy solution would just to keep all folders at the base level in the upload directory, but I want my server side files to make sense also. How a url using `$pagename` looks now: `example.com/accounting` But lets say that I have a page within /accounting like this: `example.com/accounting/accounts-receivable` Using the `$pagename` method will only provide me with this: `example.com/accounts-receivable` My preferred solution would be to use something like `$pagename` and get the full path. I have looked in the Codex for a solution, but I am either not seeing it or it is not in there. I am specifically looked through the global variables (http://codex.wordpress.org/Global_Variables) to see if there is one. In that Codex page they do not mention their `$pagename` variable although it does exist. Hopefully there is a similar variable for the full path.


title: Dashboard--> All Pages "How to create folders?"

text: I have going on three pages in All Pages on my Dashboard. Is there a way I can set up folders for these pages - - it's becoming a confusing "mess" to find which page I need to update when - for example - on PayPal I had to create separate thank you pages per button. With multiple currencies, each needing a separate button and eBooks are non-taxable, whereas books are taxed, its getting confusing... Thanks.


title: 3.9 breaks multisite

text: I just updated to 3.9 and all my sites are now the main (first) site on the network. If I go to a subsite admin page the url will say that I am on my subsite but I am actually on the admin for the main site of the network. The admin bar will also show that the current site is the main network site, but the url says I should be on the subsite. I created a new testing environment with multi site and the same thing happens. If I create a new subsite it will always direct me to the main site, but the urls will show the subsite address. (front end and backend/admin). It seems like there is a major redirect issue happening.


title: Is it possible to have a landing page based on the visitors location?

text: I am designing an events site and would like people to see a homepage based upon the events that are in their area. Could this could also be done with a login, if they register their address?


title: How do you disable account activation in WPMU and then log the user in right away?

text: Is there a way to disable account activation for WPMU then log the user in and redirect them to another page? I am running on WPMU with BuddyPress.


title: redirect out of wp-admin, without losing admin-ajax.php

text: I'm trying to keep all non-administrators out of the Wordpress admin panel by using a wp_redirect inside of an is_admin conditional. The problem is that a side effect of this if that non-admins can no longer use the file "admin- ajax.php" for ajax calls in Wordpress. It appears that a few people on the Wordpress forums are having the exact same problem lately. Would anyone have a solution for this?


title: Wordpress themes that are browser tested and maintained?

text: Are there any developers that offer themes that have a defined list of browsers tested, on desktop and mobile devices, that are also periodically updated to account for new browser versions?


title: Customizing SERP content for WordPress Blog

text: I want to customize the text that appears on the SERP for the posts on my WordPress blog. I want to be able to either provide some custom text or modify the fields that appear on the SERP page, for example, remove Date and shorten the description. Is there a Plugin available to do that?


title: Coupon codes and wordress; Membership plugin, tertiary plugin or shopping cart?

text: # TL;DR Is there a membership plugin for Wordpress that supports coupon codes to discount the total price of a membership _before_ the customer is whisked away to the hosted checkout page (1ShoppingCart, MoneyBookers, etc.)? # Backstory: I'm facing a dilemma with a paid membership site and the use of coupon codes. My site's basic structure / business model is this:   * There will be premium content that is blocked by a pay wall.   * To access the premium content, customers must pay a one-time, non-recurring fee for lifetime access.   * I would like the ability for customers to use a coupon code at or near the checkout page to reduce the price. The coupon code weighs heavily in my conversion tactic / marketing plan. (For those interested in the specifics, I hope to use the tool JustUno to offer money off of the purchase price in exchange for a tweet or Facebook like.) My trouble comes concerning at which point to implement the coupon feature:   1. At the membership plugin level (Wishlist, MagicMembers, S2Members Pro, etc.)   2. At the hosted checkout page level (1ShoppingCart, MoneyBookers, etc.)   3. Using some extra plugin within WordPress. Somehow. Someway. # Specific Dilemma: The major membership plugins that I've seen don't support coupons internally. There's only a handful of major checkout pages I've seen that support coupons (Authorize.net and MoneyBookers being the biggest two of note). Of those checkout pages / payment gateways / merchant accounts none support payment through PayPal which is rather important to me. PayPal themselves don't support coupons at their checkout page, thus I need to use someone else for the checkout and then merely offer PayPal as a possible payment method. Finally there is the problem of using a plugin-for-a-plugin, i.e. a plugin for the membership management system that allows for coupons to be implemented pre-checkout. It might not be supported or might not be reliable. # Question(s): Finally, a question or three!   * Most importantly, is there a membership plugin that supports coupon codes internally?   * Would I be better off using coupon codes on the checkout page?   * Should I even consider plugins-to-a-plugin / custom coding to implement coupons into a membership program that doesn't internally do coupons?


title: Ordering Post 2 Post admin meta box by meta from CPT

text: I've just started using Posts 2 Posts (brilliant plugin by the way) in combination with a custom post type called "Artist" and the WP Event Manager Plugin. My aim is to use P2P to link Artists to Events so an Event Page can display who is performing. I have created a recurring number of events in Event Manager which understandably have incrementing post ID's, e.g. 5,6,7. Let's say for argument these events are all on subsequent Mondays. I then created a recurring event, say on a Friday which has post ID's 8,9,10,11..... Now I can order the order of the meta box in admin by post ID using something like:               function order_pages_by_ID( $args, $ctype, $post_id ) {     if ( 'posts_to_pages' == $ctype->name ) {         $args['orderby'] = 'ID';         $args['order'] = 'asc';     }          return $args;     }          add_filter( 'p2p_connectable_args', 'order_pages_by_ID', 10, 3 );      But this will now display all the Monday events and then all the Friday events when I'm trying to connect an Artist to an Event from the Artist's page. What I'd like is to have Monday, Friday, Monday, Friday etc. The event CPT has a custcom field called `_event_start_date` which I can append to the label in the admin meta box by using:               function append_date_to_candidate_title( $title, $post, $ctype ) {         if ( 'my_connection_type' == $ctype->name && 'event' == $post->post_type ) {                 $meta = get_post_meta( $post->ID, "_event_start_date" );                 $title .= " (" . reset($meta) . ")";         }              return $title;     }      Is there any possible way to order the query for the admin meta box to take this custom field into account and order by this (or even order it in PHP afterwards)? I've seen a few examples of ordering the posts when using 'get_connected()` from the frontend by nothing specifically related to the ordering in the admin meta box.


title: Create multiple subdomains for multi-site from a database

text: I want to create multiple subdomains for users.   I know how to create multiple subdomains manually using _creating network_. But, i have so many users, I can't create those subdomains manually one by one. I have a user list in an Excel file:               id || username || password || subdomain           1 || alex     || ****     || alex.websitewordpress.com           2 || brad     || ****     || brad.websitewordpress.com           3 || carol    || ****     || carol.websitewordpress.com           4 || donald   || ****     || donald .websitewordpress.com      How can I create multiple subdomains automatically using the data from my Excel file?


title: Widget in child theme having missing argument

text: I'm trying to build a child theme on top of a parent theme. So far so good but now I'd like to modify a parent theme widget. So I setup my new file in the child theme, require_once the file, and copy/paste the content of the parent theme for that widget. All I did so far is unregistering the parent widget, and registering the new child theme. The parent widget disappears just fine from the widget list, but when I try loading the child widget I get this error: `Warning: Missing argument 2 for WP_Widget::__construct(), called in C:\Users\User\Documents\WebDev\discover\wp-includes\widgets.php on line 324 and defined in C:\Users\User\Documents\WebDev\discover\wp-includes\widgets.php on line 93` Here's the code I have so far in the child:               //remove theme's widget     add_action('widgets_init', 'CT_remove_flickr_widgets', 11);          function CT_remove_flickr_widgets()     {         unregister_widget('CT_Flickr_Widget');     }          //Loads ours     add_action('widgets_init', 'CT_load_flickr_widgets_Temp');          function CT_load_flickr_widgets_Temp()     {         register_widget('CT_Flickr_Widget_Temp');     }               /**      * Widget class.      * This class handles everything that needs to be handled with the widget:      * the settings, form, display, and update.       *      */     class CT_Flickr_Widget_Temp extends WP_Widget {          /**      * Widget setup.      */          function CT_Flickr_Widget() {              /* Widget settings. */         $widget_ops = array('classname' => 'ct_flickr_widget', 'description' => __( 'CT: Flickr Widget TEMP', 'color-theme-framework' ) );              /* Widget control settings. */         $control_ops = array( 'width' => 200, 'height' => 350, 'id_base' => 'ct_flickr_widget' );              //var_dump($this->WP_Widget()) ;         /* Create the widget. */                 $this->WP_Widget( 'ct_flickr_widget12', __( 'CT: Flickr - TEMP' , 'color-theme-framework' ), $widget_ops);          }      What's really upsetting is that I haven't changed any of the widget's code yet, it's the same as the parent, but the parent doesn't return an error while the child does. Any thoughts? Cheers


title: How to fix a double slash in custom permalinks with hierarchical taxonomy's?

text: Following the solution from Jeff @ Custom permalinks - post type - hierarchical taxonomy's I managed to rewrite my url's for custom taxonomy's. However i do have one thing that bothers me and that is a double slash in the output because of the separator. http://www.domain.nl/product/televisies/led/55-inch//product-naam-4/ I can not change this in the permalinks section in de admin. (/%category%/%postname%/)               register_post_type( "products",                  array(  'label'             => CUSTOM_MENU_TITLE,                         'labels'            => array(   'name'                  =>  CUSTOM_MENU_NAME,                                                         'singular_name'         =>  CUSTOM_MENU_SIGULAR_NAME,                                                         'add_new'               =>  CUSTOM_MENU_ADD_NEW,                                                         'add_new_item'          =>  CUSTOM_MENU_ADD_NEW_ITEM,                                                         'edit'                  =>  CUSTOM_MENU_EDIT,                                                         'edit_item'             =>  CUSTOM_MENU_EDIT_ITEM,                                                         'new_item'              =>  CUSTOM_MENU_NEW,                                                         'view_item'             =>  CUSTOM_MENU_VIEW,                                                         'search_items'          =>  CUSTOM_MENU_SEARCH,                                                         'not_found'             =>  CUSTOM_MENU_NOT_FOUND,                                                         'not_found_in_trash'    =>  CUSTOM_MENU_NOT_FOUND_TRASH ),                         'public'            => true,                         'can_export'        => true,                         'show_ui'           => true, // UI in admin panel                         '_builtin'          => false, // It's a custom post type, not built in                         '_edit_link'        => 'post.php?post=%d',                         'capability_type'   => 'post',                         'menu_icon'         => get_bloginfo('template_url').'/images/favicon.ico',                         'hierarchical'      => true,                         'rewrite'           => array('slug' => 'product/%taxonomy_name%','with_front' => true,'hierarchical'=>true), // Permalinks                         'query_var'         => "products", // This goes to the WP_Query schema                         'supports'          => array(   'title',                                                         'author',                                                          'excerpt',                                                         'thumbnail',                                                         'comments',                                                         'editor',                                                          'trackbacks',                                                         'custom-fields',                                                         'revisions') ,                         'show_in_nav_menus' => true ,                         'taxonomies'        => array("pcategory","ptags")                     )                 );          // Register custom taxonomy     register_taxonomy(  "pcategory",                  array(  "products"  ),                  array ( "hierarchical"      => true,                          "label"             => CUSTOM_MENU_CAT_LABEL,                          'labels'            => array(   'name'              =>  CUSTOM_MENU_CAT_TITLE,                                                         'singular_name'     =>  CUSTOM_MENU_SIGULAR_CAT,                                                         'search_items'      =>  CUSTOM_MENU_CAT_SEARCH,                                                         'popular_items'     =>  CUSTOM_MENU_CAT_SEARCH,                                                         'all_items'         =>  CUSTOM_MENU_CAT_ALL,                                                         'parent_item'       =>  CUSTOM_MENU_CAT_PARENT,                                                         'parent_item_colon' =>  CUSTOM_MENU_CAT_PARENT_COL,                                                         'edit_item'         =>  CUSTOM_MENU_CAT_EDIT,                                                         'update_item'       =>  CUSTOM_MENU_CAT_UPDATE,                                                         'add_new_item'      =>  CUSTOM_MENU_CAT_ADDNEW,                                                         'new_item_name'     =>  CUSTOM_MENU_CAT_NEW_NAME,   ),                          'public'            => true,                         'show_ui'           => true,                         "rewrite"           => array('slug' => 'product','with_front' => true,'hierarchical'=>true))                 );       My functions.php includes:               add_filter('rewrite_rules_array', 'mmp_rewrite_rules');     function mmp_rewrite_rules($rules) {     $newRules  = array();     $newRules['product/(.+)/(.+)/(.+)/(.+)/?$'] = 'index.php?products=$matches[4]';     $newRules['product/(.+)/?$']                = 'index.php?pcategory=$matches[1]';           return array_merge($newRules, $rules);     }     function filter_post_type_link($link, $post)     {     if ($post->post_type != 'products')         return $link;          if ($cats = get_the_terms($post->ID, 'pcategory'))     {         $link = str_replace('%taxonomy_name%', get_taxonomy_parents(array_pop($cats)->term_id, 'pcategory', false, '/', true), $link);     }     return $link;     }     add_filter('post_type_link', 'filter_post_type_link', 10, 2);          // my own function to do what get_category_parents does for other taxonomies     function get_taxonomy_parents($id, $taxonomy, $link = false, $separator = '/', $nicename = false, $visited = array()) {         $chain = '';        $parent = &get_term($id, $taxonomy);          if (is_wp_error($parent)) {         return $parent;     }          if ($nicename)             $name = $parent -> slug;             else             $name = $parent -> name;          if ($parent -> parent && ($parent -> parent != $parent -> term_id) && !in_array($parent -> parent, $visited)) {             $visited[] = $parent -> parent;             $chain .= get_taxonomy_parents($parent -> parent, $taxonomy, $link, $separator, $nicename, $visited);     }          if ($link) {         // nothing, can't get this working :(     } else             $chain .= $name . $separator;     return $chain;         }      Does any one know how to solve this?


title: Does javascript have an equivalent to PHP's preg_replace_callback?

text: I have a php function that executes inside an add_meta_box() in the WP content editor (see below) that I would like to convert to javascript so that it executes on a button click (on demand vs automatic on load) to convert the post content in real time (without posting to the server). Is there an equivalent method set in javascript?               add_meta_box('mycontentfilter', __('My Content Filter'), 'my_content_filter', 'post', 'side', 'high');           function my_content_filter()     {         global $post;         $mykeyword = 'find this phrase';         $post->post_content = preg_replace_callback("/\b($mykeyword)\b/","doReplace", $post->post_content);     }               // the callback function     function doReplace($matches)     {         static $count = 0;         switch($count++)          {             case 0: return ''.$matches[1].'';   // 1st instance, wrap in bold             case 1: return ''.$matches[1].''; // 2nd instance, wrap in italics             case 2: return ''.$matches[1].''; // 3rd instance, wrap in underline             default: return $matches[1];              // don't change others.         }     }


title: No Styling for the datepicker in Wordpress admin

text: I'm developing a plugin for Wordpress and I need a datepicker. So I enqueue the jquery and jquery-ui               wp_enqueue_script('jquery');     wp_enqueue_script('jquery-ui-datepicker');      and called the datepicker               jQuery(document).ready(function($){         $('#date').datepicker({});     });      It worked pretty well, however my datepicker has no style at all. Anyone knows how to fix that?


title: Creating my own Admin Forms in a WordPress CMS?

text: I just decided to try using WordPress for a CMS (not a blog). The site will have some product information that I want the client to be able to update. Instead of creating an entire admin side just for them to update their products, is it possible to create a form in the WordPress admin so they can add products to a database? Is changing the WordPress admin side good practice?


title: Modifying the way WP sets cookies

text: I'm trying to create a custom plugin that will change the way that wordpress names its cookings. Specifically, I want to write my own version of wp_user_settings(). I know I probably shouldn't hack core, so where is the best place to hook in to rewrite the function?


title: Using subdomain to upload media/images etc on 2 different blogs

text: Is possible to use a subdomain, for example: media.mydomain.com pointed to /var/www/mediauploads, for two different domains? Since I have mydomain.com and mydomain.it blogs, would be nice to upload files directly in one folder instead of duplicating the images when I write new articles in english and italian. Hope someone can help! Thanks


title: Open subcategories in submenu on click in primary menu

text: I am figuring out a way if we can manage the menu in such a way that when I click on the menu item in the first menu, the sub categories or links that i choose should be displayed in the secondary menu.. say for example when I click on Entertainment in the nav menu, the subcategories/topics like gossips, hollywood, bollywood should be appear in the menu beneath the primary menu... (eg.. have a look at ibnlive.com or latimes.com website, it works in a similar passion)...


title: ".#[random-char-string]" being inserted at end of URLs

text: I've seen this on a couple of sites now and I'm having trouble finding information about (probably because it's awkward to describe): All internal URLs like this for example:                   http://www.domain.com/section/      Are rewriting themselves to something like this:                   http://www.domain.com/section/#.TvuV_pim9PI      Does anyone know what causes this? I'm running WP 3.3 and .htaccess is just the default:                   # 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      My Permalink settings are set to Post name and nothing in Category and Tag base.


title: Built to scale, or worry later?

text: I'm starting a service that offers websites that runs on a giant Wordpress multi-site. I have a cloud based vps with nginx-php5-php-fpm-mysql. Storage with Amazon S3, distribution with MaxCDN. WP Total cache takes care of this for WP. I do expect to be busy from the start as far as the number of sites created. My question is about mysql replication.   1. Should I go ahead and create two more VPS's now, and have one as master and one as slave from the get go? Or, is this something that can be done when it's time to scale? I worry about the size of the db and incomplete backups.   2. With, currently no service launched and 0 signups, should I even be worrying about this? What # of sites created would justify scaling wordpress? I want to start this off the right way and not have to deal with expanding down the road. Thoughts? Nick


title: How to get Next/previous_post_link to go through articles in top parent category

text:
I have a magazine format where a parent category is an issue, sub categories are the sections and the articles go into their respective sections. When viewing an article in a magazine, I would like to be able to scroll through all the articles in that issue not just the section the articles are in or the whole website, just that issue. ATM the links go through all of the articles in a section. How can I adapt the code below to make next/previous_post_link link through all of the articles within a magazine? I know that the `TRUE` declaration in the code below lets the links cycle through all of the posts and changing it to `FALSE` makes it go through its parent category but how can you make this go through the top level category?. code in single.php               <?php previous_post_link( '
%link
', '' . _x( '←', 'Previous post link', 'IQ' ) . ' %title', TRUE ); ?>             <?php next_post_link( '
%link
', '%title ' . _x( '→', 'Next post link', 'IQ' ) . '', TRUE ); ?>


title: Order Posts by Alphabetical for Each Letter

text:
I need to order my posts by alphabetical for each letter. I mean: When people enter to www.xxx.com/a, they will just see posts by starting A. ABC XYZ ADE KLM ARE UYZ When people enter to www.xxx.com/b, they will just see posts by starting B. BCK OIO BHJ PEP I hope you will understand what I want. I have founded this code:                   <?php     $last_char = '';     $args=array(       'orderby' => 'title',       'order' => 'ASC',       'posts_per_page'=>-1,       'caller_get_posts'=>1     );     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {       echo 'Alphabetic index of all ' . count($my_query->posts) . ' posts';       while ($my_query->have_posts()) : $my_query->the_post();         $this_char = strtoupper(substr($post->post_title,0,1));         if ($this_char != $last_char) {           $last_char = $this_char;           echo '
'.$last_char.'
';         } ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
         <?php       endwhile;     } //if ($my_query)     wp_reset_query();  // Restore global post data stomped by the_post().     ?>      However, this code lists all posts by alphabetical in one page. As I said before, I just want same thing but for one letter which I specify. Thank you for helping me.


title: FitVid not working for iframes on particular theme install

text: I am using FitVid in my theme and all is well except for a specific site that was migrated from Drupal. FitVid works fine with objects and embeds but not iframes, and only on this particular site. The only difference I can find is that a random `<noscript>` is inserted after the iframe. Here is an example of the non working iframe on the problematic site: http://wp.alimomeni.net/project/animal-warmth-no-64/ And here is an example with a different database where no shows up: http://wpfolio.notlaura.com/project/pollen-from-hazelnut/ Why is FitVid not working for iframes that particular site install? I am concerned there is an issue with the database itself as the content was pretty messy after the initial migration and I haven't been able to replicate the issue anywhere else. Any help greatly appreciated! P.S. I have tried other responsive video plugins and my own jQuery to wrap the iframes.


title: is_singular() not working if called via callback function of admin-ajax.php

text: In my `single.php` I've some code like this ...               if(is_singular('post')) {        echo 'Blog';     } else {        echo 'CPT';     }       If I approach `single.php` from blog or CPT index page by using `the_permalink()`, this condition works correctly. It show 'Blog' when I open single blog post and shows 'CPT' when I open single CPT. Now the issue is if approach `single.php` via some callback function of `admin-ajax.php` it always echos 'CPT' even if I click on single blog post link. My ajax callback function is something like this ...                   function ajax_callback() {                  get_template_part( 'single', 'portfolio' );                  die(); // to avoide 0 at the end              }         add_action('wp_ajax_ajax_callback', 'ajax_callback');         add_action('wp_ajax_nopriv_ajax_callback', 'ajax_callback');


title: How to use the new Dashicons for custom TinyMCE buttons?

text: I've been following a tutorial on Tuts+ (linked from the WordPress Codex) on how to interact with the TinyMCE editor to add buttons. Following the example code on that article, I have a JS file which adds the buttons to TinyMCE. The relevant snipped of JS that adds the icon is:               ed.addButton('dropcap', {         title : 'DropCap',         cmd : 'dropcap',         image : url + '/dropcap.png'     });      Now this was fine pre WP 3.8, however since Dashicons were introduced it looks outdated to use static PNG's for TinyMCE buttons... Since 3.8 I've updated my custom post types to use Dashicons, but was wondering what is the correct way to get TinyMCE buttons using Dashicons as well? There's a handy guide from James Coster on how to use Dashicons which may be relevant (though I assume there's no need to place calls to enqueue the Dashicons scripts as they'll already be loaded in the back-end).


title: Editing links to new Site url when user Creates a New Site

text: I have a template site set to be duplicated when a user creates a new site on my network. When a new user creates a new site on my multi-site network I need to have several links incorporate the name of this new users site. For example, the link in my template site is: http://www.yciw.net/template1/quizzes/workflow-quiz/ If a new user creates a site called: oceans I need the link to automatically update to: http://www.yciw.net/oceans/quizzes/workflow-quiz/ when the site is created. Is this even possible? I've done quite a bit of research. I've seen this post: Redirecting old site links to new site but I'm not certain the question is the same.


title: Why are 404 errors redirecting to my homepage and not my custom 404.php?

text: Not sure if this strictly wordpress and not a general apache configuration but I'm having trouble setting up my 404 page for a custom theme. I have my 404.php in the same directory as my index.php. I had this working kind of working earlier by adding `ErrorDocument 404` with an explicit path to 404.php, but wordpress wasn't being included on the page. I've now removed that line. My .htaccess file:               <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>      My apache enabled site:               <VirtualHost *:80>             ServerAdmin info@seoplay.co.uk             ServerName www.lart.co.uk             ServerAlias lart.co.uk             DocumentRoot /var/www/lart.co.uk             <Directory /var/www/lart.co.uk>                     Options Indexes FollowSymLinks MultiViews                     AllowOverride FileInfo                     DirectoryIndex index.php                     Order allow,deny                     allow from all             </Directory>              ..... etc      This is on a local machine. I'm not sure how to make wordpress know about my custom 404 page.


title: Create custom post order (with custom post type meta)

text: I would like to display my custom post type by specific order.   In my custom post type, i've 2 meta :   - DAY ( Select : 1,2,3,4,5,etc...)   - MONTH ( Select : Janvier, Fevrier, Mars, Avril, etc...)  How it's possible to display this :   * DISPLAY CUSTOM POST TYPE BY DATE ( closest at first ). Thanks.


title: How do I add my own custom shortcodes?

text: I'm looking to reuse some small portions of html inside several pages/post but I don't know how to obtain this on WordPress. It would be nice if I could have a helper in the editor to include them, but this is only a nice to have feature, for the moment I need a solution for this.


title: Replacing the Wordpress password validation

text: I have a custom application with thousands of users who already have a password stored. I would like to set up a self hosted wordpress site to accompany that application and to use the usernames and encrypted passwords that already exist in that database. Is there a way to configure Wordpress to not use the normal list of users, but instead to validate usernames and passwords against another database on another server? We have a team of developers so if there was a way to write code to hook into the login process this would be acceptable. Does anyone have experience with this, or have any suggestions of where to look?


title: best way to use custom taxonomy, post type and meta in a job system

text: i am building a job system which will store following data:   * job title - post title   * description - content   * location - post meta / taxonomy   * sector (it/sales & etc)- custom taxonomy   * salary start - post meta   * salary end - post meta   * contact person - post meta   * skills - post meta   * and etc so far i created a **custom post type** called **jobs** and **taxonomy** called **sector** and couple of meta fields. now my question is, should I store **locations** as **taxonomy** or use **meta field** ? since location will have county and town. town being children of county, having said that this is **not really needed or required**. other issue is that i need to able to **search** the following **location, sector and salary** fields. if had two taxonomies (locations and sectors), is it possible to query both of them at once? any ideas or advice is welcomed. happy to provide more info if needed. thanks.


title: Setting up custom post type archives in WP3.1? Any luck?

text: I've just moved a site I'm developing to WP3.1 so that I can take advantage of and start testing some of the new features. I'm especially liking the `has_archive` parameter in registering custom post types. I had a post type called 'recipes', and added this line to the args on registering it:               'has_archive' => 'recipe-listings',      From what I understand, that should generate the rewrite rules necessary to make **/recipe-listings/** be equivalent to **/?post_type=recipe**. However, I can't seem to get it working. The generic form http://amritafood.com/?post_type=recipe works fine, but http://amritafood.com/recipe-listings/ just goes to 404. What else do I need to do to get custom post type archives working properly? Has anyone else worked it out yet?


title: How Do I Programmatically Better Organize Custom Post Type Menus?

text: A project I inherited had a dozen custom post types. Trouble is, they all come off the admin menu sidebar separately. It's not very tidy. Is there a plugin where I can make these subitems of a parent menu, or is there a way, programmatically, I can edit my theme's functions.php to make it make these as submenus?


title: Losing theme customization when switching from a theme to a child

text: I followed the practice of creating a sub-theme (child theme) but I discovered that I lost some configuration I made:   * main custom header lost, but it remained for pages where it was customized, I had to upload it again.   * menu customization: primary navigation menu assignment was lost, but the menus did not so it was easy to reassign it.  **Are any other side effects like the one above?** Are these **bugs or expected behavior**? Details:   * I added a new directory in themes, created style.css with requested header   * Activated the new theme in WordPress (running in multi-site mode)   * Observed the issues above


title: Show an image in my header.php

text: I want to let my customer choose any image (in my backend) and then it will be displayed in my header.php. i've found Image Widget, but it just show images in the sidebar. I want something like:               <?php wp_plugin_that_shows_a_simple_image(); ?>      In my header. Which plugin could I use? I've searched a lot. WP 3. Thank you.


title: Added 20 Custom Fields. Only 10 showing in drop down

text: Just like the title states. I've added around 20+ custom fields into my wordpress site and only around 10 are showing in the drop down. The custom fields are all functioning fine on the site side, but they just aren't showing up in the drop down. ![enter image description here](http://i.stack.imgur.com/DRWUn.jpg)


title: How to import custom data via XML, CSV, etc

text: We have about 10 years of custom blog-style, databased content that we want to import into a clean install of Wordpress. There doesn't seem to be an importer plugin that works with custom databsed content so has anyone done a direct INSERT into the Wordpress tables to achieve this? I can easily create custom INSERT statements for each of our custom rows. Does someone know what tables need to be touched for this or is there an easier or more conventional way to do this? Thanks


title: Checkboxes in the category list?

text: I want the category list to have checkboxes so that the visitor can navigate much more easily, just like the way Amazon does it. Compare: left is my current layout, right is what I want to achieve   ![](http://i.stack.imgur.com/sMiuD.jpg) ![](http://i.stack.imgur.com/3jHsW.jpg)


title: Website fully loads then immediately crashes in Internet Explorer

text: The website I run www.detroitdungeon.com loads perfectly fine in every browser but in IE it crashes after loading. Any help would be appreciated!


title: A two column loop with one lead post

text: I got a loop from internet (I forgot the site) for two column post view. It has a nice CSS for it too. But skipping that for the question now.               <?php $counter = 1; ?>                      <?php query_posts( 'cat=3&showposts=6' ); //Find whether the catID is 3 ?>                 <?php while ( have_posts() ) : the_post() ?>                       <?php /* Two Column Support get class */ ?>                  <?php $class = ( $counter % 2  ? ' one' : '' ) ?>                      <?php /* Two Column output open the div class */ ?>                  <div class="column<?php echo $class;// echo $first; ?>">                  <?php news_format(); ?>                 </div> <!-- End Two Column Support close div class -->     <?php $counter++; //Update counter ?>      It printed my posts into 2 columns like:               =========     | 1 | 2 |     ---------     | 3 | 4 |     ---------     | 5 | 6 |     ========= It's fine.   But I want to print it like this:               =========     |   1   |     ---------     | 2 | 3 |     ---------     | 4 | 5 |     ---------     | 6 | 7 |     ========= What the modification I need to do?   I can't pass any custom limit into the WordPress' custom loop `<?php while ( have_posts() ) : the_post() ?>`. It's for a custom theme. I did it, but the problem is, it's showing like:               =========     |   1   |     ---------     | 1 | 2 |     ---------     | 3 | 4 |     ---------     | 5 | 6 |     ========= Here is my whole bunch of code.


title: Thumb rating for wordpress - top user

text: I am currently using gd star rating (thumb rating) to rate posts (articles - no rating on comments). What I really want to do is show a table of the top 5 users and their number of votes based on the total number of thumbs up they receive for all their posts. For instance | user | No of votes | If this is not possible with this plugin, is there any other plugin that is capable of such. Or is there a manual way of achieving what I want. I don't mind manual coding with the right nudge Many thanks guys


title: Metabox saves on Update or Publish, but not on Saving Draft

text: I have created custom post types that also have custom meta_boxes I've created. Currently, they save when I publish or update a post, but they don't save when I'm in draft mode making changes.               add_action('save_post', 'save_details');          function save_details(){     if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) {         return $post_id;     }     global $post;     if ($post->post_type == 'events') { // Check to see if Event Type.         update_post_meta($post->ID, "event_featuring", $_POST["event_featuring"]);         update_post_meta($post->ID, "event_time", $_POST["event_time"]);         update_post_meta($post->ID, "event_date", $_POST["event_date"]);         update_post_meta($post->ID, "event_end_date", $_POST["event_end_date"]);         update_post_meta($post->ID, "event_location", $_POST["event_location"]);         update_post_meta($post->ID, "empid", $_POST["empid"]);         update_post_meta($post->ID, "bhs_event", $_POST["bhs_event"]);     }     }      I tried using wp_insert_post_data instead of save_post, but then I had the opposite problem. It would save on Drafts, but publishing the post no longer worked. What do I need to do differently so I can update a draft (before publishing) and it will save?


title: How can I export WordPress posts' attachments?

text: I am in the process of transferring posts from one WordPress install to another. I can use WordPress' Tools --> Export to export the XML I need for my posts. On the new install, I then use Tools --> Import to load the XML. I check "Download and import file attachments" and then finish the import. The pictures that are inline in my post work, but there are no images to be found in the posts' media gallery. The gallery tab under Upload / Insert is nonexistent, meaning there are no attachments associated with the new post. I currently have the posts migrated, but attachments are still not. How can I do this? And also include the existing captions, descriptions, titles, etc. **Edit:** I should add that this was a migration, so the site URL stayed the same -- It it just the server / WordPress install that changed. Therefore the image paths stayed the same, but they pictures just aren't registered in the posts' Media Gallery.


title: Dynamic Rating Plugin to Add Anywhere

text: I need to add ratings to a page for a few different fields (ex: color, quality, etc.) - not just per post or comment. I'm generating the page using a template, so I have access to the php file that generates the html. Is there any pre-existing rating plugin where I can add the rating feature anywhere on the page? (For example, by saying [rate id=5 field=color]) I've looked at GD Star, but I don't think it works outside of pages and posts. If this is possible with GD Star, I'd love a link to how to do it - I've looked through their documentation and have come up empty. Thanks!


title: How to add a CSS class to the tooltip on a navigation menu?

text: I'm looking for a way to add a CSS class to the anchor tag of the tooltip on a menu item. Currently, I see that you can easily add a CSS class to the menu's li but I'm trying to style the tooltip itself, not the menu item. Looking at the Codex for wp_nav_menu, I don't see an argument available to handle adding a class to the tooltip anchor. Is there a filter I can use? How? FYI, I'm using a plugin called Simple Tooltips to create the tooltips, as all it requires is that I add a class to the HTML element I want to add a tooltip to.


title: how to create a new page that is not in the hierarchy?

text: I want to create a "trending" page that shows posts according to the views, but this page is not in the wordpress theme hierarchy. I don't know where and how to add, I tried to create one and uploaded but showed "Page not found". I guess I have to add something to the function file, or is there an alternative way to do this?


title: Override CSS settings of plugins

text: I want to override my plugin CSS settings, but I can't do that in my `style.css` file, because the plugin CSS gets loaded after. Is there a way of getting style to be applied to override plugin CSS?


title: Average Score of all ratings in comments

text: i have a rating system in comments, for each comment user can rate 1-5 Stars. Now , i want the average of all ratings in comments of that post to show. How can i do that. Here is the link to the code file related to My rating System. Current Users can rate and comment. But i want the average of all comment ratings in that post. And this is a custom Post type. check this link for the code related to rating used in the site. http://pastebin.com/LcRyjSPK


title: Getting a variable using $post ajax back from php to js response in WP

text: I have this in my JavaScript part:               $.post(         WPaAjax.ajaxurl,         {             action : 'my_php_action_to_do',         },         function( response ) {             alert( response.mycode );         }     );      and this in my `my_php_action_to_do` php function:               function my_php_action_to_do() {              $send_to_response['mycode'] = '1234';         echo json_encode( $send_to_response );         exit();          }      I can execute the php code in the php function and run the result post javascirpt code, but the problem I am facing is how to send the variable from the php function back to response and alert it or use in whatever way. Now I am getting `undefined` in a popup window as a result. How to do that in WordPress?