title: Add query string to plugin URL

text: I am creating a plugin that resides at http://localhost/test/wp-admin/options- general.php?page=my-plugin I am trying to add a query string to this page so that it can be used in my plugin such as http://localhost/test/wp-admin/options-general.php?page=my- plugin?myVar=cool The problem is that this prompts wordpress to display the "You do not have sufficient permissions to access this page." page. How can I add a query string to my plugin URL? Is this documented someplace? thanks for the help.


title: Get gallery and product gallery images full size

text: I'm trying to get all gallery images in a while loop of posts (for example a blog page). With the code I'm using right now, I only get the small thumbnail images (150px : 150px). Also I want to get the product gallery images full size (woocommerce). How to do this? This is what I've done so far and gives me the thumbnail images:                $gallery = get_post_gallery( $theid, false );                 foreach( $gallery['src'] AS $src )             {                 ?>                      <a href="<?php echo $src; ?>" rel="prettyPhoto[pp_gal]" class="pp gallery" alt="Gallery image" >                      <?php             }       }      Thanks!


title: Pagination not working with custom wp_query

text:
I am trying to make a custom search plugin but pagination does not work (it shows up with the correct number pages but does not function properly). Relevant part of the search plugin (from the main function)                   $blog_url = get_bloginfo('url');              $form = <<<EOH
         <form method="get" action="{$blog_url}" id="ss-search">             <input type="text" value="{$search_text}" name="supers" onblur="if (this.value == '') { this.value = '{$search_text}';}" onfocus=if (this.value == '{$search_text}') { this.value = '';}" />             {$list}             <input type="submit" id="sbc-submit" value="Search" />         </form>
     EOH;          ///////////////////////////////////              if (isset($_GET['supers'])) {                  global $q;             // global $q;             $args = array(                 // 'category__not_in' => 1,                 's' => $_GET['supers']             );                  $q = new WP_Query($args);                  if ( $q->have_posts() ) {                     echo '
';                 while ( $q->have_posts() ) {                     $q->the_post();                     echo '
' . get_the_title() . '
';                 }                     echo '
';                     // echo '
Posts found :'.$q->found_posts.'

';                     echo get_pagination_links2();             } else {                 echo 'no posts found';                  }                  /* Restore original Post Data */             wp_reset_postdata();         }              return $form;          } // end function     $q; // add ability to make it global      pagination function in the functions.php file               function get_pagination_links2() {         global $q;         // echo gettype($q);         echo $q->found_posts;         $big = 999999999;              return paginate_links( array(             'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ),             'format' => '?paged=%#%',             'current' => max( 1, get_query_var('paged') ),             'total' => $q->max_num_pages,             'prev_next'    => true         ) );          }      I DO get pagination links, but they don't work (for example if I click next the URL changes but the results don't).


title: Get All in One Seo Tags by Page or Post ID

text: I'm working on a plugin that will send the contents of a post in an email. I've worked out getting the post ID and using that to find the page title and content. What I like to be able to do is to also send the meta tags as well. I'm using the all in one seo plugin. Is there a way of finding the all in one seo meta tags by the ID of the page or post? Just want title and description. So for instance I'm currently doing this to find the pages content:               $id = $post->ID;     $post_object = get_post($id);     apply_filters('the_content', $post->post_content);      Something like that but for meta tags would be neat!


title: What is the advantage of using wp_mail?

text: What is the advantage of using `wp_mail()` over `mail()`. Codex says they're similar, but they seem to be _very_ similar.


title: Check for update vs new post on save_post action

text: Is it possible within the save_post action to determine whether it's a new post being created or an existing post being update?


title: How to make the caption field mandatory and copy the caption field's data into alt tag?

text: ### BACKGROUND We are developing an Image Gallery for a Newspaper site (the theme was also developed by us). We are creating a custom situation for that:   * Querying (`WP_Query()`) for all the posts (post_type = `post`) under certain categories (filtering by categories)   * Grabbing their Featured images (`post_thumbnail`)   * Grabbing Caption for Featured images   * Grabbing their Inline images (images those were inserted with texts)   * Grabbing Caption for Inline images To grab inline images we modified the Grab the First Image of a Post's trick of `preg_match_all()`. And we are successful now with the help of some WPSE regular members (can't recall all of their name, but must salute them for their assistance whether by chat or Q/A). Now what we are capable of are: With a `while` loop and a custom `for` loop for inline images:   * The featured image is displayed   * The inline images are displayed   * If we `echo` the `post_title()` then it's echoing the same title into all the images of that post (that's OK and logical)   * If we `echo` caption for featured image with `echo get_post( get_post_thumbnail_id() )->post_excerpt` then it's showing the same caption for all the images (whether for post_thumbnail or for inline images -- that's **Problem#1** )   * Then with the assistance of @bungeshea I figured out a way to grab the caption for the inline images too using the same first_image trick altering the string `src` to `alt`. Now it's grabbing the `alt=""` text of the images. ### LET'S BEGIN Let's first share the code, then talk. **HERE IS MY CODE**. Here comes the real problem:   **1st of all:** We are not querying **post_type=`attachment`** as it will grab header images, background images and we won't pose them into newspaper site's media gallery. We are grabbing posts ( **post_type=`post`**) only. **Then:** And for inline images we are searching (`preg_match_all()`) for `<img src=""/>`, and for inline captions we are searching for `<img alt="">`. > I've learnt that, the image caption given when uploading an image into a > post (inline images) is NOT EQUALS to the image caption or alternative texts > given in Media Gallery » Edit Media > Caption or Alternative Text. Caption > given from Media Gallery is stored in Attachment table, but Caption given in > post inline images is stored in Posts table (I guess). As we are covering the inline images and their caption so our target is to grab inline images's caption/alt text. But we are unable to grab the inline caption (found no query to do that), so we are grabbing the `alt` text. So there are two cases:   * The post thumbnail are taking their Caption   * But the inline images are taking their alt tags We need a way now, whether to show the Inline image caption without a separate attachment query or make it mandatory to provide image caption and copy the caption into image alt. Thing is messy may be.


title: what to do when your WordPress database is too large?

text: Well I have asked this question in WP Forums, StackOverflow, and GoDaddy community as well, but nothing worked out. Hoping something is in here. I used 2 separated subdomains for my blog and site (2separate SQL database). But not I cudn't maintain separately so trying to merge them into a single WP driven site. If I do that, I will end up with limitation of max 1GB SQL DB set by GoDaddy (and I can't purchase dedicated solutions for this). There is a way out to split a single DB into 2, or use more than 1 DB for WP. So, asking for you genius guys to help me out.


title: RTL Stylesheet Confusion with WordPress

text: All I understand about RTL is that some languages are written right-to-left. In a WordPress theme, what role does the `rtl.css` stylesheet have? I was under the impression that the only difference was paragraph alignment, but the WordPress themes that I have seen have massive `rtl.css` files. What other requirements are there of CSS to provide true RTL support?


title: Wordpress Locale Switching on Accept-Language Header

text: Is there anyway to get wordpress to automatically switch locales based on the HTTP Accept-Language header? Similar to how ASP.NET can do it with their globalization="auto" config setting. The reason for this is that I want my dates to be custom formatted based on where you are viewing the site from - not what the wordpress site settings use for everybody around the world. This way somebody from the USA (en-US) will see 12/25/2011 but somebody from Australia (en-AU) will see 25/12/2011.


title: Right way to add HTML bloginfo name using a filter

text: I would like to style parts of bloginfo name from a filter. The only thing I want to do is change the site-title of the blog to include HTML so that I can do individual font-settings on part of the name. I'm using the twentyeleven and wonder how I can do this in a filter. When I add a filter for bloginfo and modify the name, it gets modified also in the title of the page and in the title attribute of the A element. I would only like to modify the bloginfo['name'] that is shown _inside_ the A element. Is there someway possible to check the context you are in while the filter callback is called for more fine grained control of the output?


title: What is the difference between strip_tags and wp_filter_nohtml_kses?

text: What is the difference between `strip_tags` and `wp_filter_nohtml_kses`. I tried to figure wp_filter_nohtml_kses from the source but it looks like it does something a bit more complex than strip all html even though thats what the codex says. I think the kses functions are expensive so I wonder why not use strip_tags if all it does is strip the html.


title: Notice bar at frontpage for multisite

text: Running a multisite install I would like to distribute messages to all sites as a top notice bar on frontpage. All sites are read and posted from frontpage so admin area message plugins won't work. Searched and can't find plugin/solution that works for both communicating with all sites on multisite and not at adminarea. Also, I'm not using the WP admin bar on front for this network, so that is not an option. Any ideas?


title: Compare meta_query decimals not working right

text: I have a custom field named 'rating' that holds decimals from 1.0 to 10. I am trying use wp_query to get me all the posts with a rating of 8.0 to 10. What I have so far almost works perfectly but it does not return posts with rating of 10.               <?php add_filter('get_meta_sql','cast_decimal_precision');         function cast_decimal_precision( $array ) {         $array['where'] = str_replace('DECIMAL','DECIMAL(1,1)',$array['where']);         return $array;}     ?>      <?php     $args = array(         'posts_per_page' => 10,         'paged' => get_query_var( 'paged' ),         'category_name' => ( 'movies' ),         'meta_query' => array(                     array(                         'key' => 'rating',                         'value' => 8,                         'compare' => '>'                     )                     ),         'meta_key' => 'rating',                  'orderby' => 'meta_value',         'order' => 'DESC'     );     $wp_query = null;     $wp_query = new WP_Query($args);      ?>


title: Populating meta box with select-list of existing posts, and assigning it to custom post types

text: My question is partly based on this answer: http://wordpress.stackexchange.com/a/5778/27135 Mike's answer is really great, and the solution worked fine until I needed to include my meta box in a custom post type. I tried to alter the code until that worked, but I did not succeed. I also do not need more than one selection meta box per page (Mike's code adds 3). So I started from scratch, stripping away everything. That works up until the point where I need to save the data in my form. My main problem right now is that I don't know how to save the currently selected option-tag when I Publish/Save. I'm not sure which data I should grab in the option tags and what to input to the update_post_meta() I also tried creating my own loop using query_posts(), hoping to gain more control over what data I needed to save.. but no luck there either. The code below is a very simplistic version of Mike's code. My goal was to strip it so that it only contains the essentials, ironically I must have stripped it too much and can't figure out what. I'd like to know what I need to add in order to save the current selection. :)               add_action( 'add_meta_boxes', 'select_box_add_meta_box' );     add_action( 'save_post', 'select_box_save_postdata' );          // Create the meta box     function select_box_add_meta_box() {           add_meta_box(               'select_item',               'Select Item',               'select_box_content',               'custom_post_type'           );     }          // Create the meta box content     function select_box_content() {         $static_args = array(             'post_type' => 'another_custom_post_type',              'show_option_none' => 'Choose item'         );         $selected_item = get_post_meta($post->ID,'_selected_item', true);         for($i=0; $i<=2; $i++) {             $incrementing_args = array(                 'id' => "selected_item_{$i}",                 'name' => 'selected_item[]',                 'selected' => (empty($selected_item[$i]) ? 0 : $selected_item[$i]),             );         }                 wp_dropdown_pages(array_merge($static_args,$incrementing_args));               }          // Save the selection     function select_box_save_postdata($data, $postarr) {             update_post_meta($postarr['ID'], '_selected_item', $postarr['selected_item']);         return $data;     }


title: How to display errors on Frontend Form

text:
This is my frontend form to edit user's profiles in the frontend:               /* Get user info. */     global $current_user, $wp_roles;     get_currentuserinfo();          /* Load the registration file. */     require_once( ABSPATH . WPINC . '/registration.php' );     $error = array();         /* If profile was saved, update profile. */     if ( 'POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) && $_POST['action'] == 'update-user' ) {              /* Update user password. */         if ( !empty($_POST['pass1'] ) && !empty( $_POST['pass2'] ) ) {             if ( $_POST['pass1'] == $_POST['pass2'] )                 wp_update_user( array( 'ID' => $current_user->ID, 'user_pass' => esc_attr( $_POST['pass1'] ) ) );             else                 echo 'The passwords you entered do not match.  Your password was not updated.';         }              /* Update user information. */         if ( !empty( $_POST['url'] ) )             update_user_meta( $current_user->ID, 'user_url', esc_url( $_POST['url'] ) );         if ( !empty( $_POST['email'] ) ){             if (!is_email(esc_attr( $_POST['email'] )))                 $error[] = __('The Email you entered is not valid.  please try again.', 'profile');             elseif(email_exists(esc_attr( $_POST['email'] )) != $current_user->id )                 $error[] = __('This email is already used by another user.  try a different one.', 'profile');             else{                 wp_update_user( array ('ID' => $current_user->ID, 'user_email' => esc_attr( $_POST['email'] )));                  }         }              if ( !empty( $_POST['first-name'] ) )             update_user_meta( $current_user->ID, 'first_name', esc_attr( $_POST['first-name'] ) );         if ( !empty( $_POST['last-name'] ) )             update_user_meta($current_user->ID, 'last_name', esc_attr( $_POST['last-name'] ) );         if ( !empty( $_POST['description'] ) )             update_user_meta( $current_user->ID, 'description', esc_attr( $_POST['description'] ) );                    //action hook for plugins and extra fields saving             do_action('personal_options_update', $current_user->ID);             wp_redirect( get_permalink() );             exit;         }          ?>          <?php get_header(); ?>

                      <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>         <div id="post-<?php the_ID(); ?>">
                 <?php the_content(); ?>                 <?php if ( !is_user_logged_in() ) : ?>
                             <?php _e('Debes estar logueado para editar tu perfil.', 'profile'); ?>
                 <?php else : ?>                     <?php if ( count($error) > 0 ) echo '
' . implode("
", $error) . '
'; ?>

Mi Cuenta

Cambiar Clave

          <?php add_thickbox(); ?>

Avatar

<?php echo get_avatar( $current_user->ID, 150);?>
     <a id="user-avatar-link" class="button thickbox" href="<?php echo admin_url('admin-ajax.php'); ?>? action=user_avatar_add_photo&step=1&uid=<?php echo $current_user->ID; ?>&TB_iframe=true&width=680&height=450" title="Avatar" >Cambiar Avatar
                                         <form method="post" id="adduser" action="<?php the_permalink(); ?>">
                             <?php _e('Nombre', 'profile'); ?>                             <input class="text-input" name="first-name" type="text" id="first-name" value="<?php the_author_meta( 'first_name', $current_user->ID ); ?>" />

                             <?php _e('Apellido', 'profile'); ?>                             <input class="text-input" name="last-name" type="text" id="last-name" value="<?php the_author_meta( 'last_name', $current_user->ID ); ?>" />

                             <?php _e('Correo Electrónico *', 'profile'); ?>                             <input class="text-input" name="email" type="text" id="email" value="<?php the_author_meta( 'user_email', $current_user->ID ); ?>" />

                             <?php _e('Breve Descripción', 'profile') ?>                             <textarea name="description" id="description" rows="3" cols="50"><?php the_author_meta( 'description', $current_user->ID ); ?></textarea>
                              <?php                              //action hook for plugin and extra fields                         ?>
                             <?php echo $referer; ?>                             <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Guardar Cambios', 'profile'); ?>" />                             <?php wp_nonce_field( 'update-user' ) ?>                             <input name="action" type="hidden" id="action" value="update-user" />
                     </form>                 <?php endif; ?>

         <?php endwhile; ?>     <?php else: ?>
             <?php _e('Sorry, no page matched your criteria.', 'profile'); ?>
     <?php endif; ?>

          <?php get_sidebar(); ?>     <?php get_footer(); ?>      But its not displaying any error messages. IE when password does not match echo 'The passwords you entered do not match. Your password was not updated.'; or when i click on the UPDATE BUTTON i want it to display User profile has been updated! How can i accomplish this?


title: Instructions for a custom post type

text: Is there any way to put some instructions for a custom post type inside the post admin at the top of the add/edit page? I know you can put the instructions inside of a meta box, but at the top would be easier for the user to read....


title: Remove posts from query for events whose start date has passed

text: The query below works as expected, showing cpt event ordered by meta_value, what I haven't figured out yet is how to remove posts for past events or events which have started. The start date for events is currently stored as, 'yy m d' and the date is chosen using jQuery datepicker.               <?php     global $post;     $args = array(             'post_type' => 'events',             'numberposts' => 5,             'meta_key' => 'sp_startDate',             'orderby' => 'meta_value',             'order' => 'ASC'         );     $supplierTrainingEvents = get_posts( $args );     foreach( $supplierTrainingEvents as $post ) :   setup_postdata($post);     ?>      I've tried this, and other variations, with no luck.               $args = array(     'post_type' => 'events',     'numberposts' => 5,     'meta_key' => 'sp_startDate',     'meta_value' => date("MM d yy"),     'meta_compare' => '>',     'orderby' => 'meta_value',     'order' => 'ASC'      );      Thank you for taking a look.


title: upload_mimes filter has no effect

text: I wanted to add support for .wif files (text/plain) to my site (WP3.3.1). So I added the below function to my theme's `functions.php`. My theme is a child theme of Suffusion.               add_filter('upload_mimes', 'custom_upload_mimes');          function custom_upload_mimes ( $existing_mimes=array() ) {       $existing_mimes['wif'] = 'text/plain';       return $existing_mimes;     }      It had no effect and .wif files continued to generate the security message when I tried to upload them. So I looked at the source code for `get_allowed_mime_types()`. The only entry for 'text/plain' is this `'txt|asc|c|cc|h' => 'text/plain'`. Just for fun I edited it to say this: `'txt|asc|c|cc|h|wif' => 'text/plain'`. That edit allowed .wif files to be uploaded. But since editing core WP files is a bad idea, I tried another solution. On the assumption that perhaps values in the $mimes array had to be unique, I tried changing the key that points to 'text/plain' with this function:               add_filter('upload_mimes', 'custom_upload_mimes');          function custom_upload_mimes($mimes=array()){         $k='wif';         $v='text/plain';         if($ek=array_search($v,$mimes)){             unset($mimes[$ek]);             $ek.='|'.$k;             $mimes[$ek]=$v;         }         return $mimes;     }      This, however, also does not allow .wif file upload. So I think that either the `upload_mimes` filter is not being applied for some reason. Or, my filter is being overwritten by another. I've tried both my functions with high (1) and low (PHP_MAX_INT) priority. It has no effect. I also checked for .htaccess directives and their weren't any. Any ideas? ETA It turns out that some combination of plugins that includes BackUpWordPress causes filters attached to 'upload_mimes' to not run. I have not determined why this is and the people oat BackUpWordPress tell me that their plugin does not touch that filter.


title: How do I create a page template to display a custom post type?

text:
I am wanting to create a page template file to display posts from a custom content type. I was working with this code I found from this site, but it renders nothing. Does anyone know what the problem is?               <?php /* Template Name: Custom Post Type Archive */     get_header(); ?>          <?php     global $query_string;     query_posts($query_string . "post_type=YOUR-CUSTOM-POST-TYPE&post_status=publish&posts_per_page=10");     if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?>
     <?php the_excerpt(); ?>          <?php endwhile;     endif; ?>

<?php next_posts_link('Previous entries') ?>

<?php previous_posts_link('Next entries') ?>

     <?php wp_reset_query(); ?>          <?php get_sidebar(); ?>     <?php get_footer();?>


title: Conditional single.php statement not recognizing conditionals

text:
I have tried every possible way of making this conditional work and it's skipping the in_category conditionals and going to the last option. This is my code in single.php:               $post = $wp_query->post;     if (in_category('Autos')) {         get_template_part("single-autos.php");     } else if (in_category('Advertising')) {         get_template_part("single-ads.php");     } else {         get_template_part("single-post.php");     }      I have conditionals all over this theme that work by calling the `in_category` for those two categories, but no matter what I do, this conditional always reverts to the single-post.php layout. single-autos.php and single-ads.php do exist in the theme. Is there something I'm doing wrong? Thanks! Edited to add the code from single-autos.php:                get_header();
               if (have_posts()) : while (have_posts()) : the_post();                     get_template_part( 'loop' );               comments_template();

< next_post_link(); >

< previous_post_link(); >

               endwhile; else:
Thank you for pushing the self-destruct button. This ship will self destruct in ten seconds.
           endif;
      get_sidebar();       get_footer();


title: Querying both pages and posts

text: I am building an "advent calendar" for a client and they are wanting a combination of specific pages and custom posts appearing on the front page, in a specific order. Things that need to be retrieved are Title, Excerpt (or Content up to ), Permalink, Featured Image and Custom Fields... What's the best way to go about retrieving these from the database? A custom SQL query? Some sort of Walker? A complicated Menu?


title: CSS conditional on custom field value

text: I am looking to add some CSS rules to an ID conditionally on the value of a custom field value. Specifically: add to id `#firstimg` the rules:               opacity:0.4;     filter:alpha(opacity=40);      provided that custom field `fl_status` has value `sold` I suppose Jquery should be the best way to go here?


title: inline script : prettyPhoto setting deeplinking to false not working

text: This is suppose to be simple but I can not figure it out. I'm using WordPress prettyPhoto plugin for my project and I'm trying to set deeplinking to false (deeplinking:false). In the Chrome console, I inserted the javascript below to test it out and it works, but when I tried to insert the same code into an inline script in the functions.php, it doesn't work. The console.log() only works. Note: The prettyphoto library is loaded at the bottom of the footer and the inline script is loaded right after.               function inline_script_footer(){ ?>          <script type="text/javascript">         (function($) {               console.log('check');                    var j = jQuery("a[rel^='prettyPhoto'], a[rel^='lightbox']").prettyPhoto({                 deeplinking: false             });                  console.log(j);                  if (j) {                 console.log('yes');             } else {                 console.log('no');             }              })(jQuery);     </script>     add_action('wp_footer', 'inline_script_footer', 100);      If anyone could please assist me, that would be great. **MY SOLUTION**               $("img").on("click", function() {                     console.log("clicked");                     $("a[rel^='prettyPhoto']").prettyPhoto({                         deeplinking: false                     });                 });


title: How to sort post_meta in edit.php?

text: I have Custom Type `cpt1` and Custom Fields `cf1`, when you use hook `manage_cpt1-bien_sortable_columns`, wordpress don't sort the post_meta ?


title: Using meta_query on pre_get_posts to exclude a particular meta_key value

text: I have a simple filter running on the main query on the front page, it should be excluding all posts with a particular meta value (by only including posts who do not have the meta_key set, or those whose meta_key value does not match what we're excluding). But, for whatever reason, it is not behaving as expected.               /**      * Hide posts from main query on front page.      *      * @since  1.0.0      *      * @param  object $query WP Query object.      * @return object        Modified WP Query object.      */     function wpse_exclude_posts_from_main_query( $query ) {              // Make sure this only runs on the main query on the front page         if ( is_front_page() && $query->is_main_query() ) {                  // Exclude posts that have been explicitly set to hidden             $query->set('meta_query', array(                 'relation' => 'OR',                 // Include posts where the meta key isn't set                 array(                     'key'     => '_wpse_custom_key',                     'value'   => 'asdf', // A value must exist due to https://core.trac.wordpress.org/ticket/23268                     'compare' => 'NOT EXISTS',                 ),                 // Include posts where the meta key isn't explicitly true                 array(                     'key'     => '_wpse_custom_key',                     'value'   => true,                     'compare' => '!=',                 ),             ) );              }          }     add_action( 'pre_get_posts', 'wpse_exclude_posts_from_main_query' );      Each half of this meta query work perfectly fine on their own. I can either see all posts where the key does not exist, or all posts where the key does exist and is not true. When used in conjunction, as shown above, I only see posts where the key does exist and is not true (the NOT EXISTS portion is ignored completely). Here is the SQL being generated (according to the posts_request filter):               SELECT     SQL_CALC_FOUND_ROWS wp_posts.*     FROM       wp_posts     LEFT JOIN  wp_postmeta                ON (                    wp_posts.ID = wp_postmeta.post_id                    AND wp_postmeta.meta_key = '_wpse_custom_key'                )     INNER JOIN wp_postmeta AS mt1                ON (wp_posts.ID = mt1.post_id)     WHERE      1=1                AND wp_posts.post_type = 'post'                AND wp_posts.post_status = 'publish'                AND (                    wp_postmeta.post_id IS NULL                    OR (                        mt1.meta_key = '_wpse_custom_key'                        AND CAST(mt1.meta_value AS CHAR) != '1'                    )                )     GROUP BY   wp_posts.ID     ORDER BY   wp_posts.post_date DESC     LIMIT      0, 10      You can see that when it gets down to the meta pieces it is indeed using OR in the WHERE clause, rather than AND as the referenced bug highlights: https://core.trac.wordpress.org/ticket/23268 Hopefully someone can provide some much-needed insight, because I'm completely flummoxed.


title: order by meta_key

text: i have a little problem: I can not order my events as i wish. I would like to order my upcoming events in ascending order... I am using the following:               new WP_Query(              array(          'author' => $current_user->ID,           'post_type' =>'tribe_events',           'orderby' => 'meta_value',           'meta_key' => '_EventStartDate',            array(                'key' => '_EventStartDate',                 'value' => date('Y-m-d'),                 'compare' => '>='            )))      But nothing happens... i mean they don't get sort in any way.. I think this is because of the _EventStartDate witch includes an hour and it looks something like this if i echo it "2013-07-29 20:00:00". Any suggestions? updates of the code :               global $current_user;         get_currentuserinfo();         $author_posts = new WP_Query(      array(         'author' => $current_user->ID,          'post_type' =>'tribe_events',          'orderby' => 'meta_value',         'order' => 'DESC',         'meta_key' => '_EventStartDate',           array(               'key' => '_EventStartDate',                'value' => date('Y-m-d'),                'compare' => '>='           )));         while($author_posts->have_posts()) : $author_posts->the_post();      and here i just get the content...


title: How to Fix HTTP Error When Uploading Images?

text: I am using WordPress 3.4.1 on Ubuntu 12.04 using Apache and PHP 5.3.X When I login to the dashboard and add a new post. Then try uploading an image to set as a featured image, I get a red box with a message "HTTP Error". I have read about people saying to not use the flash uploader and just use the browser uploader, but when I try that, I just get a 500 Internal Server Error. I have tried adding `AddType x-mapp-php5 .php` at the top of my .htaccess file, with no luck in change. Disabling ALL plugins had no effect. I tried a fresh install. No luck. ![WordPress 3.4.1 Media Upload HTTP Error](http://i.stack.imgur.com/5wEky.png)


title: Changing the username character limit from four to less characters

text: I want to create a user account on my multi-site installation of Wordpress with a username less than 4 characters. But since Wordpress has a limit of usernames at least being 4 characters, this error message is shown: > Username must be at least 4 characters. I found a solution involving a mu-plugins folder in the wp-content folder, but it doesn't work. Is there any possible way that would allow me to create a user account with a username less than 4 characters?


title: do_shortcode() won't return PHP Array

text: I have made a shortcode `[get_clients]` which is supposed to return an array of all the clients when called via `do_shortcode('[get_clients]')`. But all it returns is a string 'Array' only. Why?


title: Assign posts to taxonomy terms instead of the taxonomy terms to posts?

text: So I have a custom post type (people) with a related custom taxonomy (directory). Instead of editing a person and then choosing the related directory organizations I'd like to "edit" a directory org and choose the people that belong to it. Anyone know of a plugin that allows this? I could build my own plugin with an interface to do this - looking for opinions here to. Thinking of doing something like:               <?php     //Get all directory orgs                       $orgs = get_terms("directory");     $count = count($orgs);     $orgtermids = array();     $peopleByOrg = array();     if ( $count > 0 ){        foreach ( $orgs as $org ) {          $orgtermids[] = $org->term_id; //Build array of term_ids          $peopleByOrg[$org->term_id] = array(); //Build an empty array() for each term_id        }     }     //Get all people currently associated with a directory org      $myquery['tax_query'] = array(         array(             'taxonomy' => 'directory',             'terms' => $orgtermids,             'field' => 'term_id',         )     );     query_posts($myquery);          if (have_posts()) : while (have_posts()) : the_post();       $postOrgs = get_the_terms($post->ID, 'directory'); //Get directory orgs for this person       if ( $postOrgs && ! is_wp_error( $postOrgs ) ) {          foreach ( $postOrgs as $postOrg ) {           $peopleByOrg[$postOrg->term_id][$post->ID] = $post; //Store person info with each org it belongs to         }       }        endwhile;     endif;          //Step through and create interface to choose additional people for each directory org     //code TBD       ?>      Any ideas or opinions? * * * Just thought of a better way to do this by extending the Walker class with a new class based on Walker_Category. I'd have to modify this to create a form where people could be assigned to directory orgs instead of displaying as a list (directory orgs are hierarchical).


title: How to use images uploaded with custom implementation of thickbox like the_post_thumbnail() functionality

text: I have create a custom post type with meta boxes. In metaboxes I have create some fealds that the use can use the WordPress ThickBox Media Dialog to upload his/her images for each post seperatly. From the other side, the WordPress, when I upload an image as a Featured image, gives me some functions like the               the_post_thumbnail()      that allowing me to choose the image size that I need in my template. So, the question is, can I use any function looks like the above one to print out the image sizes I like, that the end user has upload through the media box custom fields ?


title: Problems making shortcode with custom post types and taxonomy

text:
I have a custom post type _work-gallery_ and a custom taxonomy _use_ which serves to categorize the posts. I am trying to develop a shortcode which enables me to output the work-gallery posts that belong to a particular use.I suppose it would be the equivalent of a category archive query except that I want to be able to use it on different pages. The code looks like this:               function wg_album($wguse){      extract(shortcode_atts(         array('use' => 'work'), $wguse));          $args = array(             'post_type'   => 'work-gallery',             'tax_query' => array(                     array(                         'taxonomy' => 'use',                         'field' => 'slug',                         'terms' => $use                     )                 )             );     $work_galleries = new WP_Query($args);     ob_start(); ?>
     <?php foreach ($work_galleries as $work_gallery) { ?>
                 <a href="<?php echo get_page_link( $work_gallery -> ID ); //the permalink?>">                          <?php echo get_the_post_thumbnail($work_gallery -> ID)//the featured image?>
<?php echo $work_gallery -> post_title ; ?>

 <?php echo $work_gallery -> post_excerpt ; ?>

          <?php } ?>
     <?php return ob_get_clean();      } ?>      What I get, instead of output of the permalink, title, featured image and excerpt - as in the code - is the permalink of the host page, iterated 40 times! What am I doing wrong ? The problem, I think is in the query.


title: Print a message if excerpt is empty after posts have been publish/update!

text: I don't think I can make the excerpt required, but if anyone knows a workaround please share. At least I want to print a message if excerpt is empty after posts have been publish/update, maybe a red notification to be more visible! I use this script to show excerpt box by default!


title: Remove ShareDaddy meta box from Pages only

text: I'm trying to take away the option to have sharing options on 'pages' (but leave on posts). So I have a function to make sure the sharing option is always no on pages               function page_disable_share($post_id)     {     if ( 'page' != get_post_type() )         return;              update_post_meta($post_id, "sharing_disabled", 1);     }     add_action('save_post', 'page_disable_share');      But I'd rather not have the meta box there at all, it might confuse the user if they tick it and it always unticks itself.               function page_remove_share()     {         remove_meta_box( 'sharing_meta' , 'page' , 'normal' );      }     add_action('admin_menu' , 'page_remove_share');      Bu that's not working. Maybe JetPack is getting hooked in after 'admin_menu'? I tried other hooks (http://codex.wordpress.org/Plugin_API/Action_Reference) but none work. Any ideas?


title: Why do I have to press the "Update" button twice to save my meta box values?

text: I'm having a problem with updating the post_date in a custom function I've written. I'm trying to change the "post_date" to my custom "meta_date" value. Here is the function:               function cfc_reset_postdate( $data, $postarr ) {      // If it is our form has not been submitted, so we dont want to do anything     if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;          if($data['post_type'] == 'scripture-memory') {     $date = get_post_meta( get_the_ID(), 'cfc_date', true );     $date = DateTime::createFromFormat('D - M j, Y', $date);     $date = $date->format('Y-m-d');          $data['post_date'] = $date;     return $data;     }     add_filter( 'wp_insert_post_data', 'cfc_reset_postdate', '10', 2);      It works, except I have to press the "Update" button twice to change the post_date to match my new meta date. I read something in wp-includes http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/post.php#L2380 on line 2380 "If the $postarr parameter has 'ID' set to a value, then post will be updated." Not sure what that means, but I think it may help me solve this problem. What am I doing wrong? EDIT: Here is the code I'm sending into the meta-box plugin:               $prefix = 'cfc_';          global $meta_boxes;          $meta_boxes = array();          // 1st meta box     $meta_boxes[] = array(     // Meta box id, UNIQUE per meta box     'id' => 'scripture_memory_verse',          // Meta box title - Will appear at the drag and drop handle bar     'title' => 'Scripture Memory Verse',          // Post types, accept custom post types as well - DEFAULT is array('post'); (optional)     'pages' => array( 'scripture-memory' ),          // Where the meta box appear: normal (default), advanced, side; optional     'context' => 'normal',          // Order of meta box: high (default), low; optional     'priority' => 'high',          // List of meta fields     'fields' => array(         array(             // Field name - Will be used as label             'name'      => 'Reference',             // Field ID, i.e. the meta key             'id'        => $prefix . 'reference',             // Field description (optional)             'desc'      => 'If you don\'t spell the book correctly, the verse won\'t show up!',             // CLONES: Add to make the field cloneable (i.e. have multiple value)             'clone'     => true,             'type'      => 'text'         ),         array(             'name'      => 'Day',             'id'        => "{$prefix}date",             'type'      => 'date',             'desc'      => '(What Sunday are we saying this verse)',             // Date format, default yy-mm-dd. Optional. See: http://goo.gl/po8vf             'format'    => 'DD - M d, yy'         )     )      );


title: Show a different code on front page to other pages

text: I'm looking to display a list of posts in the header section on my template on all pages with the exception of the front page where I would like to show an image in place of the list of posts. Is there a function within wordpress to detect the front page that I can use in my template code? or should I just be looking at PHP code that says if the URL matches X then show this, else show the other code?


title: Alternative loop syntax error

text: I'm trying to minimize my code and have put together this little snippet, it doesn't seem to work however. What am I missing?               query_posts( 'year=2011' );     if ( have_posts() );     while ( have_posts() );     echo 'test';     endwhile;     wp_reset_query();     endif;


title: Sorting custom post type by usermeta

text: I have a profile (a CPT) directory set up and I'm trying to find a way to sort the results based on the last login time of the post author. The goal is to reward recently logged in authors by pushing their profiles to the top of the query results, thereby increasing the visibility of their profiles. I know how to query using custom fields but I'm not sure how to go about querying using usermeta. The functions I have set up are:               // Catch the time they login and save it     function set_last_login($login) {       $user = get_userdatabylogin($login);       update_usermeta( $user->ID, 'last_login', current_time('mysql') );     }     add_action('wp_login', 'set_last_login');          // Display the time     function get_last_login($user_id) {       $last_login = get_user_meta($user_id, 'last_login', true);       $date_format = get_option('date_format') . ' ' . get_option('time_format');       $the_last_login = mysql2date($date_format, $last_login, false);       return $the_last_login;     }          // Show friendly last login     function lastseen() {         $lastseen = get_last_login(get_the_author_meta('ID'));         $last_login_unix = strtotime( $lastseen );         echo human_time_diff( $last_login_unix );     }       The query on my page is:                  $temp = $wp_query;        $wp_query= null;        $wp_query = new WP_Query();        $wp_query->query('post_type=teacher'.'&paged='.$paged);      How can I add sorting on usermeta (e.g. last login) to this query?


title: Wordpress automatically adding " "?

text: I'm not sure if is wordpress itself or Tiny MCE that's doing it. But when switching between HTML and Visual editor it's adding ` `, and adding an extra one each time I switch back and forth. I don't even have a line break in the code, it seems to somehow be deciding where it wants to place them based on the tags in my html code. What's causing this and how do I fix it? I've already tried this in the template functions file:               //disable auto p     remove_filter ('the_content', 'wpautop');     remove_filter ('comment_text', 'wpautop');     // Remove auto formatting     remove_filter('the_content', 'wptexturize');     remove_filter('comment_text', 'wptexturize');     remove_filter('the_title', 'wptexturize');


title: Where is the reset password key stored/generated?

text: Where is the reset password key stored in the wordpress DB? Is this the same as the user_activation_key? WP version 3.2.1


title: Returning info from MYSQL table via custom taxonomy

text: **Update:** I'm now trying to find a way to echo the metadata of a custom taxonomy's value. I'm trying to create some PHP to use in a plaintext widget that'll display information in my sidebar. Because some of the information will be identical across some of the parts of the site instead of storing the information in custom fields I'm trying to store it in a MYSQL table. What I'd like the code to do is to identify the post taxonomy, lookup the id field in my table, find the row with that shares the id with the taxonomy and then echo the values of other fields on that row. I have my taxonomy setup as well as my table but I can't find much of a precedent for this and therefore I'm struggling to know where to start. So far I'm trying to call the current post taxonomy's value but I can't get it to work outside the loop               <?php     $current_tax = get_query_var('game');     echo $current_tax;     ?>


title: (How) Can I change my Multisite Network to use a different blog as Primary?

text: Here's my basic setup:               http://my.domain.com/            - The "primary blog" or "Network"     http://my.domain.com/blogone/    - A sub-site or "blog"     http://my.domain.com/blogtwo/    - Same, obviously      What I'd like to do is create a new blog called "/network" -- and use that as my Network site instead of the root URL, so that I can use the "/" as just another sub-blog, basically. I'm sure it's not as simple as changing `BLOG_ID_CURRENT_SITE` from `1` to `4`, or changing the path of the blog_id=1 record to "/network". And my guess is there are some severe implications in doing this. What would actually be involved? Is it even possible? Has it been done before (successfully)?


title: How wordpress accesses its own database

text: Hi I'm just curious as to how Wordpress accesses it's own database, meaning that when I look into an admin page like `link-manager.php` or `class-wp-list- table.php` I don't see any occurences of `$wpdb`. So again, is there an internal way that Wordpress queries its own DB? If so, could I use that type of function to call my own queries?


title: duplicate posts when trying to update a post using the wp_insert_post.

text: On an empty wordpress database, I insert one sample post using the wp_insert_post. Since it's an empty database, the first post I add ends up with id 1. And I check that in the wp_posts, everything looks right ( well for some reason post_name is blank but I do not want to focus on that now ). The question is but when I want to update that post ( again using the wp_insert_post), instead of updating the early record, I end up getting post id 2! If you ask how I update the record with the wp_insert_post, I simply set the ID to 1 when I build my $data array for the wp_insert_post. The codex say that when you supply the 'ID' array element to the wp_insert_post's $data array, it simply updates that post with that ID. Well, in my cases, It does not. I end up getting the post id 2. Post ID 2's author goes as 0 (post id's author was 1 ), and post id 2's post_name is 1-revision ( post id 1s post_name was blank as I said above) Any idea of why this could be happening? Or should I simply forget the idea of using wp_insert_post for post updates?


title: How to change header & footer to full width?

text: I'm using the Skeleton theme on this website. What I'd like to do is have the header & footer to "fill" all horizontal space of the screen, while having the main content staying as is. I've looked at several other threads, but I couldn't manage to make my way to the solution with the Skeleton theme.


title: How to render the single post template with the post name?

text: I'm calling pages with Ajax and I have this code in `functions.php` to determine which page is called and then, render the corresponding template:               function ajax_callback() {         if( isset(  $_POST['href'] ) ) {             $pageId = preg_match( '/^http:\/\/.+\/\?page_id=\d+$/', $_POST['href'] ) ? substr( strrchr( $_POST['href'], '=' ), 1 ) : '8' ;                  if( $pageId === '8' ) get_template_part('home-ajax');             elseif( $pageId === '22' ) get_template_part('reviews-rvw-ajax');             elseif( $pageId === '6' ) get_template_part('noticias-news-ajax');             elseif( $pageId === '109' ) get_template_part('entrevistas-ajax');         }     }      This works fine, but now I want to call single posts too. I'm getting the post type like this:               $pageId = preg_match( '/^http:\/\/.+\/\?page_id=\d+$/', $_POST['href'] ) ? substr( strrchr( $_POST['href'], '=' ), 1 ) : 'no-page' ;     if( $pageId === 'no-page' && preg_match( '/^http:\/\/.+\/\?news=.+$/', $_POST['href'] ) ) {             $newSlug = substr( strrchr( $_POST['href'], '=' ), 1 );     } elseif ( $pageId === 'no-page' && preg_match( '/^http:\/\/.+\/\?reviews=.+$/', $_POST['href'] ) ) {         $reviewSlug = substr( strrchr( $_POST['href'], '=' ), 1 );     }          if( $pageId !== 0 ) {         if( $pageId === '8' ) get_template_part('home-ajax');         elseif( $pageId === '22' ) get_template_part('reviews-rvw-ajax');         elseif( $pageId === '6' ) get_template_part('noticias-news-ajax');         elseif( $pageId === '109' ) get_template_part('entrevistas-ajax');     } elseif( $newSlug !== '' ) {                 //here I have to get the single post template                 // e.g. $newSlug = slug-post-name, and post_type = 'news'     }      But I don't know how to call this single post template by slug name. I have to call the `single.php` template without the header and the footer, so I can do: `get_template_part('single-ajax');`               //single-ajax.php     <?php                 // Start the Loop.                 while ( have_posts() ) : the_post();                          /*                      * Include the post format-specific template for the content. If you want to                      * use this in a child theme, then include a file called called content-___.php                      * (where ___ is the post format) and that will be used instead.                      */                     get_template_part( 'content', get_post_format() );                          // Previous/next post navigation.                     twentyfourteen_post_nav();                          // If comments are open or we have at least one comment, load up the comment template.                     if ( comments_open() || get_comments_number() ) {                         comments_template();                     }                 endwhile;      But doesn't work, because I should define the query object:                       <?php      $temp = $wp_query; // assign ordinal query to temp variable for later use        $wp_query = null;      $newSlug = substr( strrchr( $_POST['href'], '=' ), 1 );      $wp_query = new WP_Query( array( 'name' => $newSlug  ) );       if($wp_query->have_posts()) {     while ( $wp_query->have_posts() ) : $wp_query->the_post();         // Start the Loop.             /*              * Include the post format-specific template for the content. If you want to              * use this in a child theme, then include a file called called content-___.php              * (where ___ is the post format) and that will be used instead.              */             get_template_part( 'content', get_post_format() );                  // Previous/next post navigation.             twentyfourteen_post_nav();                  // If comments are open or we have at least one comment, load up the comment template.             if ( comments_open() || get_comments_number() ) {                 comments_template();             }     endwhile;     }     die();      But this is not displaying the post template. Indeed, doesn't begin to execute the loop. Any idea of what is happening or an easier way to achieve this?


title: Pop up showing same content on all posts display.

text:
I have created a blog template, to show a custom posts in a grid of 3 columns. like this
                         <?php                             //WordPress loop for custom post type                              $my_query = new WP_Query('post_type=online_courses');                               while ($my_query->have_posts()) : $my_query->the_post(); ?>
                                  <img src="<?php echo $cfs->get('top_image_oc'); ?>" style="background-color: <?php echo $cfs->get('add_bg_color'); ?>; "/>
<?php the_title(); ?>
                                  <button class="md-trigger" data-modal="modal-8">Find Out More..</button>

<?php echo $cfs->get('trainer_name'); ?>

<?php the_title(); ?>

<?php echo $cfs->get('duration_of_training'); ?>
                                 <?php the_content(); ?>                                 <button style="margin-bottom:20px;float:right;">BOOK NOW</button>                                 <button class="md-close" style="">Close me!</button>

                              <?php endwhile; wp_reset_query();?>
      inside

 there is a button when clicked will show the md-content But when i click the button on any post displayed, it shows the same content on all posts of the first displayed post. I am using this pop tutorial for it http://tympanus.net/codrops/2013/06/25/nifty-modal-window-effects/


title: Theme Customizer Custom Background / Header Image

text: I'm working on a theme with some options to change the design. For the options I am using the Theme customizer. With the theme customizer there are many option types like color, upload, image upload, background image and header image. I am adding the background image control with this code:               function tcx_register_theme_customizer( $wp_customize ) {         $wp_customize->add_section(                 'tcx_advanced_options',                 array(                         'title'     => 'Advanced Options',                         'priority'  => 201                 )         );              $wp_customize->add_setting(                 'tcx_background_image',                 array(                     'default'      => '',                     'transport'    => 'postMessage'                 )         );              $wp_customize->add_control(                 new WP_Customize_Background_Image_Control(                         $wp_customize,                         'tcx_background_image',                         array(                             'label'    => 'Background Image',                             'settings' => 'tcx_background_image',                             'section'  => 'tcx_advanced_options'                         )                 )         );     }     add_action( 'customize_register', 'tcx_register_theme_customizer' );      but the control won't be displayed in the Theme Customizer. The same with the header image. 'Image Upload', 'Upload' and all other types like 'text', radio, etc. works fine. I don't want to use it with `add_theme_support` because i don't want the menu entries under the "Design" section because it can be confusing for the client. (Sry for my bad english :) ) Update: thats the code I am using. New section, new setting and the control for the Wordpress built-in Background Image.


title: How to setup a taxonomy that can have only one post assigned to it?

text: I have a Custom Taxonomy of, "Show on Front Page". I would like only one post to be assigned to this. So if I went and created an new post and checked the "Show on Front Page", the previous post that had that checked would no longer be associated with that Custom Taxonomy. Is this possible?


title: Showing posts for today and future

text:
I'm using the following code to display posts with todays date or in the future... except the future part isn't working. If I take out the if statement then it shows all posts - in the past, present and future.               $today = date( 'd M' );      $pages = get_children( array(         'post_status' => 'future,publish',         'post_type' => 'event',         'sort_order' => 'DESC'     ) );     foreach ( $pages as $post ) {         setup_postdata($post);         $item = get_the_date();          if ($item >= $today) {              ?>
<?php echo the_title(); ?> - <?php the_date(); ?>
<?php         }     }     wp_reset_query();      How can I display posts with todays date and posts in the future?


title: Echo the number of posts being displayed

text:
I had this code working as I needed it to...but now I need to add a post count where the " **____** " is, beside "posters", so I can manipulate the css depending on how many posters are showing, for example: `<div id="posters1">` or `<div id="posters2">` or `<div id="posters3">`, etc. I believe this can be done with `$post_count` or `$found_posts` but I'm not sure where to place it and or where to move the posters `div` (ie: inside the loop?):
         <?php              $movieNumber = 1;             $today = date('Ymd');             $posts = array (                 'post_type' => 'movie',                 'posts_per_page'   => -1,             );             $loop = new WP_Query( $posts );             while ( $loop->have_posts() ) : $loop->the_post();                      $attachment_id=get_field('movie_poster',$post->post_id);                 $size = "poster"; // (thumbnail, medium, large, full or custom size)                  $image = wp_get_attachment_image_src( $attachment_id, $size ); // url = $image[0], width = $image[1], height = $image[2];                      echo '

';                  endwhile;          ?>


title: Meta slider plugin only works after first refresh - Object has no method 'flex slider'

text: I have a wordpress theme I am using called 'Nordic', however I did not like their slider plugin, so I used my own... '[Metaslider][1]' The problem is when you first load the page, the slider does not appear, and I get the following javascript error...               Uncaught TypeError: Object [object Object] has no method 'flexslider'        ...however when I refriesh the page, the slider appears as normal. To view the slider, please go to http://www.think-ag.com/ then click the yellow Coleman's image (8th one). As soon as this loads you will notice there is no slider, then refresh, you will now see the slider. Also when I link straight to the page http://www.think- ag.com/?portfolio=ciknabs the slider loads first time. I am not sure how the refresh fixes the error, any ideas would be greatly appreciated.


title: WP3.6: PHP Fatal error: Call to undefined function wpmu_delete_user()

text: I'm running WordPress 3.6, multisite. I have a plugin activated with this content (it's been simplified):               function prefix_delete_user() {         $some_option = get_site_option( 'some_option' ); // at this point it works         wpmu_delete_user( 2 ); // at this point it doesn't         return;     }     add_action( 'delete_user_daily', 'prefix_delete_user' );          function setup_schedule() {         if ( ! wp_next_scheduled( 'delete_user_daily' ) ) {             wp_schedule_event( time(), 'daily', 'delete_user_daily');         }     }     add_action( 'wp', 'setup_schedule' );      Every day, a new blog with an ID of 2 is registered and every day I would like to remove it but I'm getting the following error:               PHP Fatal error: Call to undefined function wpmu_delete_user() in /home/example/ftp/example.com/wp-content/plugins/expiration/expiration.php on line 96      I'm wondering why this might be happening? When I'm calling `do_action( 'delete_user_daily' );` manually, it works...


title: Create any admin page with tab menu on that

text: I am very new to WordPress and here I want to create one admin page with tabs as shown in image ![admin sections with tabs](http://i.stack.imgur.com/EIcLq.png) How can I create such page with these tabs?


title: NextGen plugin check failing, why?

text: No matter what I do, I can't seem to get the NextGen plugin check to work. The plugin used to work but now won't load at all. I get this error on the plugin check: Check theme compatibility Missing the call to in your theme I have looked on the net and came up with this thread: http://wordpress.org/support/topic/plugin-nextgen-gallery-missing-the-call-to- in-your-theme-after-switching-to-new-theme And added the:   1. Add `<?php wp_head(); ?>` to your "header.php" right before `</head>`   2. Add `<?php wp_footer(); ?>` to your "footer.php" right before `</body>` as it stated in the thread. However, the plugin check still gives the error above (and consequently will not work -- it won't work anywhere on the site). Does anyone have any suggestions on what to try next? The site I am supporting is http://cdnsba.org/ and you can see a big white space on the front left where the slideshow used to work perfectly. I have a hunch that something is clashing with jQuery since it looks like the "Featured" section on the right doesn't scroll anymore either... Thanks! -Adam


title: Customizing Primary Menu to include custom taxonomy description

text: I've a hard time implementing the custom primary menu behaviour. I've already:   * Created a custom `post type: products` that has a custom `taxonomy: product_category` associated with it.   * Activated and implemented `Taxonomy Meta` plugin to have the possibility of adding a `category image` for the `product_category` taxonomies The thing I want to achieve is:   * After manually inserting each `product_category` taxonomy under the `Product` page in primary menu editing page in admin side, instead of just showing the name of the taxonomy in the client side, I want the menu to _show the name, description and the image_ Now, I know there's is a description field in the menu editing page, but what I want is to have that description come from the taxonomy description. Just like the image. **LT;DR**   How to customise the primary navigation to show taxonomy description (not the menu item description) next to it's name? How can I get access to that taxonomy description? **Side note**   I've created a child theme of `Twenty Thirteen` but haven't touched any of it's functions or menu handling thing etc.


title: Special purpose photos with each post

text: How would I grab a photo, that has been added to a post, and use it elsewhere on a site when there have been several photos added to the post? For example, my site has a blog (Wordpress) and a non-blog section. I want to pull one image from my latest post for use in this non-blog section. Keep in mind that there might be multiple photos associated with the post. The trick to me seems to be how to designate one specific photo of however many are associated with a post as "the photo" that will be used in the non- blog portion of the site. Ideas? Suggestions?


title: Query for bbPress replies to current topic?

text:
I'm using bbPress. I'm in a single page of the custom post type `bbp_topic`. As you can imagine this custom post type stores another custom post type called `bbp_reply`. I'm using the following query to list the most voted replies at the top (like Youtube), helped by the GD start rating plugin:                       <?php $custom_posts = new WP_Query(); ?>             <?php $custom_posts->query('gdsr_sort=thumbs&post_type=bbp_reply&posts_per_page=2'); ?>             <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>
                     <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>                 <?php the_content(); ?>
             <?php endwhile; ?>      The problem is that the query is listing all the replies from all the `bbp_topic` custom post type. I need to query something like this: list all the custom post types `bbp_reply` from this single `bbp_topic` custom post type you are viewing right now. (I know how to get the ID of the current `bbp_topic` custom post type: `$post->ID` but I'm not very sure how to use it). Any suggestions?


title: Wordpress category specific months list in sidebar.php

text:
What have made me pulling my hair apart for while, how to output category specific month list. 've been searching for the same problem and solution cannot find any lucky so far... Anyway, I have two POST type pages in my web site. One is NEWS page(ex. http://xxxxxxx.com/news/) and the other is BLOG page(ex. http://xxxxxxx.com/blog/). I use `archive.php` to show my NEWS and BLOG page and where I want to output month list with post counts in `sidebar.php`. I could output lists by using `wp_get_archives('cat=0')` however this outputs like this               2013/05(20)     2013/06(12)     2013/07(18)     2013/08(6)      HTML:

      When I click one of these, this takes me to the page where all the posts happened in that specific month, of course. What I'd like to output if I am in NEWS page for example is: HTML:

      Category specific. Any idea? My Wordpress ver.: 3.6.x   Thanks.


title: Why is that gdsr_sort=thumbs (GD start rating plugin) only works with query_posts and not with WP_Query?

text:
This correctly sort posts by thumbs vote (GD star rating plugin):               <?php query_posts('gdsr_sort=thumbs&post_type=bbp_reply&posts_per_page=2&post_parent='.$post->ID); ?>     <?php while ( have_posts() ) : the_post(); ?>
<?php  the_title(); ?>
         <?php the_content(); ?>     <?php endwhile; ?>     <?php wp_reset_query(); ?>      But this doesn't sort them at all:                       <?php $custom_posts = new WP_Query(); ?>             <?php $custom_posts->query('gdsr_sort=thumbs&post_type=bbp_reply&posts_per_page=2&post_parent='.$post->ID); ?>             <?php while ($custom_posts->have_posts()) : $custom_posts->the_post(); ?>
                         <?php bbp_reply_author_link( array( 'type' => 'avatar' ) ); ?>                         <?php bbp_reply_author_link( array( 'type' => 'name' ) ); ?>                     <a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'Permalink to %s', 'twentyten' ), the_title_attribute( 'echo=0' ) ); ?>" rel="bookmark"><?php the_title(); ?>                 <?php the_content(); ?>
             <?php endwhile; ?>


title: Multi Site Setup, Child Themes, Getting Style Sheet Directory

text: As the title says, I have a multi-site setup and the apperance is customized with child themes. > The main site: **themainsite.com** > > Secondary site **foo.com** When you look into the source code of foo.com, you see some URLs referencing to the mainsite. Such as:               <link rel="stylesheet"      href="http://www.themainsite.com/wp-content/themes/sometheme/css/some.css"      type="text/css" media="screen" />      I checked wordpress documentation for get_stylesheet_directory_uri, but could not find an answer. Is it possible to remove these kind of references to the main site? **UPDATE:** All the CSS/JS references are handled in the **header.php** of the parent template like below. I already have a header.php oin my child theme which overrides the parent theme's header.php.               <link rel="stylesheet"      href="<?php echo get_template_directory_uri()  ?>/css/some.css"      type="text/css" media="screen" />


title: Custom taxonomy archive page not routing?

text: I have a plugin free custom post type and taxonomy setup - see below. From this I get an archive of the CPT at:               /archives/nomination-archive      If I use the_terms( $post->ID, 'nomination_type' , ' ' ) I get a nice link to my taxonomy term archives in each of my nomination posts i.e:               /archives/nomination-type/best-2013      Going to this url gives me an archive page with a title "Best 2013" as you would expect, but I can't for the life of me get it to show any posts..refreshed permalinks etc etc Any help much appreciated...               add_action( 'init', 'create_nomination_post_type' );     function create_nomination_post_type() {         register_post_type( 'nomination',             array(                 'labels' => array(                     'name' => __( 'Nominations' ),                     'singular_name' => __( 'Nomination' ),                     'add_new_item' => __( 'Add New Nomination' )                 ),             'public' => true,             'menu_position' => 6,             'exclude_from_search' => true,             'has_archive' => true,             'rewrite' => array('slug' => 'nomination-archive'),             'supports' => array(                'title',                'editor',               'author',               'thumbnail',               'page-attributes'                ),             )         );     }          //     // Add nominatons type taxonomy     //     function add_nomination_type_taxonomies() {         register_taxonomy('nomination_type', 'nomination', array(             // Hierarchical taxonomy (like categories)             'hierarchical' => true,             'labels' => array(                 'name' => _x( 'Nomination Categories', 'taxonomy general name' ),                 'singular_name' => _x( 'Nomination Categories', 'taxonomy singular name' ),                 'search_items' =>  __( 'Search Nomination Categories' ),                 'all_items' => __( 'All Nomination Categories' ),                 'parent_item' => __( 'Parent Nomination Categories' ),                 'parent_item_colon' => __( 'Parent Nomination Category:' ),                 'edit_item' => __( 'Edit Nomination Category' ),                 'update_item' => __( 'Update Nomination Category' ),                 'add_new_item' => __( 'Add New Nomination Category' ),                 'new_item_name' => __( 'New Nomination Category Name' ),                 'menu_name' => __( 'Nomination Item Categories' )             ),              //Control the slugs used for this taxonomy             'rewrite' => array(                 'slug' => 'nomination-type' // This controls the base slug that will display before each term               //    'with_front' => true, // Don't display the category base before "/genres/"                 //'hierarchical' => false // Allows good urls             )         ));     }     add_action( 'init', 'add_nomination_type_taxonomies', 0 );


title: Custom Style per Post, How to Display Custom-Styled Single post on Homepage?

text: This question probably has simple answer, but I'm not an expert programmer so lemme explain my question chronologically. I apply custom style for every single post, and it works using the following method. But I have trouble when I want to show my latest post on homepage (included its custom-style). The result I want to, you can see Trent Walton's Blog for reference. **This is my method for custom style on every post:**               //Custom CSS Widget     add_action('admin_menu', 'custom_css_hooks');     add_action('save_post', 'save_custom_css');     add_action('wp_head','insert_custom_css');     function custom_css_hooks() {         add_meta_box('custom_css', 'Custom Styles', 'custom_css_input', 'post', 'normal', 'high');         add_meta_box('custom_css', 'Custom Styles', 'custom_css_input', 'page', 'normal', 'high');     }     function custom_css_input() {         global $post;         echo '';         echo ''.get_post_meta($post->ID,'_custom_css',true).'';     }     function save_custom_css($post_id) {         if (!wp_verify_nonce($_POST['custom_css_noncename'], 'custom-css')) return $post_id;         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return $post_id;         $custom_css = $_POST['custom_css'];         update_post_meta($post_id, '_custom_css', $custom_css);     }     function insert_custom_css() {         if (is_page() || is_single()) {             if (have_posts()) : while (have_posts()) : the_post();                 echo                      '                         '.get_post_meta(get_the_ID(), '_custom_css', true).'                     ';             endwhile; endif;             rewind_posts();         }     }      And I add some styles on custom field. And my style in custom field this will be injected in header of single post. I works. **On homepage (by creating home.php) I put my latest post, with this:**                    get_header();          ...loop to show the same content as latest single..          get_footer();      And my homepage shows my latest post as I want, but the problem is **its custom style not included**. **Then I try to modify my conditional tags (fro showing custom style):** _from_               function insert_custom_css() {         if (is_page() || is_single()) {            ...         }     }      _to_               function insert_custom_css() {         if (is_home() || is_page() || is_single()) {            ...         }     }      The result is terrible, it was not showing custom style for the post that currently displayed. **The home post is now styled with my first post custom style**. I'm looking for you assistance, thanks.


title: How to use custom taxonomies to reference complex relationships?

text: I'm working on a site that will in part house information on products that many people have worked on in different roles. I'd like for people, the projects they've worked on, and their roles in the projects to be searchable using custom taxonomies. Projects and People are custom post types. Let's use a movie as an example. That's not what the site is for, but the problem is exactly the same:   * Alice worked on _Big Movie_ as the director and producer.   * Bob worked on _Big Movie_ as an actor.   * Carl worked on _Big Movie_ as the scriptwriter.   * David worked on _Big Movie_ as another scriptwriter. I want to be able to search for all directors, search for everyone related to _Big Movie_ , and search for everything Alice worked on (and Bob, and Carl, etc.). So far I've simply skimmed the codex and my thought is to have a hierarchical taxonomy "People" associated with the post type. Every entry will have two levels:   * Role      * Name So the "People" taxonomy of _Big Movie_ might look like this:   * Producer      * [Alice's Person post ID]   * Director      * [Alice's Person post ID]   * Writer      * [Carl's Person post ID]     * [David's Person post ID]   * Actor      * [Bob's Person post ID] Is there a better or more efficient way to associate **people posts** with their **particular roles** on **particular project posts**? Does this approach actually solve the problem and allow for efficient searches for people based on the roles they have played, the roles they have played in particular projects, and the particular projects they have worked on?


title: Trying to echo out custom field inside shortcode?

text:
I have this shortcode code currently -               <?php          if (!function_exists('latest_tweet')) {          function latest_tweet($atts, $content = null) {              $args = array(             "latest_tweet_icon_color"             => "#dddddd",             "latest_tweet_icon_size"              => "70",             "text_align"                          => "",             "el_class"                            => ""         );              extract(shortcode_atts($args, $atts));              global $my_theme;              $html = "";              $html .="
";              $html .= "";         $html .= "

";               echo '' . $my_theme['social-twitter'];              $html .= "
";                      return $html;     }          }          add_shortcode('latest_tweet', 'latest_tweet');      Now the array (icon color, size, align etc..) is pulling fields from a Visual Composer element, and the echo statement is pulling (social-twitter) from a theme options field. I can get echo to work, but it is being output outside of the div? How can I include it inside the latest-tweet-container div? I have tried -               $html . = echo '' . $my_theme['social-twitter'];      But this just throws an error? Any advice greatly appreciated.


title: WP_Query with ajax handler returns the same posts

text:
I have a problem that is getting me bald atm. I have a ajax call that handles a loop that handles some querys and returns posts for me. So far so good, but the first time the user sees the page we should load 10 posts, and then we want to click a button to request 5 more. So far so good. But when we request the 5 more posts we get the 5 first posts again. My batchloop               <?php        // Our include       define('WP_USE_THEMES', false);       require_once('../../../wp-load.php');            // Our variables       $posts = (isset($_GET['numPosts'])) ? $_GET['numPosts'] : 0;       $page = (isset($_GET['pageNumber'])) ? $_GET['pageNumber'] : 0;       $category = (isset($_GET['category_name'])) ? $_GET['category_name'] : 0;            var_dump($posts);          $args = array(           'posts_per_page' => $posts,         'category_name'  => $category,          'post_status'    => 'publish',         'orderby'        => 'date',         'order'          => 'DESC',         'paged'          => $page      );          query_posts($args);            // $query = new WP_query($args);          // our loop       if (have_posts()) {                $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; query_posts($args);                 while (have_posts()){                     the_post();                          get_template_part( 'thumbs', get_post_format() );              }       }           // unset($page, $posts, $category);          // wp_reset_postdata();     wp_reset_query();     ?>       Does anybody sees what im doing wrong? EDIT: batch handler                function _batchhandler() {              var getamount = localStorage.getItem('amount');                   console.log('amount of posts to retrive ' + JSON.parse(getamount));                  // Ajax call             $.ajax({                 type: 'GET',                 data: {                     posts: getamount,                      page: page,                     category: 'work'                 },                 dataType: 'html',                 url: 'http://dev.xxx.se/wp-content/themes/xxx/batch.php',                 beforeSend: function() {                     _setHeader;                     if( page != 1 ) {                         console.log('Loading');                         // Show the preloader                         $('body').prepend('

');                     }                     // If we reach the end we hide the show more button                     if( page >= total ) {                         $('.load').hide();                     }                 },                 success: function(data) {                     console.log(page);                       var scroll = ($('.thumb').height() * posts);                     // If thumbs exist append them                     if( data.length ) {                          // Append the data                         $('#batch').append(data);                              // Remove the crappy width and height attrs from the image * Generated by WP *                         $('img').removeAttr('height').removeAttr('width');                              // Animate each new object in a nice way                         (function _showitem() {                             $('#batch .thumb:hidden:first').addClass('show', 80, _showitem);                                  // On the last request do load any more                             loading = false;                           })();                              // Remove the preloader                         $('.preloader').fadeOut(200, function() {                             $('.preloader').remove();                            });                     }                     // return false;                 },                 complete: function() {                     // Delete storage                     localStorage.clear();                          // Update the scroller to match the updated content length                     if (scroller)                         setTimeout("scroller.refresh()", 300);                          // Initalize the load more button                     _clickhandler();                 },                 error: function() {                     console.log('No page found');                 }             });         }      and my load more button function                $('.load').on('click', function(event) {                 event.preventDefault();                  // Delete storage                 localStorage.clear();                      if(!loading) {                     loading = true;                     // Increase our pagenumber per click                     page++;                     count++;                     // Remove preloader                     $('.preloader').remove();                          setTimeout(function() {                         $('#batch').css({                             '-webkit-transform' : 'translateY(-' + ($('#batch li').outerHeight() * count)  + 'px)'                         });                     }, 30);                          // Clear storage and set a new                     localStorage.setItem('amount', JSON.stringify(amount.medium));                     var getamount = localStorage.getItem('amount');                          // Send the request to the handler                                       _batchhandler(page);                     }                        });      Everything seems fine, the first 10 (1-10) posts loads as the should, but the first time "load more" is clicked we get the next 5 results but the results are posts that loaded the first time (5-10). If we click the "load more" again, we get the correct result


title: add_action outside a plugin

text: I'm trying to create my own class to make some of the most common changes I need in all my WP sites. Things like removing the canonical tag when not required or changing the meta description. I'm not creating a plugin, as I'm not familiar with it. I have written the following class, but I've been not able to get it fully working. As soon as _setup function has been called, anything else is outputted on the source code. Similarly all the add_action('wp_head') are ignored. I suspect that this is because I am recalling the class too late, but I don't know whether this is the case and how I can test it.                   class Stuff_Frontend {         private static $_instance = null;              public static function init()         {             add_action( 'wp_head', array(self::instance(), '_setup'));         }              public static function instance()         {             // create a new object if it doesn't exist.             is_null(self::$_instance) && self::$_instance = new self;             return self::$_instance;         }              /**          * Setup the class          * Adds and removes a lot of filters.          */         function _setup() {             echo "I'm here;";             add_action( 'wp_head', array(self::instance(), 'head' ), 1 );                  // Remove actions that we will handle through our wpseo_head call, and probably change the output of             remove_action( 'wp_head', 'rel_canonical' );             remove_action( 'wp_head', 'index_rel_link' );             remove_action( 'wp_head', 'start_post_rel_link' );             remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head' );             remove_action( 'wp_head', 'rsd_link' );             remove_action( 'wp_head', 'wlwmanifest_link' );                  add_action( 'mystuff', array(self::instance(), 'change_metadesc' ), 10 );         }              /**          * Main wrapper function attached to wp_head. This combines all the output on the frontend.          */         public function head() {             echo "this is a test for my class head";                  /**              * Action: 'mystuff'              */             do_action( 'mystuff' );                  return;         }                 /**          * Change the meta description element.          *          * @param bool $echo Whether or not to echo the description.          *          * @return string          */         public function change_metadesc() {                  echo "this is an attempt to change the description";         }         }              The class above is recalled in the function.php ini using the following statements:               include( locate_template( 'MyStuff.php' ) );     Stuff_Frontend::init();      Any hint is appreciated. Thanks


title: Multidomain site with custom permissions

text: We are going to build single instalation wordpress multidomain site, where each domain is used for different language. domain.com - english, domain.lv - latvian, domain.ru - russian, etc. All sites may have different parameters and options. Also users must be able to post only assigned language content. And limmited only to assigned language site. What would be best approach?


title: category_name not working in WP_Query

text: I have a custom post type and I wanted to show posts just from a certain category but its not working. Here is the code:               <?php     // Reset post data.     wp_reset_postdata();     $photo_group = 0; // For prettyPhoto grouping.     $count = 1; // For unique id of gallery item          // Build query based on site option value.     $num_of_gallery_posts = get_option( 'st_gallery_posts_per_page' );     if ( '' == $num_of_gallery_posts || 'show all' == $num_of_gallery_posts ) :         $query = new WP_Query( 'post_type=gallery&category_name=destaque&posts_per_page=-1' );          else :              $num_per_page = (int) $num_of_gallery_posts;                                             $cat_id = get_cat_ID('destaque');              $query = new WP_Query( 'post_type=gallery&category_name=destaque&posts_per_page=' . $num_per_page . '&paged=' . get_query_var( 'paged' ) );     endif;          //Start the WordPress Loop after querying the posts.     if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post();


title: Slideshow of posts

text: I am trying to find a way to achieve the following: -- I have a section in my home page that lists all posts, since i am using bootstrap, i put every post in a 3 col grid, so 4 posts for each line. -- Now i need to put a slideshow working on this, i need to slide every 4 posts, not one post each time, any suggestions for doing this? I believe this is super easy, but i didn't find a practical way of doing this. I know how to query the posts, i just need know how can i divide posts so i can slide 4 posts each time. Thanks in advance for reading and for your help.


title: Use local image for default avatar

text: I tried putting this snippet in my functions.php               add_filter( 'avatar_defaults', 'newgravatar' );          function newgravatar ($avatar_defaults) {         $myavatar = get_bloginfo('template_directory') . '/images/default_avatar.png';         $avatar_defaults[$myavatar] = "Locale";         return $avatar_defaults;     }      A new avatar appears in Options-Discussion. Problem is it's not local at all.. the avatar is taken from `http://i1.wp.com/mydomain.com/wp- content/themes/mytheme/images/default_avatar.png`. So it passes through `i1.wp.com` anyway.. how can I just have a friggin LOCAL link?


title: Help setting up a sql query

text: I need to list out specific custom field items that contain an associated custom field entry. For example, the custom fields are named "type" and "food". I would like to list out all of the breakfast foods. "Breakfast" being the "type" custom field and "bacon", "eggs", "biscuits" being the "food". Right now, I have this query, but it lists out every type of food when I need it to list out only the breakfast types. Would I need to add "WHERE meta_value = 'type' AND meta_key = 'breakfast'" somewhere? I've tried a few places and nothing would work.               <?php         $metakey = 'type';              $stocktypes = $wpdb->get_col($wpdb->prepare("SELECT DISTINCT meta_value FROM $wpdb->postmeta WHERE meta_key = %s ORDER BY meta_value ASC", $metakey) );         if ($stocktypes) {             foreach ($stocktypes as $stocktype) {                 echo "<option value=\"" . $stocktype . "\">" . $stocktype . "</option>";             }         }     ?>


title: Visual Editor Missing, Server-Side Problem, How Would You Debug It?

text: I already tried all of the solutions you can find online like adding this to wp-config.php > 1 define('CONCATENATE_SCRIPTS', false); > > 2 I also deactivated all plugins and changed the theme, still no dice > > 3 Verified that permissions are correct and visual editor is enabled > > 4 Tried replacing with other editor than TinyMCE, no dice I suppose it is a server problem because another site on the server has the same problem Any suggestions how to debug it? "Add Media" works fine, so its not a JS issue or a permission issue I believe it could be related to mod_sec but I disabled it and still no dice. Not sure where to begin the debugging process. Any suggestions?


title: URL rewriting with custom pagination

text: I'm using a custom query to display the results with the pagination and rewrite the URLs. The following function works fine and displays the URLs in following pattern:               http://localhost/author/admin/xpage/2      However when I go to the second page, I get 404 error. Here's my code:               $current = isset( $_GET['xpage'] ) ? abs( (int) $_GET['xpage'] ) : 1;          $pagination_args = array(         'base' => @add_query_arg('xpage','%#%'),         'format' => '',         'total' => ceil($total_posts / $items_per_page),         'current' => $current,         'show_all' => false,         'type' => 'plain',     );               if( $wp_rewrite->using_permalinks() ){         $pagination_args['base'] = user_trailingslashit( trailingslashit( remove_query_arg('s',get_pagenum_link(1) ) ) . 'xpage/%#%/', 'xpage');     }          echo paginate_links($pagination_args);


title: Create a list of sites on the network (multisite)

text:
I'm using shardb which splits the database into multiple. I'm trying to make a page that will list all the sites on the network but I'm unable to do it cause they're on multiple database so this theme code doesn't work.               <?php     // Query for getting blogs     $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );          // put it in array     foreach ( (array) $blogs as $details )     {     $blog_list[ $details['blog_id'] ] = $details;     }     unset( $blogs );     $blogs = $blog_list;          // if is valid array     if (is_array( $blogs ) )     {     echo '
';     $array= array();     // reorder     $array= array_slice( $blogs, 0, count( $blogs ) );     for($i=0;$i<count($array);$i++)     {     // get data for each id     $blog = get_blog_details( $array[$i]['blog_id'] );     // print it     echo '
siteurl.'">'.$blog->blogname.'
';     }     echo '
';     }     ?>      Does anyone know how to make this work with multiple databases?


title: Dynamic Width of Widgets

text:
Ok, I'm using the following code for up to 6 widgets in a sidebar               function s57d_sidebar1_params($params) {          $sidebar_id = $params[0]['id'];          if ( $sidebar_id == 'sidebar-1' ) {              $total_widgets = wp_get_sidebars_widgets();         $sidebar_widgets = count($total_widgets[$sidebar_id]);              $params[0]['before_widget'] = str_replace('class="', 'class="span' . floor(36 / $sidebar_widgets) . ' ', $params[0]['before_widget']);     }          return $params;     }     add_filter('dynamic_sidebar_params','s57d_sidebar1_params');      The resulting code when there are widgets in the sidebar displays like:

Text 1

Text 1

      The class is being assigned to the section and then again to the div. I don't want the div to also get the class. What is wrong with the code? Thanks


title: Custom login modal page action

text:
I have a modal login and I also have a custom login page as well. modal login page is mostly being used for login, register, forgot password. The problem is whenever you login by modal login page, it goes to custom login page. not login processing page. (you have to put username and password again on the custom login page) is there anyway to go to login processing page from modal login page? (if the username, pwd are wrong, it should be going to custom login page) I tried to put "/login" instead of "//echo wp_login_url(apply_filters('kleo_modal_login_redirect', '') );" on action value. /login page is the custom login page. This is the source.

 <?php _e("SIGN INTO YOUR ACCOUNT", 'kleo_framework');?><?php if(get_option('users_can_register')) { ?> <?php _e("CREATE NEW ACCOUNT", 'kleo_framework');?><?php } ?>

       <form action="/login<?php //echo wp_login_url(apply_filters('kleo_modal_login_redirect', '')  ); ?>" id="login_form" name="login_form" method="post" class="clearfix">
         <input type="text" id="username" required name="log" class="inputbox" value="" placeholder="<?php _e("Username", 'kleo_framework');?>">

         <input type="password" id="password" value="" required name="pwd" class="inputbox" placeholder="<?php _e("Password", 'kleo_framework');?>">

          Your <a target="_blank" href="<?php //if( sq_option('privacy_page', '#') != "#") echo get_permalink(sq_option('privacy_page')); else echo '#'; ?>"><?php _e("privacy", "kleo_framework");?> <?php _e("is important to us and we will never rent or sell your information.", "kleo_framework");?>

         <button type="submit" id="login" name="submit" class="radius secondary button">  <?php _e("LOG IN", 'kleo_framework');?></button>            <?php // do_action('fb_popup_button'); ?>
     </form>

<?php _e("FORGOT YOUR USERNAME?", 'kleo_framework');?>

      ×


title: Wordpress 3 MU for a development/stage/production site

text: Just wondering if people have any thoughts around the best way to setup Wordpress 3 to use for development, staging and production. I currently have an install that I just use for dev, before moving the files to stage for a friend to review. This normally goes back and forwards for a while until they are happy. Then it goes to prod. It's a fairly manual process, so open to any suggestions as to how to best automate parts of this. What works for you?


title: Configuring Routing Rules for WordPress+Nginx and WP-SuperCache?

text: How do you **set up routing rules** correctly with **Nginx** to support **WP Super Cache** for a WordPress (3.x) site?


title: theme options echoing multiple times

text: ~~I tried to strip down the Twenty Eleven theme options page and add my own fields~~ correction: I followed a tutorial somewhere, but when I try to echo the data, it comes out multiple times. Here is my theme-options.php: http://pastebin.com/HSZM56jA This is how I am echoing it:               <?php         $options = get_option('gavsiu_theme_options');         echo $options['message-primary'];         echo $options['message-secondary'];     ?>      It comes out 11 times. > This is the main message.This is the secondary message. This is the main > message.This is the secondary message. This is the main message.This is the > secondary message. This is the main message.This is the secondary message. > This is the main message.This is the secondary message. This is the main > message.This is the secondary message. This is the main message.This is the > secondary message. This is the main message.This is the secondary message. > This is the main message.This is the secondary message. This is the main > message.This is the secondary message. This is the main message.This is the > secondary message. I checked mySQL and the data is saved once. There is no duplication or error in saving the sentences. print_r $options reveals that it prints out the array numerous times, so when I echo 'message-primary', it echoes each match from each array. * * * I'm echoing this in the front page. Saving the fields again did not change anything. As I said, it is saved correctly into the database. In `wp_options` > `gavsiu_theme_options` :               a:2:{s:15:"message-primary";s:25:"This is the main message.";s:17:"message-secondary";s:30:"This is the secondary message.";}


title: What is the best method to export local WordPress installation and import to live server?

text: I've been building a website using Wordpress for the couple of weeks on my localhost. My plan was to export it when I'm done and then import it onto the live server. Today I found out a couple of things:   1. Wordpress' Export tool only exports what's in the database, nothing else. It doesn't export images, etc. This could be easily remedied by simply copy pasting the files, but I was hoping for a complete solution where a tool will export EVERYTHING into a single zip file and then import than zip file onto live server to basically create an identical clone.    2. The paths that is created within the XML file generated by the Export tool uses absolute paths, and this is especially troublesome. Example: http://localhost/wordpress/wp-content/uploads/2011/07/GSI-70-Automated-OAE- Screener.jpg I haven't tested it, but I imagine that when I import this XML onto my live server Wordpress will look for a file at http://localhost/... and that's just not gonna work of course. It would work if the paths are relative paths. What do you guys think? Any suggestions? Ideas? Solutions? Thanks a lot!