title: $wpdb - joining shows no result

text: For one of my client's WP site, I'm making a plugin, where I'm using the db Query. I've two custom tables dedicated to the plugin:   * **user_req** -- stores user chosen posts along with some custom fields' data.   * **user_req_admin** -- stores some very basic things, with a special foreign key `user_req_id`. **Table: user_req**   ![user_req view](http://i.stack.imgur.com/q6i6P.png) **Table: user_req_admin**   ![user_req_admin view](http://i.stack.imgur.com/FKUqR.png) My plan is to **Join 5 tables** with a single query:   1. user_req   2. user_req_admin   3. posts   4. postmeta   5. users Joining will be done by:   * `{$wpdb->user_req_admin}.user_req_id` connects by `{$wpdb->user_req}.id` (Connects both the db with User Request ID)   * `{$wpdb->user_req}.user_id` connects by `{$wpdb->users}.ID` (Fetch the User details using user_id)   * `{$wpdb->user_req}.post_id` connects by `{$wpdb->posts}.ID` (Fetch the Posts details using the `post_id`s in an array)   * `{$wpdb->user_req}.post_id` connects by `{$wpdb->postmeta}.post_id` (Fetch the Custom Fields using the `post_id`s in an array) But for a startup, I tried joining the first two tables (#1 and #2), and eventually Failed! Here's how I tried:               global $wpdb;         $wpdb->print_error();         $inbox_query = "SELECT                               {$wpdb->user_req}.id,                               {$wpdb->user_req}.dt_usr_sent,                               {$wpdb->user_req}.dt_usr_rcvd,                               {$wpdb->user_req}.user_id,                               {$wpdb->user_req}.post_id,                               {$wpdb->user_req}.qty,                               {$wpdb->user_req}.msg_user,                               {$wpdb->user_req}.msg_admin,                               {$wpdb->user_req}.price,                               {$wpdb->user_req_admin}.user_req_id                             FROM                               {$wpdb->user_req}                             LEFT JOIN                               {$wpdb->user_req_admin}                             ON                               {$wpdb->user_req}.id = {$wpdb->user_req_admin}.user_req_id";         $inbox_rows = $wpdb->get_results( $inbox_query, OBJECT );      **RESULT**   `<?php var_dump( $inbox_rows ); ?>` shows an: > **`array`**   >      _`empty`_ **»** WHAT'S THE PROBLEM WITH MY QUERY? ### References   * LEFT JOIN, INNER OUTER JOIN, LEFT OUTER JOIN is driving me crazy. Please help?   * Querying Email Addresses for a List of Users with Same Last Name?


title: Customizing Deleted/Archived blogs warning pages

text: When we try to access a _Deleted_ or _Archived_ site in Multisite, WordPress shows a `wp_die()` message. ![This site has been archived or suspended.](http://i.stack.imgur.com/1yBNN.png) And this message appears for _Deleted_ sites: > This user has elected to delete their account and the content is no longer > available. How can we customize that?


title: Watermarking Images with Wordpress with WP_Image_Editor

text: I really like the `WP_Image_Editor` class. I wanted to use it for some custom functionality I'm making, but I was wondering - Watermarking images - is there a way that I could use the objects created by `WP_Image_Editor` to merge an image with a watermark? I cannot figure out any obvious way.


title: How do i get the direct neighbor in a hierarchy

text: I've build a custom post type for a calendar and created a structure like this:   * 2012 (general parent)      * January-2012        * 1-January-2012 -2-January-2012        * ...       * ...      * Februar-2012        * 1-February-2012       * 2-February-2012        * ...       * ...      * March-2012        * 1-March-2012       * 2-March-2012       * ...       * ...  If I am now on the side for the whole month, I want to display a link to the pages for the previous and next month. example: January <-- **February** --> March I tried *get_previous_posts_link()* and get _NULL_ , then I set _global $post_ and get _NULL_ too. Another question, is this in general the right way? Maybe then I get the post data / link for 31st January? I'm not sure if *get_previous_posts_link()* considers the hierarchy.


title: Infinite scroll page number

text: On this guys blog he's using infinite scroll and it's appending the page number to the url so when you click on a story and go back, you start off where you were. I'm using infinite scrolling on a website I'm developing just now but I can't figure out how this is done, it's not a function built into the plugin. I'm not using jetpack, I'm using the standalone plugin Also, if I append a page number to my local installation like this               http://localhost:8888/page/2      Then scroll down, it loads in the next set of posts, then it breaks and doesn't load in anymore posts. Is there a way to append the page number as more posts are loaded in with infinite scroll?


title: Count posts that have specific taxonomy term attached

text: When upgrading our portfolio I'm looking for something that shows the number of posts in a (current) category of a post type. Example: I have a category with 'features'. Each feature has it's own description, apps related and blog related posts page I'm fetching the current category with:               <?php $cat_id = get_query_var('cat'); ?>      and get posts with:                <?php query_posts("post_type=apps&cat=$cat_id&showposts=3");?>      How is it possible to count the posts of post_type=apps and category=$cat_id ? I'm sorry for my lack of PHP/WP experience.. does anyone know how to get these 2 things working? Thanks in advance.


title: Select From wpdb - Author/User Directory page

text: I am working on a wordpress site where I have created a directory page(authors.php) that lists all users and certain author meta. It works fine however I am trying to figure out how to only show users that have the required author meta filled out. I've tried many different things but have not been able to achieve what I need. Here is my code               <?php         $order = 'user_nicename';     $users = $wpdb->get_results("SELECT * FROM $wpdb->users ORDER BY $order"); // query users              foreach($users as $user) : // start users' profile "loop"         ?>       Everything else I try does not return any results. Is there a way to only select users with specific author meta fields filled out? Any help is appreciated, thanks.


title: Category slug inside another php code

text: I'm using this code to get category slug on categories archive page outside of the loop:               <?php $cat = get_term_by('name', single_cat_title('',false), 'category'); echo $cat->slug; ?>      And I would like to know how can I add the result of that code inside 'base' => '/HERE/' of paginate_links php code that looks like this:               <?php echo paginate_links( array( 'current' => $current_paginate_page, 'show_all' => true,'prev_next' => false, 'total' => $wp_query->max_num_pages, 'base' => '/HERE/', 'format' => '%#%' )); ?>      I just don't know how to correctly write it inside another php code. Please help, thank you! http://wordpress.org/support/topic/single_cat_slug?replies=5 http://codex.wordpress.org/Function_Reference/paginate_links


title: Custom WordPress Feeds operators?

text: I wish to create a feed of my blog which is a feed of two categories OR the feed of some tag and not the feed of some other category I know how to do "have a feed of this1 + this2 categories", but how do you do "OR" in a feed URL? (and in general, is more complex operators on the URL possible, and how?) Links that don't answer the question (but help define it):   * http://lorelle.wordpress.com/2006/03/27/customizing-rss-feed-links-for-wordpresscom-and-wordpress-sidebar-widgets/   * http://dailycupoftech.com/2007/07/25/creating-custom-wordpress-feeds/


title: Help extending custom drag-drop page ordering on admin page list screen

text: I am utilizing the following code which transforms any hierarchical page or custom post type with the ability to reorder the the pages through simple drag/drop. (also this code also adds a new display filter to hierarchical pages to make things simpler). The problem I need help with which currently does not work is being able to drag one page tree into another page tree or out of an existing page tree. Could someone please provide the code modifications required to extend this capability? If you know of a better way to achieve the same objectives with different code instead of extending the code provided below please also post it. **UPDATED:** I have also posted the code here: https://gist.github.com/812204 **NOTE:** for all those individuals who would like to test this out just do the follow. **1st Copy/past the code below in your themes functions.php" file.**               ///////////////////////////////////////////////////////////////////////////////////////////     // CODE TO ADD POST PER PAGE FILTER     ///////////////////////////////////////////////////////////////////////////////////////////             add_filter( 'edit_posts_per_page', 'reorder_edit_posts_per_page', 10, 2 );         function reorder_edit_posts_per_page( $per_page, $post_type ) {                  // CHECK USER PERMISSIONS             if ( !current_user_can('edit_others_pages') )                 return;             $post_type_object = get_post_type_object( $post_type );                  // ONLY APPLY TO HIERARCHICAL POST TYPE             if ( !$post_type_object->hierarchical )                 return;                  // ADD POST PER PAGE DROP DOWN UI             add_action( 'restrict_manage_posts', 'reorder_posts_per_page_filter' );                  // ADD SPECIAL STYLES (MOVE CURSOR & SPINNING LOADER AFTER REORDER)             wp_enqueue_script( 'page-ordering', get_bloginfo('stylesheet_directory') . '/custom/js/page-resorting.js', array('jquery-ui-sortable'), '0.8.4', true );             add_action( 'admin_print_styles', 'reorder_admin_styles' );                  if ( isset( $_GET['spo'] ) && is_numeric( $_GET['spo'] ) && ( $_GET['spo'] == -1 || ($_GET['spo']%10) == 0 ) ) :                 global $edit_per_page, $user_ID;                 $per_page = $_GET['spo'];                 if ( $per_page == -1 )                     $per_page = 99999;                 update_user_option( $user_ID, $edit_per_page, $per_page );             endif;             return $per_page;         }                   // STYLING CSS FOR THE AJAX            function reorder_admin_styles() {             echo '<style type="text/css">table.widefat tbody th, table.widefat tbody td { cursor: move; }</style>';            }                   // FUNCTION TO CREATE THE NUMBER OF POSTS PER PAGE DROPDOWN UI            function reorder_posts_per_page_filter() {             global $per_page;                    $spo = isset($_GET['spo']) ? (int)$_GET['spo'] : $per_page;            ?>             Display:<select name="spo" style="width: 100px;">                 <option<?php selected( $spo, -1 ); ?> value="-1"><?php _e('All Results'); ?></option>                 <?php for( $i=10;$i<=100;$i+=10 ) : ?>                 <option<?php selected( $spo, $i ); ?> value="<?php echo $i ?>"><?php echo $i; ?> <?php _e('Results'); ?></option>                 <?php endfor; ?>                     </select>            <?php            }                         ///////////////////////////////////////////////////////////////////////////////////////////////////////////////         // ACTUAL AJAX REQUEST FOR SORTING PAGES          ///////////////////////////////////////////////////////////////////////////////////////////////////////////////              add_action( 'wp_ajax_simple_page_ordering', 'reorder_do_page_ordering' );         function reorder_do_page_ordering() {                  // RECHECK PERMISSIONS             if ( !current_user_can('edit_others_pages') || !isset($_POST['id']) || empty($_POST['id']) || ( !isset($_POST['previd']) && !isset($_POST['nextid']) ) )                 die(-1);                  // IS IT A REAL POST?             if ( !$post = get_post( $_POST['id'] ) )                 die(-1);             $previd = isset($_POST['previd']) ? $_POST['previd'] : false;             $nextid = isset($_POST['nextid']) ? $_POST['nextid'] : false;             if ( $previd ) {                      // FETCH ALL THE SIBLINGS (RELATIVE ORDERING)                 $siblings = get_posts(array( 'depth' => 1, 'numberposts' => -1, 'post_type' => $post->post_type, 'post_status' => 'publish,pending,draft,future,private', 'post_parent' => $post->post_parent, 'orderby' => 'menu_order', 'order' => 'ASC', 'exclude' => $post->ID ));                 foreach( $siblings as $sibling ) :                          // BEGIN UPDATING MENU ORDERS                     if ( $sibling->ID == $previd ) {                         $menu_order = $sibling->menu_order + 1;                         // UPDATE THE ACTUAL MOVED POST TO 1 AFTER PREV                         wp_update_post(array( 'ID' => $post->ID, 'menu_order' => $menu_order ));                         continue;                     }                          // NOTHING LEFT TO DO - NUMBERS CORRECTLY PADDED                     if ( isset($menu_order) && $menu_order < $sibling->menu_order )                         break;                           // NEED TO UPDATE THE SIBLINGS MENU ORDER AS WELL                     if ( isset($menu_order) ) {                         $menu_order++;                         // UPDATE THE ACTUAL MOVED POST TO 1 AFTER PREV                         wp_update_post(array( 'ID' => $sibling->ID, 'menu_order' => $menu_order ));                      }                        endforeach;             }                  if ( !isset($menu_order) && $nextid ) {                      // FETCH ALL THE SIBLINGS (RELATIVE ORDERING)                 $siblings = get_posts(array( 'depth' => 1, 'numberposts' => -1, 'post_type' => $post->post_type, 'post_status' => 'publish,pending,draft,future,private', 'post_parent' => $post->post_parent, 'orderby' => 'menu_order', 'order' => 'DESC', 'exclude' => $post->ID ));                 foreach( $siblings as $sibling ) :                          // START UPDATING MENU ORDERS                     if ( $sibling->ID == $nextid ) {                         $menu_order = $sibling->menu_order - 1;                         // UPDATE THE ACTUAL MOVED POST TO 1 AFTER PREV                         wp_update_post(array( 'ID' => $post->ID, 'menu_order' => $menu_order ));                         continue;                     }                          // NOTHING LEFT TO DO - NUMBER ALREADY PADDED                     if ( isset($menu_order) && $menu_order > $sibling->menu_order )                         break;                           // NEED TO UPDATE THE SIBLING MENU ORDER                     if ( isset($menu_order) ) {                         $menu_order--;                         // UPDATE THE ACTUAL MOVED POST TO 1 AFTER PREV                         wp_update_post(array( 'ID' => $sibling->ID, 'menu_order' => $menu_order ));                      }                        endforeach;             }                  // FETCH ALL THE SIBLINGS WITH RELATIVE ORDERING AND IF THE MOVED POST HAS CHILDREN REFRESH THE PAGE             $children = get_posts(array( 'depth' => 1, 'numberposts' => 1, 'post_type' => $post->post_type, 'post_status' => 'publish,pending,draft,future,private', 'post_parent' => $post->ID ));             if ( !empty($children) )                 die('children');             die();         }      **2nd Steps** Because we the script below calls a custom js file we need to crate and include this file as well. If you don't want to modify the script above then go and create a folder in the root directory of your theme folder and call it "custom". Next, within this folder create another folder called "js". Next create a new file within this folder called "page-resorting.js" and past the following code into that file. After this is done you should be able to reorder through drag/drop all pages in the admin area.               /////////////////////////////////////////////////////////////////////////////////////////////////////     // THIS SCRIPT APPLIES TO THE CUSTOM SCRIPT MODIFICATION ALLOWING HIERARCHICAL PAGES TO BE REORDERED     /////////////////////////////////////////////////////////////////////////////////////////////////////               jQuery("table.widefat tbody").sortable({           cursor: 'move',         axis: 'y',         containment: 'table.widefat',         scrollSensitivity: 40,         helper: function(e, ui) {                                ui.children().each(function() { jQuery(this).width(jQuery(this).width()); });             return ui;         },         start: function(event, ui) {             if ( ! ui.item.hasClass('alternate') ) ui.item.css( 'background-color', '#ffffff' );             ui.item.children('td, th').css('border','none');             ui.item.css( 'outline', '1px solid #dfdfdf' );         },         stop: function(event, ui) {                  ui.item.removeAttr('style');             ui.item.children('td, th').removeAttr('style');         },         update: function(event, ui) {                if ( ui.item.hasClass('inline-editor') ) {                 jQuery("table.widefat tbody").sortable('cancel');                 alert( 'Please close the quick editor before reordering this item.' );                 return;             }                  var postid = ui.item.find('.check-column input').val(); // THIS POST ID             var postparent = ui.item.find('.post_parent').html();   // POST PARENT                  var prevpostid = ui.item.prev().find('.check-column input').val();             var nextpostid = ui.item.next().find('.check-column input').val();                  // can only sort in same tree                  var prevpostparent = undefined;             if ( prevpostid != undefined ) {                 var prevpostparent = ui.item.prev().find('.post_parent').html()                 if ( prevpostparent != postparent) prevpostid = undefined;             }                  var nextpostparent = undefined;             if ( nextpostid != undefined ) {                 nextpostparent = ui.item.next().find('.post_parent').html();                 if ( nextpostparent != postparent) nextpostid = undefined;             }                     // DISPLAY AN ALERT MESSAGE IF ANY OF THE FOLLOWING TAKES PLACE             // IF PREVIOUS AND NEXT ARE NOT AT THE SAME TREE LEVEL OR NOT AT THE SAME TREE LEVEL AND THE PREVIOUS PAGE IS THE PARENT OF THE NEXT OR JUST MOVED BENEATH ITS OWN CHILDREN                                  if ( ( prevpostid == undefined && nextpostid == undefined ) || ( nextpostid == undefined && nextpostparent == prevpostid ) || ( nextpostid != undefined && prevpostparent == postid ) ) {                 jQuery("table.widefat tbody").sortable('cancel');                 alert( "SORRY, THIS ACTION IS NOT POSSIBLE!\n\n>>> WHY THIS DOES NOT WORK:\nDrag-and-Drop capabilities only work for items within their current tree.\n\n>>> HERE IS HOW YOU CAN MOVE IT:\nIn order to move this item to the location you specified you simply need to use the \"Quick Edit\" link and modify the associated \"Parent\" page.\n\n>>> LOCATING THE QUICK EDIT LINK:\nOn the post you want to move, just hover over the post title and click on the \"Quick Edit\" link which appears below the title." );                 return;             }                  // SHOW AJAX SPINNING SAVE ELEMENT             ui.item.find('.check-column input').hide().after('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />');                  // EXECUTE THE SORTING VIA AJAX             jQuery.post( ajaxurl, { action: 'simple_page_ordering', id: postid, previd: prevpostid, nextid: nextpostid }, function(response){                            if ( response == 'children' ) window.location.reload();                 else ui.item.find('.check-column input').show().siblings('img').remove();             });                  // FIX CELL COLORS             jQuery( 'table.widefat tbody tr' ).each(function(){                 var i = jQuery('table.widefat tbody tr').index(this);                 if ( i%2 == 0 ) jQuery(this).addClass('alternate');                 else jQuery(this).removeClass('alternate');             });         }     }).disableSelection();


title: Hide metabox dependant on page template chosen

text: I'm using the following JQuery script from this answer to toggle the display of metaboxes dependant on the Page Template selected. The example below shows the **featured image** metabox when the **default** template is selected:               (function($){     $(function() {              $('#page_template').change(function() {             $('#postimagediv').toggle($(this).val() == 'default');         }).change();          });     })(jQuery);      My possibly simple question is... How do I get this code to only show the featured image box for my Page Template entitled: **Services**? I have tried simply changing the `'default'` to '`Services'` but no luck.


title: How to override normal Wordpress search in Buddypress?

text: hi i have wordpress and buddypress installed and i wanted to be able to search through forum posts, blog posts and other info all over the site. i found Search Engine (Wordpress Plugin) and installed it. after a brief indexing process i was able to perform all of my search requests but the problem is that when this plugin is enabled and i try to search for something inside the wp-admin, there are no results. when i turn the plguin off the wp- admin search runs. i also tried google search plugin but the outcome was the same. how can i keep my search plugin and the normal plugin work together? thanks


title: Viewing post while editing

text: While the wordpress editor is great, it's not completely WYSIWYG. Various CSS settings from the theme aren't displayed in the editor. Is there a plug-in that will make the editor more WYSIWYG by loading the CSS? Even a plug-in that adds a frame in the post-edit page that shows the post being edited will be good enough. I just want to see how the post will look like without having to open multiple tabs on my browser.


title: Passing arguments to a admin menu page callback?

text: **Situation:** I'm working on a plugin and I'm developing it as a class, everything worked fine until I run into this situation. I wanted to make things a bit cleaner and tried this..               class MyPlugin {         function __construct() {             add_action('admin_menu', array(&$this, 'myplugin_create_menus');         }                      //I don't want to write a function for every options page I create         //so I prefer to just load the content from an external file.                 function load_view($filename) {             $view = require(dirname(__FILE__).'/views/'.$filename.'.php');             return $view;         }              //Here is where the problem comes         function myplugin_create_menus() {             add_menu_page( 'Plugin name',                            'Plugin name',                            'manage_options',                            'my-plugin-settings',                            array(&$this, 'load_view') // Where do I specify the value of $filename??                          );         }          }#end of class      I've tried a bunch of different options but nothing works, maybe I'm in front of it but I can't see it. Of course this is a re-creation, I've prefixed all my functions and they are not exactly as I wrote here but I hope you got the idea of I'm asking for. **Thanks in advance.** P.D.: If you want to see the original source code I'll be glad to paste it and give you the link.


title: add different stylesheet file to edit themes file list

text: I am not sure if the title makes sense so feel free to suggest a different one. Anyways… In Wordpress dashboard _Appearance -> Editor_ page I would like to load _app.css_ file located in current theme's _assets/css/_ directory. How can I achieve this?


title: Stream Video Player does not work with do_shortcode()?

text: I have downloaded a plugin called Stream Video Player, which has a shortcode. If I put the shortcode into the content editor, it works well and it displays the video. However, if, inside a template I am creating, I call it through the `do_shortcode()` function, it doesn't work, it just shows the text `[stream bla bla]`. Can anyone help me and tell me why this is happening?


title: Adding "latest from the blog" to the homepage

text: I have a big problem and no clue how to solve it :) I want to add a "module" to my homepage (static homepage, not blog posts) that will display the 2 latest blog posts in a very particular way and link back to them. The posts would only display on the homepage and not every other page but the php template used for the page is shared with all the custom pages. Here is a quick sketch of it ![Photo of a paper sketch](http://i.stack.imgur.com/Zuaiu.jpg) A site that does this beautifully on their homepage is SEOmoz ( but i don't need that much functionality, only blog post title, thumb, excerpt & link to read more ) ![Screenshot from seomoz.org](http://i.stack.imgur.com/9l4LT.png) Is there a simple way to do this? (plugins, code you can copy/paste from anywhere?) or can I pay someone to write this up for me?


title: Removing custom background and header feature in child theme

text: I am creating a child theme using twentyten as my base. I am looking for a way to remove the features of adding custom header and background without touching `functions.php` file in the parent theme. no luck with this :(               function my_child_theme_setup() {         remove_theme_support('custom-background');         remove_theme_support('custom-header');     }          add_action( 'after_setup_theme', 'my_child_theme_setup' );


title: Custom Post taxonomy template

text: Friends I need help. Am extending the Mayashop theme for a friend & I ran into a problem. Created a custom post type named watchdog, created a taxonomy for it called watchdog-brand ... now the single-watchdog.php template is working just fine but I can't seem to find the appropriate template for the term itself listing all of the watchdog items under it. Tried archive-watchdog.php , archive-watchdog-brand.php but no luck ... any idea? I also found out that it doesn't even fallback to the archive.php .. just straight forward to the index.php file & here is the code for the custom_post & the taxonomy               register_post_type(                 TYPE_WATCHDOG,        array(          'description' => __('Watchdog', 'yiw'),          'exclude_from_search' => false,          'show_ui' => true,          'labels' => yiw_label( apply_filters( 'yiw_watchdog_label_singular', __('Product', 'yiw') ), apply_filters( 'yiw_watchdog_label_plural', __('Products', 'yiw') ), __('Watchdog', 'yiw') ),          'supports' => array( 'title', 'editor', 'thumbnail', 'custom-fields' ),          'public' => true,          'capability_type' => 'post',          'publicly_queryable' => true,          'rewrite' => array( 'slug' => apply_filters( 'yiw_watchdog_rewrite', 'watchdog' ), 'with_front' => true )        )     );           flush_rewrite_rules();               register_taxonomy('watchdog-brand', array( TYPE_WATCHDOG ), array(         'hierarchical' => true,         'labels' => yiw_label_tax(__('Brand', 'yiw'), __('Brands', 'yiw')),         'show_ui' => true,          'show_in_nav_menus' => true,         'query_var' => true,         'rewrite' => array( 'slug' => 'watchdog-brand', 'with_front' => false )     ));     flush_rewrite_rules();      Thanks in advance


title: WPDB preparing delete from

text: I know my variables and functions are ok, it must be the way I have added the prepare that is stopping it working.               function delete_record($table, $id) { //deletes a specific record     global $wpdb;     $table_name = get_database_prefix() . $table;     delete_images($table, $id);     $wpdb->query( $wpdb->prepare(          " DELETE FROM %s WHERE %s = %d ",         $table_name,         get_id_name($table),         $id     ) );     return $wpdb;     }      I am getting the error: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ''wp_tablename' WHERE 'id' = 1' at line 1 Thanks Alex


title: Is it possible to wrap Geo Location search around WP_Query?

text: I'll just like to add that I have a current working solution in place and works well but I'm looking for ideas of being able to do it better or cleaner if possible. We have hundreds of properties in a custom post type with metakey/metavalue holding the properties longitude and latitude co-ordinates. We allow a visitor to type in a location and a radius to search for those properties in that area. Kind of like a store locator. Here is how I'm doing it at the moment:               // Work out square radius     if(!empty($_SESSION['s_property_radius'])) {$dist = $_SESSION['s_property_radius'];}else{$dist = 50;}     $orig_lat = $_SESSION['s_property_address_lat'];     $orig_lon = $_SESSION['s_property_address_lng'];     $lon1 = $orig_lon - $dist / abs( cos( deg2rad( $orig_lat ) ) * 69 );     $lon2 = $orig_lon + $dist / abs( cos( deg2rad( $orig_lat ) ) * 69 );     $lat1 = $orig_lat - ( $dist / 69 );     $lat2 = $orig_lat + ( $dist / 69 );          // Compile a map search query to get all property ID's.     $mapsearchquery = "                 SELECT `t`.`ID`                 , 3956 * 2 * ASIN( SQRT( POWER( SIN( ( ".$orig_lat." - CAST(`t`.`property_address_lat` AS DECIMAL(9,6)) ) * pi() / 180 / 2), 2 ) + COS( ".$orig_lat." * pi() / 180) * COS( CAST(`t`.`property_address_lat` AS DECIMAL(9,6)) * pi() / 180 ) * POWER( SIN( ( ".$orig_lon." - CAST(`t`.`property_address_lng` AS DECIMAL(9,6)) ) * pi() / 180 / 2 ), 2 ) ) ) AS `distance`                  FROM (                      SELECT `$wpdb->posts`.`ID`                 , MAX(CASE WHEN `$wpdb->postmeta`.`meta_key` = 'chb_homes_for_sale_address_longitude' THEN `$wpdb->postmeta`.`meta_value` END ) AS `property_address_lng`                 , MAX(CASE WHEN `$wpdb->postmeta`.`meta_key` = 'chb_homes_for_sale_address_latitude' THEN `$wpdb->postmeta`.`meta_value` END ) AS `property_address_lat`                 FROM `$wpdb->posts`                  LEFT JOIN `$wpdb->postmeta` ON ( `$wpdb->posts`.`ID` = `$wpdb->postmeta`.`post_id` )                  WHERE `$wpdb->posts`.`post_status` = 'publish'                  AND `$wpdb->posts`.`post_type` = 'homes-for-sale'                  GROUP BY `$wpdb->posts`.`ID`                  HAVING CAST(`property_address_lng` AS DECIMAL(9,6)) BETWEEN '".$lon1."' AND '".$lon2."' AND CAST(`property_address_lat` AS DECIMAL(9,6)) BETWEEN '".$lat1."' AND '".$lat2."'                      ) AS `t`                 HAVING `distance` < ".$dist."             ";          // Just get the ID's     $mapsearchresults = $wpdb->get_col($mapsearchquery);      This returns an array of all post id's that are within the users search parameters. I then past that array to WP_Query to only show posts that have the above ID's using `post__in`. Also I can do other search criteria on the WP_Query afterwards. In the above query I do a square radius check and I know this could be easily done in WP_Query using `meta_query`. But where I get stuck is running the circle radius check. Is there a way I can wrap this in WP_Query? Basically what I'm after is trying to do this all in one rather than doing two lots of queries.


title: WordPress Skeleton installation

text: I'm trying to set up a local WordPress installation using WordPress Skeleton, so that I can eventually use WP Stack. I've created a local folder called vcip.com and the local hosts rules to resolve kdev.vcip.com to that location. I went to the WordPress Skeleton GitHub page and downloaded the zip file of the repo. I unpacked the files into my vcip.com folder. I then installed the Git submodule for the wp folder. I set up a local database and user, and added the details to the local-config- sample.php file, and then changed that file to local-config.php. I also added the salts in wp-config. When I visit kdev.vcip.com I get redirected to http://kdev.vcip.com/wp- admin/install.php (local url) and get the message "This webpage has a redirect loop". Have I missed something in the set up? Are there any more variables to configure? Do I need to remove any files from the wp folder? Thanks in advance for your help.


title: Custom Single Post By Category

text: I'm trying to get up to speed with the terminology of the ins and outs of WordPress, so apologies. I'm setting up a full site utilizing WordPress and a custom template, basing it on TwentyTen underpinnings. I'm trying to have as much as possible under the "post" Post Type, and the top level "list" pages just be the category pages. One category is "work" I've been able to customize those by making custom category-work.php and loop- work.php files. But how do I go about making a custom single post by category? It looks like making a single-work.php would look for a custom post type called "work." Is there a way to make a single.php modified clone that is triggered by category / category slug?


title: How to dynamically filter the results in the Admin Box

text: I'm using P2P to link two CPT. I already connected the two CPT but the default admin box can't fit my needs. Imagine this scenario: CPT 1 have a custom field of YES or NO choice (0 or 1 in database) and is the FROM for P2P. In the CPT 2 I need a custom box for P2P with a select field (YES, NO or BOTH) that filters the results that the P2P brings to connect. Like if Yes is selected the results should show only posts from CPT 1 that contains the custom field market at YES, and vice-versa, dynamically when user is creating a new post in CPT two. I'm new to PHP and WordPress development and don't know where to start that... http://wordpress.org/plugins/posts-to-posts/


title: List child pages by slug not ID?

text: I am looking to use the wp_list_pages function to show children pages of a specific page ID. I was able to do this easily, but now I found an issue with it. I am running a Wordpress network of sites (total of 8). I am trying to set this up where I will only need 2 theme folders because there are 2 main blogs with 3 sub sites that fall under each. So, I am trying to make as many dynamic calls in my theme files as possible to prevent duplicating themes for each site. In my sidebar I am using the following code:               <ul>     <?         wp_list_pages('orderby=name&depth=1&order=DESC&show_count=0&child_of=10&title_li=');     ?>     </ul>      The issue I am running in to is, on each of the sub sites the page ID's have changed but my sitemap for the most part has not. So on my main site child_of=10 displays the proper sub pages in my sidebar, but in my sub-sites the child_of=10 is a different page so I am not getting the proper child pages to display. I had a similar issue with pulling in posts but I was able to do the following:               <?         $category = get_category_by_slug('news');         wp_list_categories('orderby=name&order=DESC&show_count=0&exclude=53&title_li=&child_of='.$category->term_id);     ?>      I am trying to achieve a similar solution for wp_list_pages where I use a page slug to identify the child pages instead of the page ID. Been digging around and trying a few posts I have found on Google / here but no luck. Hoping someone can help me out.


title: Why does is_front_page and is_home always return true for posts in wordpress?

text: My front page is just a list of the posts separated by category. I'm working on a plugin that get the id of the post but needs to test if the user is currently on the front page:               if(is_front_page()){          do this thing     }     else {          do this other thing     }      problem is, on the post pages it returns true for is_front_page. I tried is_home but get the same result. I have the home in admin set to "latest posts" (not a static page) and displaying the posts on the main page via loop-home. I'm using is_home in the header and getting the correct response.


title: How does W3 Total Cache Load Images In Stylesheet via CDN?

text: W3 Total Cache uses all the PHP / WordPress API trickery at hand to make sure all static content (CSS, JS, Images, etc.) is served from the CDN URL. But how does it make sure that even the images referenced in my CSS/stylesheet file are also served from the CDN URL? I checked my CSS file, the path to the images hasn't changed. It's weird how W3TC does that. Does anyone know?


title: Shortcode perfomance solution

text:
I have a site that is performance critical. Doing shortcodes I thought about the time the server needs to parse and return the content, instead to allow some HTML (`<div class="redletter">`) to go through the TinyMCE editor. In the meantime, my code for that is:               // [redletter]Content[/redletter]     add_shortcode('redletter', 'redletter_do');     function redletter_do($atts, $content = null)  {         return '<div class="redletter"' . do_shortcode($content) . '
';     }      Performance critical or not, I think that nothing could beat a button to allow a `<div>` pass through directly in the visual editor and show - like it does when you press the [B] button to make `<strong>`. So, i'm between keeping the shortcode, or making a TinyMCE button for `<div class="redletter">` and showing the result in the visual editor.


title: plugin to upload to youtube via wordpress

text: before you say it, i know that in most situations it's _easier_ to do this the other way around (i.e. upload via yt site then embed) but i _need_ a plugin to upload/manage yt videos via the wordpress admin interface. ive scanned through the plugin directory but cant see any good options. can anyone suggest anything worthy? hopefully something that uses the youtube api: https://developers.google.com/youtube/ thank you!


title: wp_enqueue_script does not recognize my js file?

text: my wp_enqueue_script does not seem to work, i can't understand why : i have a child theme of twenty ten,   i wrote this in my functions.php file (in my theme) :               <?php     function my_scripts_method() {         wp_enqueue_script(             'patScript',             get_stylesheet_directory_uri() . '/js/patScript.js',             array('jquery')         );     }     add_action('wp_enqueue_scripts', 'my_scripts_method');     ?>      then in my header :               <script type="text/javascript" src="<?php get_stylesheet_directory_uri().'/js/patScript.js'; ?>"></script>      and the file is :               $(function () {         alert("hello");     });      But alert does not work. The path is correct, when i echo get_stylesheet... it gives me the right path where my file is located. Would you have any idea? Thanks a lot * * * EDIT : the console in Firefox tells me that :               $(function () {      "is not a function" : does it mean it does not recognize jquery? i added :               wp_enqueue_script("jquery");      above my previous enqueue script, but same thing...


title: Problem with multisite search

text: I have a question. I am using multi-site on WP 3.6.1 and I am using ShopperPress theme. I have some code and want to try use multisite search. It's working but listing not correctly. Each search doing separating blog to blog. This is my website. Here is example search: http://newinternetshopping.com/?s=example That code you can download from here: http.//newinternetshopping.com/multisite_search.txt Which code should I use for correct listing? Thanks. Best regards, Veli


title: How to create a button for importing demo content (.xml file)

text: I want to create a button (Import Demo Content) in my theme option panel. If user click Import Demo Content button then selected .xml file uploaded automatically and send successful message. I searched in Google but unfortunately I don’t find such type of article or tutorial. Most of the results suggest plugging. But I don’t want to use plugging. Thanks


title: Remove all links to a specific website

text:
So, my cousin owns a fashion blog and she recently had a fall out with a brand of shoes and she wants to remove all the links on all posts that point to the brand website. So, is there a way I can automatically via SQL commands or maybe a plugin check all posts on the blog and turn links like this:
Awesome Product 1
      Into just text without links:
Awesome Product 1
      The ideia is basically to find all links starting with `http://specific- url.com/` and remove the `<a>`tag. Thank you.


title: is it possible to run some php code within a wordpress page?

text: I'd like to access a DB table and render it in some data grid format using php on a dedicated wordpress page, accessible to members of a certain group. Is this at all possible with wordpress or is there another way to do so? using wp 3.5 on linux system + mysql thanks


title: How do I display the latest Flickr OAuth embedded image on the frontpage?

text: I have a Flickr category among my blogposts where I just paste in the direct links from Flickr, and let OAuth do it's thing to hotlink/embed the photos in the post. On my frontpage I am trying to grab the latest hotlinked/embedded photo from the latest post in the Flickr category in order to display it there. But with no success. I've tried with the `get_the_image();` plugin, but it seems to only read photos that have been inserted into the post using the wordpress gallery. I manage to get `the_title();`, so I know I'm accessing to the right category and post, but I don't have any chance of displaying the image. Does anyone know how I can achieve this? **Update:** I've achieved this with the following code:               query_posts('category_name=flickr&showposts=1');     if ( have_posts() ) : while ( have_posts() ) : the_post();          $meta = get_post_custom();           $photos = array();     foreach ($meta as $key => $value)         if (false !== strpos($key, 'oembed'))             array_push($photos, $value[0]);                          if(preg_match('/src="(.+\.jpg)"/i', $photos[0], $m)) {             echo '<img src="' . $m[1] . '" />';         }          endwhile;     endif;      Unfortunatly that embeddes the full size image from Flickr. I tried combining it with TimThumb, but with no success. Small steps...


title: Link to File URL by default

text: Every time I insert an image into my post, the default link is to the image attachment page. How can I change it so it always links to the File address?


title: Hide a page title in Wordpress 3.0

text: I can't find the option to hide the page title. Is there some other plugin required to get this functionality? If you look in this video video you can see the option to set the page title. I don't have this option. I'm not looking for a code solution here, I need something which will allow end users to hide the title.


title: Semi-Private Comments + page comments -> is it possible?

text: is it possible to do this:   * User need to register and can only see comments written by himself or by an admin. Admins can see all comments   * create a profile page that user can see all their comments related to all posts thanks


title: Edit part of a post

text: In some wikis (e.g., mediawiki), if you want to edit part of a page, you can either click an edit link that lets you edit the entire page -- or, if you just want to edit a single section of the page, you can edit just that one section. This is beneficial because it helps avoid conflicting edits by multiple different editors. Does Wordpress have any way to support this? Perhaps via some plugin? The idea is that I should be able to create a post with multiple sections (separated by headings with style Heading 1, say). Then there should be a way to edit just a single section at a time, so that Alice can edit section 1 and Bob can edit section 2 at the same time, without risk of a conflict due to their simultaneous operations. Is there a way to do it?


title: How to get my plug-in, wrote in php, to refresh on its own every 5 minutes?

text: I wrote a plugin with custom widgets for the Dashboard. It retrieves information from an XML file, and display the information into the widget. The XML file will be modified a bit every few minutes or so. Right now my plugin works perfectly if the user refreshes the page, it will also grab the new XML file and display the new one, but I would like that the widget refreshes the information without having to reload the page. I assume JS/JQuery will be needed for this, but I'd just like some advice so I can be in the right direction. Thanks!


title: Upload media files to Amazon S3

text: I have a site that is running on AppFog.com, and they don't have persistent file storage for things like images uploaded through the wordpress media uploader. The theme I am making for the site includes the Amazon S3 PHP class for some other functionality - and I have that working. What I would now like to do is hook that into the media uploader so that when images are uploaded to my site they also get uploaded to Amazon S3. So I guess what I want is to know what filters are used when uploading media so that I can hook into them and also upload the images (and the relevant thumbnails) to S3. I tried looking through the source but haven't had any joy so far. I should point out that I don't really want to use a plugin to do this - but I am happy to learn from a plugin if anyone has any pointers. Also - since I am using AppFog I don't have access to the server and so can't install anything beyond PHP apps.


title: Template for individual post designs

text: I browsed through the suggested posts, and couldn't find anything that was exactly answering my question. I apologize in advance if I'm reposting something obvious here, but there you have it. I want to make a theme that makes it easy to hand-craft my (single page) posts as if I was living without a CMS at all. I do still want these posts to have the benefits of being archived, perma-linked, getting stats, using the media library and so forth from WP, but I want the authoring flow to be as if I started with a blank folder with a "index.html", a "style.css" and a "scripts.js" file every time. It's been a while since I was working with WP, but here's a sort of a checklist of stuff I want.   * The ability to "toggle" which parts of the loop are visible and which aren't. ("toggle date, toggle post title, toggle footer, toggle footer elements, toggle comments link, etc".)   * The ability to specify in the WP authoring space a CSS file and a JS file specific to that post. I guess entering this into textareas would suffice as well.    * Uploading images for backgrounds and other design-related images to a place that's coupled to the post directly rather than just uploading them to a folder via FTP and using the direct links. I'm not sure I'm communicating very well here, but imagine that my motivation is that when I create a post I want full control over how that post looks (again, in single post view) as if I'd designed it from scratch, but I want to take advantage of the handy mark-up that WP creates and the content management abilities of WP. If you _do_ understand what I'm getting at I'd love some pointers to where to start in form of links to themes that incorporate some or several of these features, advice on how to go about letting each post have a dedicated folder with belonging styles, scripts and images without making a godawful mess and so forth. If you _don't_ understand what I'm talking about I'd really love for you to help me out by telling me where I'm being fuzzy so that I can clarify my ideas a bit. Thanks in advance, Martin


title: Remove link from Page name in navigation bar

text: I have a wordpress site and there is a navigation bar with menu and submenu. I want to remove link attribute from menu items that have sub menu. Is it possible? because i couldn't achieve to this by this function : `wp_list_page()`.


title: Allowing Anyone to Register Subdomains on .COM (Currently on .ORG), for WordPress Multisite?

text: My current site is example.org. What I want to do is allow anyone to register a WordPress multisite on the exmaple.com version of my site. I'm sure you can do this but just don't know exactly how, I've been looking for hours for this but still no luck. Thanks in advance!


title: How would I create a shortcode to display a custom post within a page or regular post?

text: I would like to create a shortcode that will extract information for a custom post, and display it within a Page or regular Post. Specific use case: I have a custom post type "Film" for a film festival website. The films are displayed with their own single-film.php, but occasionally the site owners want to write a post or page that mentions a particular film, and would like to be able to pull snippets of the info that has already been entered (eg, Film name, booking info, etc). This would go in a "box" at the bottom of the post, and I'd like to make it easy for them by providing some sort of shortcode. How would I go about doing this? Any recommended resources/tutorials to get me on the right track? What gotchas should I be aware of (eg, multiple loops in a post)?


title: Displaying the number of posts in a custom loop (without including the number of posts of a loop below)?

text:
I have this custom loop:               <?php // Display the top ones         $args = array(             'post_type' => 'reply',             'post_parent' => $post->ID,             'r_sortby' => 'highest_rated',             'r_orderby' => 'desc',             'order' => 'DESC'         );     ?>               <?php query_posts( $args ); ?>
          <?php while ( have_posts() ) : the_post(); ?>
<?php _e( 'Top Replies' ); ?>

                 <?php bbp_reply_author_link( array( 'type' => 'avatar' ) ); ?>

                 <?php bbp_reply_author_link( array( 'type' => 'name' ) ); ?>                 <?php bbp_reply_admin_links(); ?>                 <?php printf( __( '%1$s at %2$s', 'bbpress' ), get_the_date(), esc_attr( get_the_time() ) ); ?>                 <?php bbp_reply_content(); ?>
                 <?php if(function_exists('the_ratings')) { the_ratings(); } ?>

              <?php $most_voted[] = get_the_ID(); // get the id of the most voted post ?>          <?php endwhile; ?>      I would like to retrieve the number of posts (only in this loop). (The is another loop below). Any suggestions?


title: How can HTML be allowed in Author Bio?

text: Is there a way to prevent WP from stripping the HTML from the author bio? I need it to keep my paragraphs. Thanks in advance! :) Edit - Although this question has been answered, I will clarify that I was referring to the Bio textarea when editing individual users.


title: Backup localhost (wamp) database (phpmyadmin) from harddrive files on windows? For WordPress?

text: Is it possible to backup files from a old hard drive without having access to phpmyadmin? Could someone point me in the right direction?


title: highlight parent page on menu when child page is on sidebar (and not on menu)

text: i'm using twenty-eleven, i have on the menu 4 items : Home, About us, Contact, Clients it's a custom menu. The site currently is on localhost, so no preview is available. However i haven't put the child pages on the menu. (as a dropdown menu) I've put them on side bar. Now, Whenever i'm on eg Home page and select a child page from About us (our team) i want the About us page to be highlighted on the menu. I've looked almost everything, assigning classes, .current_page_parent but nothing works. Any help is much appreciated. :) Thanks


title: Overrride buddypress theme function

text: I'm using the buddypress theme buddyboss. the main reason was that this theme is able to manage a picture gallery (which works great). i now want to call that picture-function within the members-loop. one of the buddyboss-admins told me: > "you will need the functions from buddy_boss_pics.php. Specifically you need > to use function buddyboss_pics_screen_picture_grid_content() starting from > line: 285. You will need to edit the file to work with the members-loop > since it currently uses displayed_user_id." this is how the function looks:               function buddyboss_pics_screen_picture_grid_content()     {         global $bp, $wpdb, $bbpics;              $wpdb->show_errors = BUDDY_BOSS_DEBUG;              $img_size = is_active_sidebar( 'Profile' ) ? 'buddyboss_pic_med' : 'buddyboss_pic_wide';              $gallery_class = is_active_sidebar( 'Profile' ) ? 'gallery has-sidebar' : 'gallery';              $user_id = $bp->displayed_user->id;         $activity_table = $wpdb->prefix."bp_activity";         $activity_meta_table = $wpdb->prefix."bp_activity_meta";              $pages_sql = "SELECT COUNT(*) FROM $activity_table a INNER JOIN $activity_meta_table am ON a.id = am.activity_id WHERE a.user_id = $user_id AND meta_key = 'bboss_pics_aid'";              $bbpics->grid_num_pics = $wpdb->get_var($pages_sql);              $bbpics->grid_current_page = isset( $_GET['page'] ) ? (int) $_GET['page'] : 1;              // Prepare a SQL query to retrieve the activity posts          // that have pictures associated with them         $sql = "SELECT a.*, am.meta_value FROM $activity_table a INNER JOIN $activity_meta_table am ON a.id = am.activity_id WHERE a.user_id = $user_id AND meta_key = 'bboss_pics_aid' ORDER BY a.date_recorded DESC";              buddy_boss_log("SQL: $sql");              $pics  = $wpdb->get_results($sql,ARRAY_A);              $bbpics->grid_pagination = new BuddyBoss_Paginated( $pics, $bbpics->grid_pics_per_page, $bbpics->grid_current_page );              buddy_boss_log("RESULT: $pics");              // If we have results let's print out a simple grid         if ( !empty( $pics ) )         {             $bbpics->grid_had_pics = true;             $bbpics->grid_num_pics = count( $pics );      How should I change the function?


title: how to show custom menu in category and its posts?

text:
I have a category X of posts. The category page and it's individual posts are all part of a custom menu consisting of pages and posts. My submenu, in the sidebar, works fine for showing on the pages, but doesn't show up at all on the category page or any of its posts. How can I get it to show up? edit: I solved this, see below (in the comments) for explanations of my two solutions. solution 1:               <?php if( is_singular('menus')) { ?>
<?php wp_list_pages('title_li=&child_of=8'); ?>
              <?php } ?>      Solution 2:               <?php if( is_singular('venues'))  { ?>                <?php wp_nav_menu(array ("theme_location" => "venue-menu")) ?>            <?php } ?>


title: Settings options not showing up on Sub Menu page in WordPress plugin

text:
So I have a plugin with two user-customisable settings. (It's not complete but I'm getting the framework in place.) When the two settings are on the "general" settings page they work just fine...               add_action('admin_init', 'mj_admin_init');     function mj_admin_init(){         register_setting('general', 'mj_options', 'mj_validate_input');         add_settings_section('mjid', 'MJ Settings', 'mj_callback', 'general');         add_settings_field('mj_notify_email', 'Email', 'mj_email_input', 'general', 'mjid');         add_settings_field('mj_cm_enabled', 'Enable Messages', 'mj_cm_enabled_input', 'general', 'mjid');     }          add_action('admin_menu', 'mj_admin_menu');     function mj_admin_menu(){         do_settings_sections('mjid');     }          function mj_admin(){         // to-do later     }          function mj_callback(){         echo '
MJ Callback function produced this
';     }          function mj_email_input(){         $options = get_option('mj_options');         $value = $options['mj_email'];         echo '<input id="mj_email" name="mj_options[mj_email]" type="text" value="'.esc_attr($value).'" /> Email address';     }          function mj_cm_enabled_input(){         $options = get_option('mj_options');         $value = $options['cm-enabled'];         echo '<input id="cm-enabled" name="mj_options[cm-enabled]" type="checkbox" value=1 '.checked(1, esc_attr($value), false).' /> Checkbox for enabled messages';     }               function mj_validate_input($input){         $valid = array();         $valid['mj_email'] = sanitize_email( $input['mj_email']);         if($valid['mj_email'] != $input['mj_email']) {             add_settings_error('mj_email_setting', 'mj_texterror', 'Invalid email', 'error');         }         $valid['cm-enabled'] = intval($input['cm-enabled']);         return $valid;     }      But I want to put them on a separate submenu page, called "mj-admin-settings". But, try as I might, they won't show up. All I get is the output of the "mj_callback" function. There are no errors in the error logs, even with debug set to true. To do the above I changed the `mj_admin_init` and `mj_admin_menu` functions to the following:               add_action('admin_init', 'mj_admin_init');     function mj_admin_init(){         register_setting('mj-admin-settings', 'mj_options', 'mj_validate_input');         add_settings_section('mjid', 'MJ Settings', 'mj_callback', 'mj-admin-settings');         add_settings_field('mj_notify_email', 'Email', 'mj_email_input', 'mj-admin-settings', 'mjid');         add_settings_field('mj_cm_enabled', 'Enable Messages', 'mj_cm_enabled_input', 'mj-admin-settings', 'mjid');     }          add_action('admin_menu', 'mj_admin_menu');     function mj_admin_menu(){         add_menu_page('MJ Admin', 'MJ Admin', 'manage_options', 'mj-admin-options', 'mj_admin');         add_submenu_page('mj-admin-options', 'MJ Admin - Settings', 'Settings', 'manage_options', 'mj-admin-settings', 'mj_callback');              do_settings_sections('mjid');     }      Does anyone have any ideas as to how I get the settings to display in the submenu please? I've been all over the codex and am stumped!


title: Add a select box to all widgets

text: I would like to add a default select box to all widgets placed in the sidebars of my site. This would allow to choose the color of the associated widget. Do you know how i can make this ? I know how to make a custom widget. Thank you


title: Can You Build Page Templates Without Extra Files

text: I'm very familiar creating page templates in WP and for this project I really just have one page template with an option to switch the sidebar from the right side to the left side. The problem is that I would hate to have all of that duplicate code in both templates especially since I'll just be swapping css classes on the two elements. Options:   * 2 separate Page templates   * Custom fields    * Custom taxonomies I'm thinking that having a custom taxonomy might be the best solution. The client would see a small box on the right side of the page titled `Visual Options` and there would be a checkbox for `Sidebar on right`. It is intuitive and it is DRY. Is there something else I didn't consider?


title: have_comments not true for logged out visitors?

text: For some strange reason, comments aren't being displayed when a user is _not_ logged in. I've done some extensive experimenting with comments.php without any success. Here's a reference to the example page: http://gycweb.org/by-this-will-all-men-know/ If you are logged in, you would see 3 comments. If you are not logged in, nothing but the form. Also, to add to the mystery, when "editing" the post from within the admin and clicking "show comments", it tries and is not able to load the comments. It appears that the "have_comments" conditional is failing for logged out users. I've also tried getting wp_list_comments to return the list with no success. I've checked for plugin conflicts and nothing obvious yet. Have any of you run into this? Any obvious answers?


title: Custom taxonomy labels won't display

text: I created two custom taxonomies (Majors and Seminar Types) related my custom post type CEMB Seminar and the labels on the menu, instead of showing the labels I put in are showing "Post Tags". See a screenshot here (I don't have enough reputation to post pics yet): https://picasaweb.google.com/112518288555484095597/WordPressIssues?authuser=0&authkey=Gv1sRgCNeKmKmS2J_ccQ&feat=directlink Here's the code I used to create the custom taxonomies:               // Register the Majors taxonomy     register_taxonomy( 'cemb_seminar_major', array( 'cemb_seminar' ), $major_args );          // Register the Seminar Types taxonomy     register_taxonomy( 'cemb_seminar_type', array( 'cemb_seminar' ), $types_args );          // Set up the Majors arguments     $major_args = array(          'rewrite' => array(             'slug' => 'major',             'with_front' => 'false'         ),         'labels' => array(             'name' => 'Majors',             'singular_name' => 'Major'         )            );          // Set up the Types arguments     $types_args = array(          'rewrite' => array(             'slug' => 'seminar-type',             'with_front' => 'false'         ),         'labels' => array(             'name' => 'Seminar Types',             'singular_name' => 'Seminar Type'         )     );      I thought maybe since I didn't include all the labels, it wasn't creating the labels correctly, so I later added:               'labels' => array(                 'name' => _x( 'Majors', 'taxonomy general name' ),                 'singular_name' => _x( 'Major', 'taxonomy singular name' ),                 'search_items' => __( 'Search Majors' ),                 'popular_items' => __( 'Popular Majors' ),                 'all_items' => __( 'All Majors' ),                 'edit_item' => __( 'Edit Major' ),                 'update_item' => __( 'Update Major' ),                 'add_new_item' => __( 'Add New Major' ),                 'new_item_name' => __( 'New Major' ),                 'separate_items_with_commas' => __( 'Separate majors with commas' ),                 'add_or_remove_items' => __( 'Add or remove majors' ),                 'choose_from_most_used' => __( 'Choose from the most popular majors' )             )      and               'labels' => array(                 'name' => _x( 'Seminar Types', 'taxonomy general name' ),                 'singular_name' => _x( 'Seminar Type', 'taxonomy singular name' ),                 'search_items' => __( 'Search Seminar Types' ),                 'popular_items' => __( 'Popular Seminar Types' ),                 'all_items' => __( 'All Seminar Types' ),                 'edit_item' => __( 'Edit Seminar Type' ),                 'update_item' => __( 'Update Seminar Type' ),                 'add_new_item' => __( 'Add New Seminar Type' ),                 'new_item_name' => __( 'New Seminar Type' ),                 'separate_items_with_commas' => __( 'Separate seminar types with commas' ),                 'add_or_remove_items' => __( 'Add or remove seminar types' ),                 'choose_from_most_used' => __( 'Choose from the most popular seminar types' )             )      But neither changed helped. I noticed my custom post type also didn't have all the labels customized, so I added the labels to that code and the menu changed to reflect the newly added labels, but the custom taxonomies won't do that. What did I do wrong and how do I fix it?


title: Load the last post of a category

text: I would like to load the last post when I go to the selected category. For example   if I go to `http://site.com/category`   it loads `http://site.com/category/35/this-is-the-last-post` Does exist some example to follow about that? I'm doing practice with Wordpress and I don't know how can I get the `last post` of a category.


title: Create a shortcode in Wordpress, again

text: There're lots of examples both here and on the internet, I've tried but don't seem to be able to achieve what I need although it does feel like it should be simple enough. Basically, I want to be able to use a shortcode like this:               [download]http://site.com/file.doc[/download]      and I need Wordpress to output this:               download file     preview file      Your help would be greatly appreciated. Thanks so much!


title: Gallery CSS Problem

text: Right now I'm using a code in the functions to override the default WordPress gallery CSS. But it seems for some reason that WP only wants to let me put 3 images per line in a gallery, despite my CSS. Anybody know how to fix this? My problem can be found here -> http://themeforward.com/demo2/features/gallery-2/ and my CSS is below.               /*////////////////////////////////////////////////////////////////////      //  Gallery     ////////////////////////////////////////////////////////////////////*/     .gallery {     margin:30px 0 auto!important;     text-align:center;     width:680px;     overflow:hidden;     background:#1a1a1a     }     .gallery-item {     float:left;     text-align:center;          background:#000     }     .gallery img {     display:inline     }     .gallery img:active {     }     .gallery-caption {     display:none;     font-size:.8em;     margin-left:0     }     .gal_img {     margin:20px auto 0!important;     text-align:center     }     .gal_caption p {     font-size:1.3em!important;     font-weight:640;     text-align:center;     font-family:Arial, Helvetica, sans-serif!important     }     .gal_description p {     font-size:1.1em!important;     text-align:center     }      EDIT:               //////////////////////////////////////// Gallery     add_filter('gallery_style',         create_function(             '$css',             'return preg_replace("#<style type=\'text/css\'>(.*?)</style>#s", "", $css);'             )         );          //////////////////////////////////////// Remove default gallery styling     add_filter( 'use_default_gallery_style', '__return_false' );


title: Get Products within Current Product Category

text:
~~I'm currently playing around with WOOCOMMERCE V2.0.13 and I'm trying to display each product from the current product category (e.g. Construction Products when on the Construction Page), I've managed to display the single products from within the current category but if the product is also in another category (e.g Construction and Enviroment) then the current category breaks and shows zero products either from Construction or Enviroment. If I could get some advice/help on displaying products from the current category and allow it to work with products that are in multiple categories I'd trully apreciate the help and time. I'm more than happy to recode this entire section to make it work, here is my code below please let me know if I've missed anything. Thank you.~~ Finally found the solution myself, I'd like to thank everyone for helping me.                   <?php if ( have_posts() ) : ?>         <?php woocommerce_product_loop_start(); ?>         <?php woocommerce_product_subcategories(); ?>

                     <?php while ( have_posts() ) : the_post(); ?>
                                <a href="<?php echo get_permalink(); ?>">                                 <?php                                     if ( has_post_thumbnail() ) {                                         $image = get_the_post_thumbnail( $post->ID, apply_filters( 'single_product_large_thumbnail_size', 'shop_single' ) );                                         $image_title = esc_attr( get_the_title( get_post_thumbnail_id() ) );                                         $image_link = get_permalink( $product_id );                                         $attachment_count   = count( $product->get_gallery_attachment_ids() );                                         echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '%s', $image_link, $image_title, $image ), $post->ID );                                     } else {                                         echo apply_filters( 'woocommerce_single_product_image_html', sprintf( '', woocommerce_placeholder_img_src() ), $post->ID );                                     }                                 ?>

                                     <a href="<?php echo get_permalink(); ?>"><?php the_title();?>                                                                                <?php if ( $price_html = $product->get_price_html()) { ?>                                                 <?php echo $price_html; ?>                                              <?php } ?>

                                     <?php                                         $excerpt = get_the_excerpt();                                         echo string_limit_words($excerpt,15);                                     ?>

                 <?php endwhile;?>

         <?php woocommerce_product_loop_end(); ?>     <?php endif; ?>


title: How to change custom post type position from backend

text: I have registerd a post type called **Books** in function.php and this post type will display only for editor role. Now when i am login with my dummy editor i am seeing two post type one is Books and second Profile. I want to change default selected Books post type not profile. What i want: My backed view **My Code:**               function codex_custom_init() {       $labels = array(         'name' => 'Books',         'singular_name' => 'Book',         'add_new' => 'Add New',         'add_new_item' => 'Add New Book',         'edit_item' => 'Edit Book',         'new_item' => 'New Book',         'all_items' => 'All Books',         'view_item' => 'View Book',         'search_items' => 'Search Books',         'not_found' =>  'No books found',         'not_found_in_trash' => 'No books found in Trash',          'parent_item_colon' => '',         'menu_name' => 'Books'       );            $args = array(         'labels' => $labels,         'public' => true,         'publicly_queryable' => true,         'show_ui' => true,          'show_in_menu' => true,          'query_var' => true,         'rewrite' => array( 'slug' => 'book' ),         'capability_type' => 'post',         'has_archive' => true,          'hierarchical' => false,         'menu_position' => null,         'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' )       );             register_post_type( 'book', $args );     }     add_action( 'init', 'codex_custom_init' );      Any ideas or suggestions? Thanks.


title: Filtered content appears in the excerpt

text: I am modifying the content using the "the_content" filter. But this filtering is seen in the excerpts also. Consider the following code,               function modify_content($content = ''){         return 'HELLO ALL' . $content;     }     add_filter('the_content', 'modify_content');      This works in the main content perfectly. * * * ![Filter content in the main post](http://i.stack.imgur.com/ofDaE.png) * * * ## But, if you see in the excerpt, the "HELLO ALL" text is printed, which is unwanted. ![enter image description here](http://i.stack.imgur.com/hZPSf.png) * * * How to avoid or remove the text in the excerpt ??? which is to be added only to the main content ?? I tried changing the priority but it is no use.. Thank you.


title: Permalinks don't work, Wordpress adds hashtag and postnumber

text: After moving a Wordpress website from one server to another, the custom permalinks don't work anymore. For example, a (perma)link that used to be /about/ is now /#/4/about, so a hashtag, post number and then then post name. If I type in the /about/ manually, it doesn't recognize it and I'm redirected to the homepage. When I click on the logo to go to the homepage, a /#/ hashtag is also added after the domainname. I have 'saved' the permalinks Wordpress option to recreate the htaccess file but doesn't make a different. Wordpress 3.5, Theme: Osaka 1.4 Plugins: All in One Favicon, Google Analytics for Wordpress Thanks for any suggestions on how to get the permalinks to work again!


title: Load a theme based on browser detection

text: Ok I know browser detection is considered bad practice but I can't find a way around it because I really do need whole different themes for a complex site. So I snatched this function from http://detectmobilebrowsers.com/               $useragent=$_SERVER['HTTP_USER_AGENT'];      if(preg_match('/android.+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|meego.+mobile|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i',$useragent)||preg_match('/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i',substr($useragent,0,4)))     header('Location: http://detectmobilebrowser.com/mobile');      not gonna make that fit this box So how I can I use this to load a specific theme that I already have uploaded to my themes folder?


title: get_post_terms not working as expected

text:
I have a custom post type called "Fruit" and under this I have a hierarchical taxonomy called, "Fruit Categories" When I create a new post under Fruit, I am able to assign it to a "term" - like you would with a normal post category, but under the Fruit Categories taxonomy. I've added three posts to Fruit, with each assigned to a single term respectively; "Apples", "Pears" and "Bananas". All this works fine, but now I want to create an archive page that simply lists the terms in a UL, for that custom post type, like so; mysite.com/fruit   * Apples   * Pears   * Bananas This problem I am facing is that every query I have used only seems to return the first term, Apples. The other two are not showing and I've tried many code snippets, all with the same avail. Some things I've tried;                   $term_list = wp_get_post_terms($post->ID, 'fruit_categories', array("fields" => "all"));  print_r($term_list);      And               $terms = wp_get_post_terms($post->ID,'fruit_categories');     $count = count($terms);          if ( $count > 0 ){         echo "
";         foreach ( $terms as $term ) {             echo '
slug, 'fruit_categories').'">'. $term->name . "
";         }         echo "
";     }      I also tried the tips suggested here, however, this still results in the same issue with just the first term being listed. http://stackoverflow.com/questions/15502811/display-current-post-custom- taxonomy-in-wordpress It's a fresh install with no plugins. Do I need to add a foreach loop to pull in the additional terms? Or is there something I am missing here? I've also been looking at wp_get_object_terms but I don't really understand how to use it. When I do a screen dump, I get the following on mysite/fruit Apples Array ( [0] => stdClass Object ( [term_id] => 43 [name] => Apples[slug] => apples [term_group] => 0 [term_taxonomy_id] => 43 [taxonomy] => fruit_categories [description] => [parent] => 0 [count] => 2 ) ) For what it's worth, here is my Custom Post Type and taxonomy registry code http://pastebin.com/K8kwuzqt Any help much appreciated.


title: two sites, same code, different presentation

text: I have created two web sites. One is "production" and the other "dev". Each is a virtual host and both are on a single server running apache. Both sites are loaded with the same code base: WP 3.5.1, a base theme and a child theme. This is not a multi-site setup; just two sites loaded in different directories. The page in question uses a page template. In the page template there is some switching in PHP code to choose what to display. The switching is based on the $current_user->ID. If ID is null or zero display a logon block otherwise look up some data to present. This works fine on the dev site. It does not work on the production site. Something is different. I checked .htaccess, the virtual host declaration in apache, and the settings for WP and the theme. They all appear to be the same. I have run delta checks on the code and the two sets of files are identical. What other config settings might be in play here?


title: How to have more post in a page than in your home page

text: I am new to the world of WordPress.   I own a new site and I'd like my home page to display the latest news and articles (which I accomplished to set in _Settings > Reading_ ), but I'd like another page to display all posts (not the whole post but a summary) without the need to press "previous page". e.x.   If I have 8 posts and I set maximum posts to be 4 in the settings menu, my home will have 4 posts. But I'd like the other page to have all 8 posts in summary without the need to press previous page to read other posts.   How can that be done?


title: Navigation menu displays permalinks

text: I am creating a theme from scratch and the navigation menu is disturbing me because it is displaying the permalinks after the menu item name. See this picture http://imagebin.org/212406 Link name (#permalink) is the result of `wp_nav_menu()` Setting e.g. `$before/$after` - yields text before/after (#permalink) The (#permalink) part is not displayed in the source. Since it's only Pages I tried wp_list_pages(), but that gives me the same result. Any ideas on how to remove those permalinks? I believe there is some 'default' setting for how links/menu items should be displayed but I don't know where to look. Thanks!


title: Wordpress & Ajax

text: I'm creating a plugin and I want to implement drag & drop capabilities that save the order of li's in a list and then displays that list on the front end of the website. I may be a little over my head as I don't know a lot about ajax. Are there any barebones and simple tutorials out there that explain something similar to this?


title: redirect pages with no content, instead of 404 error, using max_num_posts?

text: I have a site that has changed its pagination structure, resulting in a huge amount of 404 errors (more posts are being shown per page than previously, so there are lots of pages that were once indexed in search engines that are now 404'ing). What I want to do is create a function that will check whether a page number is greater than the max_num_pages value, and if that's the case interrupt the default wordpress behaviour which is to serve a 404 page, and instead 301 redirect it to either the home page, or better still the initial tag page chosen (we're only interested in tag pages in the overall structure). What I don't know though is how - or more precisely when to use this function. I'm guessing that WordPress already has a function that checks this info, which in turn triggers the 404, so maybe I need to set it up as a filter to an existing pluggable function? The function so far is               redirect_tags(){      if (is_main_query() && !is_singular() && is_paged())      {global $wp_query;     $paged = intval(get_query_var('paged'));     $max_page = $wp_query->max_num_pages;     if($max_page < $paged){     echo 'page is greater than max';}      }}


title: Get posts of ONE taxonomy term of custom post type

text:
I am going crazy here as I assume it is quite simple, but I just cannot get it to work. I have a custom post type called 'portfolio' and a taxonomy called "locations'. In the taxonomy I have various terms, like 'paris', 'berlin', 'london' etc. How can I get only the posts which are related to one term, e.g. 'paris'? I am trying the following code, yet it gives me the ALL the posts of the taxonomy 'portfolio' and not just of one term:               <?php     $args=array(     'post_type' => 'portfolio',     'locations' => 'paris'     );     $my_query = null;     $my_query = new WP_Query($args);     if( $my_query->have_posts() ) {     while ($my_query->have_posts()) : $my_query->the_post(); ?>
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
     <?php     endwhile;     }     wp_reset_query();       ?>      Hope someone can help! Thank you!


title: echo variable containing html and the_permalink();

text:
I'am trying to echo a vriable, but the permalink does not work as clickable button. The permalink just displayed outside the button. Here is my code:               $perma = the_permalink();          $valid = '<button class="btn btn-success btn-wide" href="'.$perma.'">                Gegevens opgeslagen
                 </button>';               $id = get_the_ID();          if($id == '2440'){             if($current_user->google_play_gebruikersnaam != ""){                     echo $valid;                   }


title: Blog index not going to wordpress folder

text: I just created a blog.mysite.com domain and installed WordPress. However, when I go to blog.mysite.com it isn't redirecting to WordPress - blog.mysite.com/wordpress. Should I move the contents of the /wordpress directory to my blog root folder or create an .htaccess redirect? This is only going to be a wordpress blog so I assume I can move the files instead of creating a redirect, no? Thank you! ;)


title: Show or hide a widget from pages

text: I want to add a check option to the wordpress admin sidebar when I am writing a post or a page to display a specific widget. I tried display-widgets plugin but I want to be able to show a widget directly while writing the post. Or is there is another way to do this it will be OK.


title: Display my location via a smart phone on wordpress

text: I am doing a charity bike ride for 100 miles from DC to Delaware I would like to update people as I go (at stops of course) Is there any plug in for wordpress that would allow me to auto map my location via my iphone? thanks


title: WooCommerce Layered Nav Widget

text: Has anyone used the "WooCommerce Layered Nav" widget. I wonder if the attributes could be visible on the single product page?


title: How to get default image sizes attribute

text: How do I get the height and width of default image sizes? I am not talking about custom image sizes, which can be retrieved from get_intermediate_image_sizes(). I want to get size attribute for 'thumbnail', 'medium', and 'large'. **Update** Base on answer by Mridul Aggarwal, looks like i can do:               function get_image_size ($size) {           return (array(get_option($size. '_size_w'),get_option($size. '_size_h'));      }      Is this the only way?


title: Can't include Language switch in Nav Menu

text:
I am trying to add to my menu bar some language elements. I'm using the qTranslate plugin and I would like to add the language switch to the menu bar. My them is calling in the _header.php_               <?php wp_nav_menu( array( 'theme_location' => 'primary', 'menu_class' => 'nav-menu'));?>      And then I added to my _functions.php_ the following code, which remains without effect :               function qtrans_generateLanguageListCode($id='') {         global $q_config;         if(is_404()) $url = get_option('home'); else $url = '';         if($id=='') $id = 'qtranslate';         $id .= '-chooser';         foreach(qtrans_getSortedLanguages() as $language) {             $classes = array('lang-'.$language);             if($language == $q_config['language'])                 $classes[] = 'active';             echo '
'.$q_config['language_name'][$language].'
';         }     }          function new_nav_menu_items($items) {         $translinks = qtrans_generateLanguageListCode();         $items = $items . $translinks;         return $items;     }     add_filter( 'wp_nav_menu_items', 'new_nav_menu_items' );      Could anyone help me to understand what I am missing ? I have to add that I am using a child theme of Twenty Twelve, but this should be without effect. Thanks !


title: Select User by Joining Multiple Meta Value Results

text: ( I would ask this in the general stack exchange forum but I think it is more relevant here. I'm intentionally using direct queries to the database here. ) I'm trying to select a group of users that have two distinct meta key and meta value parameters. For example, select all usernames and ID for users with both where a meta_key= "key1" and meta_value="value1" and also for the same user where another meta_key = "keyA" and meta_value = "valueA" In otherwords, I have multiple sets of metadata for a user, I'm looking for a specific set of users that meet criteria in two groups of metadata. There is no relation between the two metadata entries, except that they are both applied to the same user. The challenge that I am having is that I guess I'm trying to left join any metadata entry to the respective user without having to do a double query. Is it possible? Here's what I've tried:               SELECT wp_users.ID, wp_users.display_name     FROM wp_users LEFT JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id AND       wp_usermeta.meta_value= 'value1'     WHERE  wp_usermeta.meta_key = 'keyA' AND wp_usermeta.meta_value = 'valueA'       I've also tried this:               SELECT wp_users.ID, wp_users.display_name     FROM wp_users LEFT JOIN wp_usermeta ON wp_users.ID = wp_usermeta.user_id        WHERE (wp_usermeta.meta_key = 'key1' AND wp_usermeta.meta_value= 'value1')     AND ( wp_usermeta.meta_key = 'keyA' AND wp_usermeta.meta_value = 'valueA')       Both these return empty sets. I suspect that it is only left joining to one usermeta entry and so when I'm telling it to look for the second set of values in the usermeta entry that has been left joined to the user entry that it returns an empty set. My question is how do I filter through all the user meta info so that I can only return users with results that match both. Thanks for looking! -------- UPDATE -------------- This is the final code that worked for me:               SELECT u.ID, u.display_name     FROM wp_users AS u      LEFT JOIN wp_usermeta AS um1 ON u.ID = um1.user_id      LEFT JOIN wp_usermeta AS um2 ON u.ID = um2.user_id      WHERE  um1.meta_key = 'key1' AND um1.meta_value = 'value1'      AND um2.meta_key = 'keyA' AND um2.meta_value = 'valueA'     LIMIT 0, 60


title: Order by meta_key with two meta_queries

text: This should be simple, but I just can't pinned down a good example of the correct syntax to do this. I want to order by the specified meta_key with two meta_queries. The problem is query_posts doesn't seem to like having two meta_queries with a meta_key. If I take out one of the meta_queries the code works, or if I remove the meta_key and change the orderby to title and leave the meta_queries alone it also works. Is there any way to orderby meta_key with two meta_queries?                   $args2 = array(             'meta_key' => '_count-views_all',             //'meta_value' => $id,             'orderby' => 'meta_value_num',             'order' => $sortOrder,             'posts_per_page' => 9,             'paged' => $paged,             'meta_query' => array(                           'relation' => 'OR',                         array(                             'key' => 'contributorid1',                             'value' => $id,                             'compare' => '='                             ),                              array(                             'key' => 'contributorid2',                             'value' => $id,                             'compare' => '='                             )                         )         );         $posts = query_posts($args2);      }


title: How to delete ALL comments from certain category in Wordpress database?

text: I'm trying to delete all comments from posts in a certain category in a Wordpress database. The Wordpress database is rather complicated so this must be probably some join of `wp_posts`, `wp_comments` and `wp_term_relationships` as the categories are not stored with neither posts nor comments. How can I do this? I'm struggling to come up with a query.


title: Fix html inside a for loop

text:
I want to get the right link format for the second link, i tried many time to move the a open tag but no way the result is as the image below.               foreach( $terms as $term ) :               echo '
';              $customposts = new WP_Query( "taxonomy=$taxonomy&term=$term->slug&posts_per_page=2" );              echo '
';         if( $customposts->have_posts() ): while( $customposts->have_posts() ) : $customposts->the_post();             echo '
';             echo ''.the_title_attribute(); // The problem             endwhile;  endif;             echo '
';         echo '
';         echo '
';     endforeach;      Thanks![enter image description here](http://i.stack.imgur.com/54WpW.png)


title: Problem with executing a function on saving a post

text:
Here is my basic plugin code. I am just starting from scratch. I will explain the functionality. It is simple, While my plugin is active it will add a new meta box in add new post page just below the tags box. The user can add a value to my text box & i will save that value with post ID to my table. You can understand what is happening after reading my code.               <?php     /*     Plugin Name: Post Extender     Author: Jithesh Kt     Version: 1.0     */          add_action( 'admin_menu', 'extra_meta_form' );     add_action( 'save_post', 'save_extra_meta' );     function extra_meta_form() {         //global $theme_name;         add_meta_box( 'post-meta-boxes', __('Extra Fileds'), 'extra_meta_form_view', 'post', 'side', 'default' );     }          function extra_meta_form_view()     { ?>

Extra Meta filed :  <input type="text" id="custom_input" name="custom_input"/>

     <?php }          function save_extra_meta($post_id)     {         global $wpdb;         $tablename = $wpdb->prefix."extra_post_meta";         $query_result = $wpdb->insert($tablename, array('post_id'=>$post_id,         'filed_name'=>"My Text",         'value'=>$_POST['custom_input']         ));          }     ?>      Now after activating my plugin I clicked on Add New Added a post title, Content & my a value in newly added text box. The result i am expecting in my table is : ![Expected](http://i.stack.imgur.com/uxFQJ.jpg) But actually this what i got in my fresh table :( ![Result](http://i.stack.imgur.com/6bCTR.jpg) How did the data got duplicated ? From where did the other data came ? This is driving me crazy. Running behind this rabbit since last two days. I tried many methods. Same result. Data is always duplicating & unknown data insertion too.


title: What changes we need to make to a theme so it can be installed as a MU Theme?

text: I downloaded the free Wootheme Irrestible and **if installed on a stand alone Wordpress** , works **very well**. Now, if we **enable Multiple Sites** on 3.x and set this theme to be the theme of a new site it simply **does not work** out-of-the-box. As WooThemes Support is only for paid customers, and being this a free theme, I can ask for support directly, so I'm kindly ask here for any help. current site with IrrestibleTheme using WP 3.0.1 multi site enable is located at > http://fortiusfitness.com/fblog website settings: ![alt text](http://i.stack.imgur.com/NG7nD.png) As I don't know what might be wrong, here is all settings to this 2nd website:   * settings   * more settings   * and more   * and more   * and more


title: What is the quickest way to make a widget?

text: I have some PHP code that I would like to pull out of an existing page of a template, and put into a widget so I can move it around. What is the quickest way to create a widget?


title: Can Shopp Commercial Plugin be hacked to display radio buttons instead of Dropdowns?

text: I need to know if the 'Shopp' e-commerce plugin can be modified to display radio buttons instead of drop down menus for the product options. I don't need you to tell me how this can be done (though that would certainly be welcome), just if it is possible. I don't want to invest in Shopp unless it is something that has been done before and there is a thread or article on the Shopp board that explains the hack. EDIT: Seriously, I just need someone w/ access to the Shopp user forums to login and run a quick search for that kind of mod.


title: Feature Survey - What would you want in a resume theme?

text: I've been toying with the idea of developing a custom resume/portfolio theme for some time ... but just haven't gotten around to it. Lately, though, I've fallen in love with a few new site designs and feel that it's time we had a truly interactive and dynamic theme to power resumes and portfolios with WordPress. So here it is, your opportunity to participate in a WordPress crowdsourcing project: What features would you _most_ like to see in a resume/portfolio theme for WordPress and why?


title: query posts only works on the first page

text: I'm using Jetpack's infinite scroll function on the homepage and I only want to display posts from the category with ID 1. The problem is that my query works correctly only on the first page. On the other pages it displays posts from all categories. Here you have my code               <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; ?>     <?php query_posts($query_string.'&cat=1&posts_per_page=12&paged='.$paged);?>     <?php if (have_posts()) : while (have_posts()) : the_post(); ?>     <?php get_template_part( 'content' ); ?>     <?php endwhile; endif; ?>      Do you know what's wrong with this? I'm using this code on multiple websites, but I don't have the infinite scroll there.


title: Shortcodes attributes defaults

text:
I use this construction to implement my own shortcode:               function column_with_icon($atts, $content = null) {         extract(shortcode_atts(array(             'icon' => 'onebit_03'         ), $atts));              return '

' . $content . $icon . '
';     }          add_shortcode('column-icon', 'column_with_icon');      When I try to add a content like this:               [column-icon icon="onebit_13"]
What is Lorem ipsum?

Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book.
     Learn more
     [/column-icon]      The default value of 'icon' attribute is not overridden and I get it equal 'onebit_03', not 'onebit_13' What can I do about this? **UPDATE** Here is the code I use to retrieve and present the data:               function skible_load_special_offer_section() {         $content = get_option("prc_speciall_offer_text", true);         if (get_option("prc_show_special_offer_section")) {             echo stripslashes(do_shortcode('

' . $content . '

                 '));         }     }


title: Checking instances of scripts in wp_head

text: I'm creating a plugin that uses mootools.js. I do not want multiple instances of the script installed on a user's site, if I am able to avoid it. What is the best way to check if mootools.js is already a loaded script?


title: Custom navigation / menu output (walker?)

text:
I'm trying to implement a responsive jQuery navigation but I need to extend the default output of the WP menu. I believe I need to use a custom walker but honestly, I don't know how to get it to work for me; I just don't know how to get the output I need from it. I need to wrap any pages that have children with a span and remove the link (Friends and Family in the example below). For example:

                         Friends

Alexa

Alexander

Fred

James

Jefferson

Jordan

Kim

Meagan

Melissa

Nicole

Samantha

Scott

                         Family

Adam

Ben

Bruce

Eddie

Jack

John

Martina

Matthew

Olivia

Owen

                         Work colleagues

David

Dennis

Eliza

Larry

Lisa

Michael

Rachelle

Rick