title: What's the purpose / logic of split_the_query in WP_Query->get_posts

text: In the get_posts method of WP_Query, there's a section relating to split_the_query The logic of split_the_query is               $split_the_query = ( $old_request == $this->request && "$wpdb->posts.*" == $fields && !empty( $limits ) && $q['posts_per_page'] < 500 );      Which can be summarised as. If:   * The calculated query hasn't been modified ($old_request == $this->request)   * And we're just loading posts ("$wpdb->posts.*" == $fields)   * And we've set a limit (!empty( $limits ))   * And that limit is less than 500 rows ($q['posts_per_page'] < 500) Then it triggers this bizarre alternative way to load content. * _Edit: *_ Maybe bizarre is a harsh word, I'm sure there's a purpose, it seems to update some caches in the process :)  It's causing issues with one of my custom post types as it also triggers some weird caching mechanism and I run out of memory. I'm aware I can overwrite it with a hook but I'm wondering what the purpose of it is? Doesn't seem to be documented. It also seems odd to randomly do it for less than 500 rows.


title: Recent comments from my blogs only

text: I'd like to create a list of recent comments, specific to each user on my network (Buddypress). My best idea so far is pretty lame: DB Query on all user's blogs, compare dates, select top 10 by date. To me, it sounds a too heavy load for the the server. Any alternative and _better_ ideas? :) Thanks!


title: Can I integrate Google Analytics with my blog, hosted at wordpress.com?

text: I have a blog hosted at wordpress.com. How do I integrate it with Google Analytics?


title: Wordpress front-end post form and email after

text:
I have coded a front-end form that posts to a custom post type, i have a form input field for an email and when the form posts to the custom post type i want an email sent to the email address inserted into the email input when it's submitted. Any ideas?? Edit...Here's my code (forgot lol)               if('POST' == $_SERVER['REQUEST_METHOD'] && !empty( $_POST['action'] ) &&  $_POST['action'] == "new_booking") {          if(isset($_POST['submit'])) {              $sucess = "We will contact you regarding this booking.";              $errors = "";              if(!empty($_POST['booking_name'])) {             $booking_name = trim($_POST['booking_name']);         } else {             $errors .= "
Please enter your name.
";         }              if(!empty($_POST['booking_email'])) {             $booking_email = trim($_POST['booking_email']);         } else {             $errors .= "
Please enter your email.
";           }              if(!empty($_POST['booking_address'])) {             $booking_address = trim($_POST['booking_address']);         } else {             $errors .= "
Please enter your address.
";         }              if(!empty($_POST['booking_phone'])) {             $booking_phone = trim($_POST['booking_phone']);         } else {             $errors .= "
Please enter your phone number.
";         }              if(!empty($_POST['booking_rooms'])) {             $booking_rooms = trim($_POST['booking_rooms']);         } else {             $errors .= "
Please enter number of rooms.
";         }              if(!empty($_POST['booking_adults'])) {             $booking_adults = $_POST['booking_adults'];         } else {             $errors .= "
Please enter number of adults.
";         }              if(!empty($_POST['booking_arrival'])) {             $booking_arrival = trim($_POST['booking_arrival']);         } else {             $errors .= "
Please enter an arrival date.
";           }              if(!empty($_POST['booking_departure'])) {             $booking_departure = trim($_POST['booking_departure']);         } else {             $errors .= "
Please enter a departure date.
";           }              $booking_requirements = trim($_POST['booking_requirements']);              if(empty($errors)) {             $new_booking = array(                 'post_title' => $booking_name,                 'post_status' => 'publish',                 'post_type' => 'listings',                 'booking_email' => $booking_email,                 'booking_address' => $booking_address,                 'booking_phone' => $booking_phone,                 'booking_rooms' => $booking_rooms,                 'booking_adults' => $booking_adults,                 'booking_arrival' => $booking_arrival,                 'booking_departure' => $booking_departure,                 'booking_requirements' => $booking_requirements             );                  $pid = wp_insert_post($new_booking);                  add_post_meta($pid, 'booking_email', $booking_email, true);             add_post_meta($pid, 'booking_address', $booking_address, true);             add_post_meta($pid, 'booking_phone', $booking_phone, true);             add_post_meta($pid, 'booking_rooms', $booking_rooms, true);             add_post_meta($pid, 'booking_adults', $booking_adults, true);             add_post_meta($pid, 'booking_arrival', $booking_arrival, true);             add_post_meta($pid, 'booking_departure', $booking_departure, true);             add_post_meta($pid, 'booking_requirements', $booking_requirements, true);              }          }      } do_action('wp_insert_post', 'wp_insert_post');


title: Problem importing categories and sub-categories

text:
I have an array with the categories and sub-categories I want to import to the "campsite-district-county" taxonomy. My sub-categories are not being inserted with the correct parent. They're being inserted on the root level. After some investigation I come across the information that I needed to clear the taxonomy cache after each insert, so I did but I still have the same problem.               $dist[]=array('Açores','Angra do Heroísmo');     $dist[]=array('Açores','Corvo');     $dist[]=array('Aveiro','Águeda');     $dist[]=array('Aveiro','Anadia');     foreach($dist as $d) {         $i++;         if(is_array($d)) {             if ($parent_term=term_exists(trim($d[0]), 'campsite-district-county')) {                 //do nothing - let's add the county bellow             } else {                 //Adds district                 $parent_term=wp_insert_term(trim($d[0]), 'campsite-district-county');                 delete_option("campsite-district-county");                 wp_cache_flush();                 echo '
'.trim($d[0]).'
';                  }             $id_parent=intval($parent_term['term_id']);             echo '
*'.$id_parent.'*
';             //Add county             $child_term=wp_insert_term(trim($d[1]), 'campsite-district-county', array('parent', $id_parent));             delete_option("campsite-district-county_children");             wp_cache_flush();             echo '
'.trim($d[1]).'
';         }     }


title: Using Wordpress 3.5 Media Uploader in meta box?

text: Is this possible to do? I love how the new uploader works. I'm guessing it has to do with a jQuery call like the other way did. _EDIT_ This is the code I am currently using               jQuery(document).ready(function($) {     $('.custom_upload_image_button').click(function() {         imageField = $(this).prev('input');         tb_show('', 'media-upload.php?type=image&TB_iframe=true');     });     window.send_to_editor = function(html) {         imgurl = $(html).attr('href');         $(imageField).val(imgurl);         tb_remove();     };     $('.clear_field').click(function() {         var defaultImage = jQuery(this).parent().siblings('.custom_default_image').text();         jQuery(this).parent().siblings('.custom_upload_image').val('');         return false;     });     });


title: Custom maintenance page

text:
Is there a way to add a custom maintenance page from theme folder? I have the code for the activate maintenance mode but i can't get the styling..               function activate_maintenance_mode() {         if ( !(current_user_can( 'administrator' ) ||  current_user_can( 'super admin' ))) {             wp_die(             '
Website Under Maintenance

Hi, our Website is currently undergoing scheduled maintenance.             Please check back very soon.
Sorry for the inconvenience!
', 'Maintenance Mode');         }     }     add_action('get_header', 'activate_maintenance_mode');      Thanks in advance, Nikola.


title: _.omit is not function

text: I have just upgraded Wordpress to the latest version (3.5) and it's now throwing me a Javascript error when I try to add a media : _.omit is not function Please, any help would be really appreciated


title: Image.php Problem - Post Images Not Displaying In It

text: When I insert an image into a post and link to that image, the link is sending me directly to the file rather than displaying the image via my image.php template. How can I solve this? I haven't been able to find the solution online. This is not a problem with my [gallery] shortcode, which is bringing me to image.php - just with single images.


title: The WordPress Gallery, Grabbing The Link and Images?

text: I have created a template for gallery named image.php which allows me to create a news website style image gallery that can be embedded in posts. But I need two more things to make this complete.   * First, I want to know **how to create a text link to the first image in a gallery** , rather than displaying thumbnails for the gallery as the built-in [gallery] shortcode currently does. For example, check out "click here to start" on this page: http://www.businessinsider.com/android-vs-iphone-debate-quotes-2011-12   * Secondly, if anybody knows **how to generate a list of all the images in a gallery** which I can add to my image.php file that would be great to have so I could use it to create a slider on the bottom of each page featuring an image with the other images in the gallery.


title: Jquery UI implementation

text: I have to register the jQuery UI in function file. I don't want it directly in header.php               function my_jquery_ui() {     // register your script location, dependencies and version     wp_register_script('jquery-ui-1.8.16', get_template_directory_uri().'/js/jquery-ui-1.8.16.js', array('jquery'), '1.8.16');     // enqueue the script     wp_enqueue_script('jquery-ui-1.8.16');     }     add_action('wp_enqueue_scripts', 'my_jquery_ui');      According to firebug, the jQuery plugin is registered I'm trying to create tabs which you can see it here: http://www.vmjconsulting.com/wordpress01/testing/#tabs-1 Please Advise.


title: wpdb->get_var - count author posts, meta value

text: In an author.php template, i count the author post in a custom post type with $wpdb->get_var,               $post_author = $curauth->ID; //author id     $count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->posts WHERE post_author = $post_author AND post_type IN ('ideas') and post_status = 'publish'" );      is it possible to count the author, total votes saved in post meta with key 'votes'?   the value for every post is a number updated each time a user votes a post thanks!


title: Using PHP mail; getting Header warning

text:
I've created a contact form using PHP mail() directly inside a page. It successfully emails te contact information to the recipient. However, it won't advance to the confirmation page identified in header() and outputs the following error: Warning: Cannot modify header information - headers already sent by (output started at /home/redacted/redacted.com/wp-content/themes/diner/includes/theme- functions.php:752) in /home/redacted/redacted.com/wp- content/themes/diner/page.php on line 163 Any advice or resource links on how to fix this?               <?php     function spamcheck($field)       {       //filter_var() sanitizes the e-mail       //address using FILTER_SANITIZE_EMAIL       $field=filter_var($field, FILTER_SANITIZE_EMAIL);            //filter_var() validates the e-mail       //address using FILTER_VALIDATE_EMAIL       if(filter_var($field, FILTER_VALIDATE_EMAIL))         {         return TRUE;         }       else         {         return FALSE;         }       }          if (isset($_REQUEST['contact_email']))       {//if "email" is filled out, proceed            //check if the email address is invalid       $mailcheck = spamcheck($_REQUEST['contact_email']);       if ($mailcheck==FALSE)         {         echo "Invalid input";         }       else         {//send email         $inquirer_name = $_REQUEST['contact_name'] ;         $email = $_REQUEST['contact_email'] ;         wp_mail(     "redacted@gmail.com",     "Subject: Test contact",     "Name: $inquirer_name     Email: $email "     );     header("Location:http://redacted.com/contact-confirmed");         }       } else { //if "email" is not filled out, display the form ?>          <form method="post" action="http://redacted.com/contact">

First Name: <input name="contact_name" type="text" />

Email: <input name="contact_email" type="text" />

<input type='submit' />

          <?php } ?>


title: Forcing nickname as display_name in custom edit profile template

text:
# Context I've created a front-end "edit profile" template. When I input a value into the nickname text box only the nickname is updated. The default WordPress forum has a select menu that allows/requires the user to select their display_name (a text box for the nickname, a select menu for the display_name). My form doesn't do this because I can't figure out a means of forcing the nickname to update the display_name additionally (i.e. I have a text box for the nickname but not a select menu for the display_name - I want to automate this). display_name is stored in the 'users' table. nickname is stored in the 'users_meta' table. # Code for saving:               <?php     /* Get user info. */     global $current_user, $wp_roles;     get_currentuserinfo();          /* Load the registration file. */     require_once( ABSPATH . WPINC . '/registration.php' );          /* 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                 $error = __('The passwords you entered do not match.  Your password was not updated.', 'profile');         }              /* Update user information. */         if ( !empty( $_POST['url'] ) )             update_usermeta( $current_user->id, 'user_url', esc_url( $_POST['url'] ) );         if ( !empty( $_POST['email'] ) )             update_usermeta( $current_user->id, 'user_email', esc_attr( $_POST['email'] ) );         if ( !empty( $_POST['first-name'] ) )             update_usermeta( $current_user->id, 'first_name', esc_attr( $_POST['first-name'] ) );         if ( !empty( $_POST['last-name'] ) )             update_usermeta($current_user->id, 'last_name', esc_attr( $_POST['last-name'] ) );         if ( !empty( $_POST['description'] ) )             update_usermeta( $current_user->id, 'description', esc_attr( $_POST['description'] ) );                            if ( !empty( $_POST['display_name'] ) )             update_usermeta($current_user->id, 'display_name', esc_attr( $_POST['display_name'] ) );        if ( !empty( $_POST['memberlocation'] ) )             update_usermeta($current_user->id, 'memberlocation', esc_attr( $_POST['memberlocation'] ) );        if ( !empty( $_POST['skype'] ) )             update_usermeta($current_user->id, 'skype', esc_attr( $_POST['skype'] ) );                        /* Redirect so the page will show updated info. */         if ( !$error ) {             wp_redirect( get_permalink() );             exit;         }               global $wpdb;          global $current_user;     $current_user = wp_get_current_user();          $user_id = wp_get_current_user();     $nickname = 'testname';     update_user_meta($user_id, 'nickname', $nickname);               }               ?>      # Code for form:               <?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('You must be logged in to edit your profile.', 'profile'); ?>
                     <?php else : ?>                         <?php if ( $error ) echo '
' . $error . '
'; ?>                         <form method="post" id="adduser" action="<?php the_permalink(); ?>">
                                 <?php _e('Add display name *', 'profile'); ?>                                 <input class="text-input" name="nickname" type="text" id="nickname" value="<?php the_author_meta( 'nickname', $current_user->id ); ?>" />

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

                                 <?php _e('Member Location *', 'profile'); ?>                                 <input class="text-input" name="memberlocation" type="text" id="memberlocation" value="<?php the_author_meta( 'memberlocation', $current_user->id ); ?>" />

                                 <?php _e('Website', 'profile'); ?>                                 <input class="text-input" name="url" type="text" id="url" value="<?php the_author_meta( 'user_url', $current_user->id ); ?>" />

                                 <?php _e('Password *', 'profile'); ?>                                  <input class="text-input" name="pass1" type="password" id="pass1" />

                                 <?php _e('Repeat Password *', 'profile'); ?>                                 <input class="text-input" name="pass2" type="password" id="pass2" />

                                 <?php _e('Biographical Information', 'profile') ?>                                 <textarea name="description" id="description" rows="3" cols="50"><?php the_author_meta( 'description', $current_user->id ); ?></textarea>

                                 <?php echo $referer; ?>                                 <input name="updateuser" type="submit" id="updateuser" class="submit button" value="<?php _e('Update', 'profile'); ?>" />                                 <?php wp_nonce_field( 'update-user' ) ?>                                 <input name="action" type="hidden" id="action" value="update-user" />
                         </form>                         <?php endif; ?>

                 <?php comments_template( '', true ); ?>                 <?php endwhile; ?>             <?php else: ?>
                     <?php _e('Sorry, no page matched your criteria.', 'profile'); ?>
             <?php endif; ?>      # My question How do I force the display_name to be updated whenever the nickname is updated in my custom page template?


title: restrict posts per page

text: I want to display in a _featured slideshow_ only 3 posts, but it is ignored and it shows a lot of posts. How to fix it?               $my_query = new WP_Query(         array(              'posts_per_page' => 3,              'post_id' => $featitem          )     );     while ($my_query->have_posts()) :          $my_query->the_post();


title: Why is 'pre_get_posts' having no effect?

text: I'm trying to use pre_get_posts for the first time without any success. It's a very simple piece of code on the index page of an otherwise empty theme, purely to get the hang of the action hook:               function just_one( $query )     {         $query->set( 'posts_per_page', 1 );     }     add_action( 'pre_get_posts', 'just_one' );      From what I have read, I cannot see anything wrong with this, but when I run this below it:               echo get_query_var( 'posts_per_page' );      it displays the default '10', rather than the '1' I was expecting. Am I doing something wrong? The index page is entirely empty apart from the above code. Cheers for any help.


title: Adding a filter to wp_edit_posts_query() to prevent hierarchical display of pages

text: So I have a Wordpress 3.3.2 installation with around 8k pages in it now. I seemed to have gotten past a threshold that causes edit.php and the page listing in the admin to take about 20 minutes to load. I've tried multiple server setups, one with a 1GB memory limit, and nothing helped, this is also on a development server so there is no user traffic. I submitted this as a bug, and a developer said that as I could "turn off hierarchical display in edit.php. A filter in wp_edit_posts_query() might be able to accommodate this" as a potential workaround until they fix it in an update. Does anyone know how this can be done? Kind of a repost of Too many pages causes Wordpress admin to be unusable but I narrowed down a possible solution and was hoping to get feedback on that specifically.


title: How do I ensure custom post type information is displayed in correct order?

text: I would like to display some category archives below whatever the user has typed in on a custom post type. How do I make sure that the user's content displays above mine?


title: How to make blog posts appear under different menu items?

text: On my site, I have a 'blog' menu item and a 'portfolio' menu item. http://richardclunan.com/blog/ http://richardclunan.com/portfolio I'd like to make it so that when I post a blog post, I can determine whether it appears under 'Blog' or under 'Portfolio'. Is it possible to do this? How? I read that it's possible to do this using categories, but I can't get it to work. So perhaps I'm misunderstanding the instructions.


title: How to programmatically detect how many posts are displayed per page?

text: Part of a custom post type that I am building needs to simulate page 1 of a category archive. How can I found out how many posts are displayed per page across the WordPress installation? (I assume it is in `wp_options` but I cannot find it.) Thank you!


title: Adding custom field to Lightbox in header only pulls current page data, not Lightbox item data

text: I'm currently using Advanced Custom Fields to create a custom field `has_the_portrait_sold` which will be indicated on my Prettyphoto / Lightbox item. However, when I use PHP from the example (it is true or false):               if(get_field('has_the_portrait_sold')){     echo "The item has been sold.";     }else{     echo "The item has not been sold";     }      In header.php:                     However, while this may include the custom field in the lightbox as needed, it apparently only displays custom field data for the current page. I am needing custom field data to print for the current lightbox item / WordPress' image attachment. I therefore tried including the custom field call in `post-template.php`. Please note my PHP skills are limited, I am VERY determined to make this work.               return apply_filters( 'wp_get_attachment_link', "$link_text<?php     if(get_field('has_the_portrait_sold')){     echo "do something";     }else{     echo "do something else";     }     ?>", $id, $size, $permalink, $icon, $text );     }      I feel like I am on the right path in including the custom field call in `post-template.php` . However, I just do not have the PHP skills necessary to create the correct call. I'm wondering if someone here can help. I am very desperate, but not willing to give up. Thanks in advance.


title: Migrated Wordpress site renders Chinese

text: So, I have no idea what happened, but I tried to migrate a WP site and for some odd reason, it just renders in all Chinese/Japanese. ![enter image description here](http://i.stack.imgur.com/ZCawv.png) I've been working on this site locally, and it renders fine without errors. I've disabled all of my plugins and nothing changes. I've deactivated the theme and selected another theme, which will work, but then when I select the other theme, it goes back to the asian characters. So, I'm sure it's with the theme, but I have no idea what's different from my local copy versus the one that I've put up on the dev environment. I'm just wondering if anyone has ran into this issue before all. I was using Grunt to compile and compress my SASS files to CSS as well as compress my JS files as well. But I don't know why everything works without issue on my local version versus the one online.


title: how to json_encode(); the Loop content so that the encoded array is ["0":content, "1":content]

text:
<?php     $dVC=array();     query_posts('meta_key=featuredt&posts_per_page=5');     if (have_posts()) :     while (have_posts()) : the_post();     $dVC []= $post->post_content;?>     <div id="featuredt-<?php echo $wp_query->current_post;?>">     <?php echo get_post_meta($post->ID, 'featuredt', TRUE);?>
     <?php endwhile;     endif;     json_encode($dVC);     ?>      This is my loop at the moment. I need the json encoded variable to look like ["0":content, "1":content] so I can use jQuery.parseJSON() on it. I don't mind people telling me about jQuery.getJSON() but I have less of an idea how to use it then parseJSON. Please provide detailed examples when explaining, I really would appreciate any help I could get though.


title: How to limit wp_get_archives to show months for the X years only

text: Can anybody show me how to set a limit on wp_get_archives to show archives by month BUT only those for the year 2010 and above - so the 2009 monthly archives are not shown on the sidebar archive widget. Thank you!


title: Problem with Wordpress Comment

text:
Im sorry about my english. I have made more than 5 comments on post pages. I have publish all the comments. But there are no comments that appear on the post page. This is my **Comments.php** content:               <?php     /**      * @package WordPress      * @subpackage Default_Theme      */          // Do not delete these lines         if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))             die ('Please do not load this page directly. Thanks!');              if ( post_password_required() ) { ?>
This post is password protected. Enter the password to view comments.
         <?php             return;         }     ?>                    <?php if ( have_comments() ) : ?>
<?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”

         <?php wp_list_comments('avatar_size=58'); ?>

<?php previous_comments_link() ?>

<?php next_comments_link() ?>

           <?php else : // this is displayed if there are no comments so far ?>              <?php if ( comments_open() ) : ?>                            <?php else : // comments are closed ?>
Comments are closed.
              <?php endif; ?>     <?php endif; ?>          <?php comment_form(); ?>          <?php if ( comments_open() ) : ?>

<?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?>

         <?php cancel_comment_reply_link(); ?>
          <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in to post a comment.
     <?php else : ?>          <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">          <?php if ( is_user_logged_in() ) : ?>
Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out »
          <?php else : ?>
<input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />     Name <?php if ($req) echo "(required)"; ?>

<input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />     Mail (will not be published) <?php if ($req) echo "(required)"; ?>

<input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />     Website
          <?php endif; ?>
<textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea>

<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />     <?php comment_id_fields(); ?>
     <?php do_action('comment_form', $post->ID); ?>          </form>          <?php endif; // If registration required and not logged in ?>
          <?php endif; // if you delete this the sky will fall on your head ?>      In my **single.php** , I load the comment using this code: `<?php comment_form(); ?>` Why i using ( `<?php comment_form(); ?>` ) this code, because "Theme Check" required that. Please help me. Thank you


title: Different Ways to Query Custom Post Types?

text: I'm using this code to use custom post types like regular post:               add_action( 'pre_get_posts', 'add_my_post_types_to_query' );          function add_my_post_types_to_query( $query ) {     if ( is_home() && $query->is_main_query() )         $query->set( 'post_type', array( 'post', 'miss_behave', 'emily_davies','gemma_patel','poppy_smythe' ) );     return $query;     }      But I also saw this code to display custom post types:               $query = new WP_Query( array(     'post_type' => array( 'post', 'page', 'movie', 'book' )     ) );      I'm wondering what the differences are between the two methods. Thanks.


title: Facebook meta tags not working properly on WordPress Site

text: I want tow things in my site. First when any user click on `facebook` button to `share` any post it shwo `image` and `content`, `title` only and the 2nd one is when any one copy the link of my site and directly paste it into `facebook` then it show. site `name`,`logo` and `description`. Now the main problem is i have two option one is i use `meta tag` of `facebook` in header or i can use any plugin in for this. Now i am using `plugin` in Wondermoon's. Now the problem is some post creating little problem. i attach images ![enter image description here](http://i.stack.imgur.com/9z3ut.png)![enter image description here](http://i.stack.imgur.com/xjqHi.png)![enter image description here](http://i.stack.imgur.com/kyPvj.png)![enter image description here](http://i.stack.imgur.com/2uKKQ.png) Now these are 4 images. First three images are when user click on `share` button. And it show different content. The correct one is 3rd. Don't know what is problem with 1st two. And the last image is when any one paste the link of site on facebook. It not show any `logo` or `site` `name`,`description`. So is there any solution for this. Or any `plugin` in. Thanks


title: How can I serve different images depending on screen size with wordpress

text: I am creating a responsive WordPress website with a mobile-first approach. When my client uploads an image for a blog post, I would like WordPress to then generate smaller versions of the image (with a smaller file size!) which then get served to smaller screen sizes? Even if the user has to upload several versions of the image themselves, this would still be a good solution. I am aware there is a function called add_image_size, however I believe this only changes the dimensions of the image, and not the actual file size. The different file sizes are the most important thing here. So is there any plugin or code I have to write to enable this? I look forward to hearing any help or advice on this question. Thanks


title: I want to load post content by categories using Ajax

text: I have question. I would like to load post content, custom post, depends on category. So first of all I would like to have drop down menu which will list all my categories then once user will select category list of post title will appear in second drop down (post from that particular category) then once that title selected post content will load. All that needs to be done on one page and without reloading so using Ajax. I stacked at the very beginning               <script type="text/javascript">     $(function(){                 $('#main_cat').change(function(){                         var $mainCat=$('#main_cat').val();                              // call ajax                          $("#sub_cat").empty();                             $.ajax({                                 url:"/wp-admin/admin-ajax.php",                                 type:'POST',                                                             data:'action=my_special_action&main_catid=' + $mainCat,                                       success:function(results)                                      {                                     //  alert(results);                     $("#sub_cat").removeAttr("style");                     $("#sub_cat").append(results);                                             }                                        });                               }                                         );     });     </script>      And I found that bit which was inserted into function.php and I do realize that that needs to be modified somehow to pull out posts rather then children of categories               add_action('wp_ajax_my_special_action', 'my_action_callback');     add_action('wp_ajax_nopriv_my_special_action', 'my_action_callback');     function implement_ajax() {     if(isset($_POST['main_catid']))                 {                 $categories=  get_term_by('child_of='.$_POST['main_catid'].'&hide_empty=0');                   foreach ($categories as $cat) {                     $option .= '<option value="'.$cat->term_id.'">';                     $option .= $cat->term_id;                     $option .= ' ('.$cat->category_count.')';                     $option .= '</option>';                   }                        echo '<option value="-1" selected="selected">Scegli...</option>'.$option;                 die();                 } // end if     }     add_action('wp_ajax_my_special_ajax_call', 'implement_ajax');     add_action('wp_ajax_nopriv_my_special_ajax_call', 'implement_ajax');//for users that are not logged in.      Thats as far as i got. Any help will be appreciated


title: Upgrade to 3.4 error: Call to undefined function get_option()

text: After running the automated upgrade to 3.4, I receive the message > Fatal error: Call to undefined function get_option() in /.../wp- > admin/admin.php on line 32 I have renamed plugins/ to plugins2/, renamed themes/ to themes2/, created themes/ and placed twentyten in there. Still fails with same error. I have downloaded a copy of 3.4, and uploaded /wp-admin and /wp-includes. Still fails with the same error. When I try to run wp-admin/upgrade.php I receive: "Fatal error: Call to undefined function timer_start() in /.../wp- admin/upgrade.php on line 20" Line 32 of /wp-admin/admin.php is:               if ( get_option('db_upgraded') ) {      I tried manually inserting this option set to true in the wp_options table in phpmyadmin, but the same error remains.


title: How to display date such "x ago"

text: I want display date based on how much time has passed since, i. e. _Posted 12 minutes ago_


title: How can I scale down the width of images in bulk that are embedded in posts throughout the site?

text: I am building a new WordPress theme and it is quite different from my current theme. Currently the dimensions of my images are much wider than how I would like them to be for my new theme I am developing. Is there way to scale down the widths programmatically and in mass? Is there a plugin that accomplishes this task?


title: User profile Pick a premade Design/theme

text: i currently have been working on a huge project for the last few months and im not a big coder myself but i know a bit, so i needed help, i wanted to assign each user with a already premade design kinda like twitter has you preview the design/with icons and live preview/ were they can pick a few premade designs, if they desire it of course if possible but it seems i run into issue because my lack of skills , its kinda would be a custom design for each user ?… its this possible or is there another alternative? like can i provide custom images/backgrounds, they can pick as there background at least that.. i really hope someone can help me out thank you, have a nice day.!


title: Search results from a specific database table

text: I have to display search results using the wordpress search, but searching in a database table that's not from the wordpress tables. So, for example, if my table's name is "customers", how can I write the code for do that search? Thanks a lot


title: Fatal Error: get_header();

text:
> Fatal error: Call to undefined function get_header() I can't get this working. I am using twentythirteen default theme shipped with wordpress. I have created a custom template called `table.php` and I also used `<?php template name ?>`. This custom template simply shows up all records in a database. Its working just fine but header and footer are missing and when I try to add header and footer of the current theme by adding `get_header` and `get_footer`, it throws a fatal error. Here is the code: Just to mention, I used `index.php` that is inside twentythirteen folder, not from root folder where `wp-config` file or any other `index.php` for that matter.               <?php     /**      * The main template file      *      * This is the most generic template file in a WordPress theme and one of the      * two required files for a theme (the other being style.css).      * It is used to display a page when nothing more specific matches a query.      * For example, it puts together the home page when no home.php file exists.      *      * @link http://codex.wordpress.org/Template_Hierarchy      *      * @package WordPress      * @subpackage Twenty_Thirteen      * @since Twenty Thirteen 1.0      */          get_header(); ?>
                  <form method = "post"  action="<?php echo get_stylesheet_directory_uri(); ?>/dbentry.php">                 First Name: <input type="text" name = "first">*<?php echo $first_error;?>
                      Last Name: <input type="text" name = "last">*<?php echo $last_error; ?>
                      Email: &nbsp &nbsp &nbsp &nbsp    <input type="text" name = "email">
                 Telephone: <input type="number" name = "telephone">*<?php echo $tele_error; ?>
                      Gender:&nbsp &nbsp                  <input type="radio" name = "gender" value = "female">Female                 <input type="radio" name = "gender" value = "male">Male
                      <input type="submit" value ="submit" name="submit">
                       </form>
                      <form action="<?php echo get_stylesheet_directory_uri(); ?>/tab.php"     method="post">                 <input type="submit" name = 'submit2' value = 'http://localhost/wordpress/?page_id=11'>             </form>          <?php get_sidebar(); ?>     <?php get_footer(); ?>      **Here is the code where the call will go after pressing the "Show all records" button.**               <?php         /**          * The template for displaying all pages          *          * This is the template that displays all pages by default.          * Please note that this is the WordPress construct of pages and that other          * 'pages' on your WordPress site will use a different template.          *          * @package WordPress          * @subpackage Twenty_Thirteen          * @since Twenty Thirteen 1.0          */               /*           Template name: tab          */              get_header(); ?>

                 <?php                         require "db.php";                         if(isset($_POST['submit2'])){                         $query = "SELECT * FROM person";                         $result = mysqli_query($connection, $query);                         $row = '';                         $id = "";                         echo "
";                         echo "ID	";                         echo "FIRST	";                         echo "LAST	";                         echo "EMAIL	";                         echo "TELEPHONE	";                         echo "GENDER	";                         echo "EDIT	";                         echo "DELETE	";                         echo "
";                 echo "
this is working just fine
";                         while($row = mysqli_fetch_array($result)){                             $id = $row['ID'];                 echo $id ;                                  echo "
".$row['ID']."	".$row['First']."	".$row['Last']."	".$row['Email']."	".$row['Telephone'].                             "	".$row['Gender']."	"."<input type='button' class = 'edit' value = 'Edit'>"."	"."<input type='button' class = 'del' value='Delete'>"."
";                              }                              mysqli_close($connection);                         }                  ?>

jsdnsdjnsjd

                            <form action="form.php" method="post">             <input type="submit" name="new" value="New Entry" class = "new">             </form>                             <?php get_sidebar(); ?>         <?php get_footer(); ?>


title: Improving the Thesis built-in dropdown menu via javascript

text: The dropdown menu that Thesis creates is 99% fine, except that it's very unforgiving to users that don't master the use of mouse very easily - old people and people with average to bad vision. I would like to improve its usability using a bit of javascript, allowing the mouse to be a few pixels offside and still keep the submenu open. I tried this in my custom javascript file:               var hoverConfig = {                  over: function(e){                     e.preventDefault();                     $.log("launch menu");                     $('.sub-menu',$(this)).show();             },               timeout: 500, // number = milliseconds delay before onMouseOut                 out:  function(e){                     e.preventDefault();                     $.log("hide menu");                     $('.sub-menu',$(this)).hide();             }          };              $('.sub-menu').hide();         $("#menu-main-menu").hoverIntent( hoverConfig );      Firebug logging shows that it works - the show and hide functions are called, but the CSS behaviour still triggers and i don't manage to cancel it so that the javascript behaviour takes the full control. Any idea how i can do that?


title: Where are a theme's options stored and can I export them to be imported into freshly installed themes?

text: Imagine that a person has a few premium themes that they use for clients. In those premium themes are many different options that can be set. Is it possible to set the theme's options to the most common and preferred choices and then export those options for later importation into other fresh WordPress installs with the same theme? That way one is not merely pointing and clicking their way through the various options over and over again for each new install.


title: How to show full post?

text:
I'm using this theme for my magazine website. I'm having trouble showing the full content on my blog side. I have tried changing in the php to `show_content` but it doesn't work. Any suggestions on how to solve this This is the page code:               <?php      /* Template Name: Home 5 */     ?>          <?php get_header(); ?>

                                    Recent Posts

                  <?php if ( have_posts() ) : ?>                                       <?php $wp_query = new WP_Query( array(                                                      "cat" => "",                                                      "posts_per_page" => "",                                                      "post_type" => "post",                                                     "paged" => get_query_var('paged') ? get_query_var('paged') : 1                                                     )                                                                                );                 while( $wp_query->have_posts() ) : $wp_query->the_post(); ?>                      <div <?php post_class(); ?>>
                             <a href="<?php the_permalink() ?>" title="<?php the_title_attribute(); ?>">                                 <h1 class="tmpost-<?php the_ID(); ?>">                                 <?php $tit = the_title('','',FALSE); echo substr($tit, 0, 150); if (strlen($tit) > 150) echo " ..."; ?>

                         <div class="tmpost-<?php the_ID(); ?>-item">
                                                           <?php _e('By', 'tm_myid_text'); ?> <?php the_author(); ?>

                                                           In <?php $category = get_the_category(); echo $category[0]->cat_name; ?>

                                                          <?php the_time('M jS, Y') ?>

                                                           <?php comments_number(__('0 Comments', 'tm_myid_text'), __('1 Comment', 'tm_myid_text'), __( '% Comments', 'tm_myid_text') );?>

                                                           <?php echo tm_viewcounter_display(get_the_ID()); ?>

                     <?php if (has_post_thumbnail()) { ?>                         <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">                         <?php the_post_thumbnail( 'Full' ); ?>                                              <?php } else { ?>                     <?php } ?>

                         <?php echo excerpt(500); ?>

                                 <a href="<?php the_permalink() ?>">                                                                           <?php _e('Kommentera', 'tm_myid_text'); ?>

                      <?php endwhile; ?>

             <?php echo tm_pagination_nav(); ?>

                           <?php else : ?>             <?php endif; ?>
               <?php get_template_part( 'sidebar_left' ); ?>                    <?php get_footer(); ?>


title: Dot "." in option value foobars save options function

text:
My theme options save routine is below. I'm finding that if the $value['id'] being passed from my options array has a period in it, the data does not get passed and the options appear to break at that point. Should I opt for another character or is there a workaround for using the period character in an option name? For example, this works fine:                "id" => "myTheme_color|sidebar",      but this does not (no data is passed for the value):                "id" => "myTheme_color.sidebar",      The save function is:               function mytheme_add_admin(){     global $themename, $shortname, $options;      if ( $_GET['page'] == basename(__FILE__) )     {         if ( 'save' == $_REQUEST['action'] )          {             foreach ($options as $value)              {                 update_option( $value['id'], stripslashes($_REQUEST[$value['id']]) );              }             foreach ($options as $value)              {                 if( isset( $_REQUEST[ $value['id'] ] ) )                  {                     update_option( $value['id'], stripslashes($_REQUEST[ $value['id'] ])  );                  echo $value['id'].": ".$_REQUEST[$value['id']]."
";                 echo $value['id'].": ".stripslashes($_REQUEST[$value['id']])."
";                 }              }         }     }


title: Passing Variables through locate_template

text: While I've typically used include or require on their own to save long term code maintenance I've started to use get_template_part and locate_template as using built in WordPress stuff is always best. My question is are you supposed to be able to pass variables through to the results of either get_template_part or locate_template?               <?php     $var = get_option( 'my-custom-option' );          get_template_part( 'custom-template-part' );     ?>      In the code above the $var would be printed inside the custom template but the variable doesn't seem to work. Am I missing something or is this expected behaviour? I've found that they don't pass in the instance above or when using locate_template               <?php     locate_template( 'custom-template-part.php', true );     ?>


title: Custom post type metabox array

text:
I am trying to create a custom post type with custom metabox array. How can I create this kind a automatic populating post type? I think I have to use two dimension array. But how can I automatically populate my data array? And how can I save this kind array. Could some one point me to right direction? **Please take a look at the images.** ![Img1](http://i.stack.imgur.com/HQVYn.png) Second img ![enter image description here](http://i.stack.imgur.com/WLwbH.png) My code so far :               <?php     //add custom field - price     add_action("admin_init", "price");          function object_init(){       add_meta_box("price_meta", "Price fields :", "object", "price_meta", "normal", "low");          }               function price_meta(){      global $post;       $custom = get_post_custom($post->ID);       $price = $custom["price"][0];       ?>
Nr :
         <input type="text" name="priceNr" size="10" value="<?php echo $price; ?>"/>

Description :
         <input type="text" name="priceD" size="50" value="<?php echo $price; ?>"/>

Price :
         <input type="text" name="price" size="20" value="<?php echo $price; ?>"/>
            <?php     }     //Save product price     add_action('save_post', 'save_detailss');          function save_detailss(){      global $post;           $post_id = $post->ID;           // to prevent metadata or custom fields from disappearing...      if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE )      return $post_id;           update_post_meta($post_id, "price", $_POST["price"]);           }             ?>


title: How to get a Jewish/English event calendar on a page in WordPress?

text: What I need is an event calendar to display both the english and Jewish dates, but have it be based on the hebrew date. With this people could input the date of an anniversary and have it reappear every year on the hebrew date and just show what date that would translate to in the english calendar. I've seen this calendar http://wordpress.org/extend/plugins/events-calendar/, which is perfect, only it doesn't have the Jewish dates. How would I go about doing this? Thank you very much in advance.


title: Why my meta boxes won't show in front post page?

text:
I see it everywhere: in single post, in category archives etc, but in front page post not. I display the metaboxes in this way:               <?php if (get_post_meta($post->ID, 'test_1', true) != '' ) { ?><?php echo get_post_meta($post->ID, 'test_1', true);?><?php } ?>      What's wrong? What i'm doing wrong? Is possible to display the meta boxies in a different way? **Here is the code:**               add_action( 'init', 'create_xy_taxonomies', 0 );     function create_pc_db_taxonomies() {     register_taxonomy( 'genre', 'post', array( 'hierarchical' => false, 'label' => __('Tests', 'series'), 'query_var' => 'test', 'rewrite' => array( 'slug' => 'tests' ) ) );          $prefix = 'xy_meta_';               $meta_box = array(         'id' => 'xy-meta-box',         'title' => 'Xy tests',         'page' => 'post',         'context' => 'normal',         'priority' => 'high',         'fields' => array(             array(                 'name' => 'Test_1',                 'id' => 'test_1',                 'type' => 'text',                 'std' => ''             ),             array(                 'name' => 'Test_2',                 'id' => 'test_2',                 'type' => 'select',                 'options' => array('','1'),                 'std' => ''             ),         )     );          add_action('admin_menu', 'mytheme_add_box');          function mytheme_add_box() {         global $meta_box;              add_meta_box($meta_box['id'], $meta_box['title'], 'mytheme_show_box', $meta_box['page'], $meta_box['context'], $meta_box['priority']);     }          function mytheme_show_box() {         global $meta_box, $post;                   echo '<input type="hidden" name="mytheme_meta_box_nonce" value="', wp_create_nonce(basename(__FILE__)), '" />';              echo '
';              foreach ($meta_box['fields'] as $field) {                  $meta = get_post_meta($post->ID, $field['id'], true);                  echo '
',                     '', $field['name'], '	',                     '';             switch ($field['type']) {                 case 'text':                     echo '<input type="text" name="', $field['id'], '" id="', $field['id'], '" value="', $meta ? $meta : $field['std'], '" size="30" style="width:97%" />',                         '
', $field['desc'];                     break;                 case 'textarea':                     echo '<textarea name="', $field['id'], '" id="', $field['id'], '" cols="60" rows="4" style="width:97%">', $meta ? $meta : $field['std'], '</textarea>',                         '
', $field['desc'];                     break;                 case 'select':                     echo '<select name="', $field['id'], '" id="', $field['id'], '">';                     foreach ($field['options'] as $option) {                         echo '<option', $meta == $option ? ' selected="selected"' : '', '>', $option, '</option>';                     }                     echo '</select>';                     break;                 case 'radio':                     foreach ($field['options'] as $option) {                         echo '<input type="radio" name="', $field['id'], '" value="', $option['value'], '"', $meta == $option['value'] ? ' checked="checked"' : '', ' />', $option['name'];                     }                     break;                 case 'checkbox':                     echo '<input type="checkbox" name="', $field['id'], '" id="', $field['id'], '"', $meta ? ' checked="checked"' : '', ' />';                     break;             }             echo    '',                 '
';         }              echo '
';     }          add_action('save_post', 'mytheme_save_data');               function mytheme_save_data($post_id) {         global $meta_box;         if (!wp_verify_nonce($_POST['mytheme_meta_box_nonce'], basename(__FILE__))) {             return $post_id;         }         if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) {             return $post_id;         }         if ('page' == $_POST['post_type']) {             if (!current_user_can('edit_page', $post_id)) {                 return $post_id;             }         } elseif (!current_user_can('edit_post', $post_id)) {             return $post_id;         }         foreach ($meta_box['fields'] as $field) {             $old = get_post_meta($post_id, $field['id'], true);             $new = $_POST[$field['id']];                  if ($new && $new != $old) {                 update_post_meta($post_id, $field['id'], $new);             } elseif ('' == $new && $old) {                 delete_post_meta($post_id, $field['id'], $old);             }         }     }


title: Gallery Image Numbers?

text: Is there a way, in an image gallery, to display what number the image is in the gallery in the image.php template? I'd like to incorporate this into my next / previous button area. For example, if I'm on the first image out of twenty it would say "1 of 20".


title: Custom Post Type - Main page for certain posts

text: I've successfully added a custom post type.               register_post_type('case',             array(                 'labels' => array(                     'name' => __('Cases'),                     'singular_name' => __('Case')                 ),                 'public' => true,                 'has_archive' => true,                 'supports' => array('title', 'editor', 'thumbnail','custom-fields', 'page-attributes')             )              );      And I've created a page called "case" and I have my permalinks configured like this:               /%postname%      The problem I'm having now is that when I try to access url.com/case I don't get my page "case" but instead I'm looking at the custom post type "case". I think? Every "case" has its own url --> url.com/case/xxx. I don't want to change this but instead be able to change the layout for the custom page "main" page that represents all the cases instead of a "page" called case. Can this be done and how?


title: WP Supersized: Insert zero in front of one digit slider numbers

text: I hope there is a WP Supersized champ out who know the answer to this one: I would like to turn the one digit slide numbers in WP Superslider into two digit numbers. So 1/15 would be 01/15, 3/5 would be 03/05, and so on. Can somebody help me, please? :) Plugin: http://wordpress.org/support/plugin/wp-supersized **So far I have tried this script** - but it only works until it goes to next slide:               $(".number").text(function(i, val){         return $.trim(val).length === 1 ? '0' + val : val;     });      **Also I think this PHP could work.** (But I can not figure out where to put it, because it is not clear to me where in the plugin the numbers are printed):               $number_padded = sprintf("%02s", $number);     echo $number_padded;


title: How to check if a certain theme option settings has already been set

text: I am using the following lines to check if the theme setting already exist or set but it's not working:               if (get_theme_mod('mysetting')==FALSE) {      Aside from get_theme_mod, how to really check if the theme setting is already set? Thanks.


title: Class for Selected Menu using wp_nav_menu

text: I create Widget for Vertical menu Now I am trying to get selected or current menu using **wp_nav_menu** Any one know how to Add current class when selected in **wp_nav_menu**


title: Different development environments (Mac & Windows)

text: I am trying to synchronize development between a Windows user (WAMP) and a Mac user (Regular Apache). **Windows User (me)** Since I use IIS I need my port 80 so I have changed the ports on WAMP to :666. So the url to the Wordpress is http://localhost:666/projectname/ **Mac user** He has the site on a non-alias, just the path the the project So the url is http://localhost/foldername/wordpress/ * * * In wp-config.php I have the following code               if (file_exists('local_settings.php')) {     include('local_settings.php');     } else {     $debug_on = true;     }      And in the local_settings.php               define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST'] . '/projectname/');     define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . '/projectname/');      But this code doesn't seem to actually override the damn stupid database siteurl because when he tries to login, it still heads to localhost:666 (which is the value in the database). Or is it impossible to sync different developers? How do you guys do it? And please don't ask me to change my port to :80 :)


title: Symbolic Links for themes - linking one theme to many wordpress installs

text: This discussion relateds to plugins: Symbolic Links on dev box with plugins and stylesheets I was wondering if the same problem exists for symlinking a theme to many different wordpress installs. **Example structure:** > domain/footheme/ <- theme resides here **The following domains symlinks created here:** > domain/myfoo.com/wp-content/theme/(footheme) > > domain/myfoo2.com/wp-content/theme/(footheme) > > domain/myfoo3.com/wp-content/theme/(footheme) **Example Symlink Creation** `ln -s domain/footheme domain/myfoo.com/wp-content/theme/footheme`


title: Should I use "Categories " or "Pages" for a WordPress Static Site (A non blog site)?

text: I want to use WordPress for a Company Site which is not a blog; that will have regular pages, such as "About Us", "our Products", "Our Services", etc. What is the best way to use WordPress for this project ? Should I use "Pages" to define individual pages, or Should I use "Categories" to define pages ? I'm planing to use some free WordPress Themes to design/customize and deploy the site, what should I be aware of if I'm to use WordPress for a non-blog site ... Thank you for your advices ... Fawaz


title: Sites network with sub-folders

text: I want to create sites network. I was following with this tutorial: http://codex.wordpress.org/Create_A_Network Unfortunately it doesn't works. I the admin panel I do not have any links to manage the sites like 'Network admin': http://codex.wordpress.org/images/7/78/network-admin-link.png My wordpress is here: k-state|dot|zxq|dot|net Thanks in advance!


title: WP_Query based on multiple metadata comparisons

text: I have created a custom post type with custom fields and I need to filter them based on several meta data values.               $args = array(            'post_type' => 'match_report',            'post_status' => 'publish',            'meta_key' => 'report_type',            'meta_value' => 'cup',            'meta_query' => array(                'relation' => 'OR',                   array(                      'key' => 'report_home-select',                      'value' => $team_id,                      'compare' => '=',                   ),                   array(                      'key' => 'report_away-select',                      'value' => $team_id,                      'compare' => '='                   )            )                                            );              $reports = new WP_Query($args);      Basically I want to create a meta query that has a relation of OR and AND. So in English I want the all the match reports with the `report_type` 'cup' that have either the `report_home-select` key with the value of a specific team_id OR the `report_away-select` key with the same value. I hope that makes sense. In essence I want a double relation.


title: how to override menu widget?

text:
I would like to customize the menu widget in sense to add some classes which would make it responsive. How do I override the default widget for menus? I use a custom template which supports bootstrap 3. I set a menu as widget and I make the presence in my sidebar. the mark-up should look like
                 <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">                                                                                </button>

Sidebar22

Link

Link

Link

Link

                Can I override the menu widget generation in my functions.php?!


title: Plugin options with googlemap iframe

text:
I have put google map in text option of plugin.The text input value is
View Larger Map      while displaying the field value server response with page not found error.To display I have used               $options = get_option('googlemap_options');     echo html_entity_decode($options['map_url']);      what is the correct way to display google map?


title: How to rewrite rules for WP-security in Nginx?

text: I have a WordPress website on a VPS running nginx. I have installed the WP Security plugin to improve the security of my site. After changing all the settings to my liking, a pop-up notifies me that I need rewrite the rules to save my changes. Part of it said "See the Better WP Security Dashboard for a list of the rewrite rules you will need." The list of rewrite rules can be found here:               # BEGIN Better WP Security         # Begin HackRepair.com Blacklist             if ($http_user_agent ~* "^BlackWidow"){ return 403; }             if ($http_user_agent ~ "^Bolt"){ return 403; }             if ($http_user_agent ~* "CazoodleBot"){ return 403; }             if ($http_user_agent ~* "^ChinaClaw"){ return 403; }             if ($http_user_agent ~* "^Custo"){ return 403; }             if ($http_user_agent ~ "^Default"){ return 403; }             if ($http_user_agent ~* "^DIIbot"){ return 403; }             if ($http_user_agent ~* "^DISCo"){ return 403; }             if ($http_user_agent ~* "discobot"){ return 403; }             if ($http_user_agent ~* "^eCatch"){ return 403; }             if ($http_user_agent ~* "ecxi"){ return 403; }             if ($http_user_agent ~* "^EirGrabber"){ return 403; }             if ($http_user_agent ~* "^EmailCollector"){ return 403; }             if ($http_user_agent ~* "^EmailSiphon"){ return 403; }             if ($http_user_agent ~* "^EmailWolf"){ return 403; }             if ($http_user_agent ~* "^ExtractorPro"){ return 403; }             if ($http_user_agent ~* "^EyeNetIE"){ return 403; }             if ($http_user_agent ~* "^FlashGet"){ return 403; }             if ($http_user_agent ~* "^GetRight"){ return 403; }             if ($http_user_agent ~* "^GetWeb!"){ return 403; }             if ($http_user_agent ~* "^Go!Zilla"){ return 403; }             if ($http_user_agent ~* "^Go-Ahead-Got-It"){ return 403; }             if ($http_user_agent ~* "^GrabNet"){ return 403; }             if ($http_user_agent ~* "^Grafula"){ return 403; }             if ($http_user_agent ~* "GT::WWW"){ return 403; }             if ($http_user_agent ~* "heritrix"){ return 403; }             if ($http_user_agent ~* "^HMView"){ return 403; }             if ($http_user_agent ~* "HTTP::Lite"){ return 403; }             if ($http_user_agent ~* "HTTrack"){ return 403; }             if ($http_user_agent ~* "ia_archiver"){ return 403; }             if ($http_user_agent ~* "IDBot"){ return 403; }             if ($http_user_agent ~* "id-search"){ return 403; }             if ($http_user_agent ~* "id-search.org"){ return 403; }             if ($http_user_agent ~* "^InterGET"){ return 403; }             if ($http_user_agent ~* "^InternetSeer.com"){ return 403; }             if ($http_user_agent ~* "IRLbot"){ return 403; }             if ($http_user_agent ~* "^Java"){ return 403; }             if ($http_user_agent ~* "^JetCar"){ return 403; }             if ($http_user_agent ~* "^larbin"){ return 403; }             if ($http_user_agent ~* "^LeechFTP"){ return 403; }             if ($http_user_agent ~* "libwww"){ return 403; }             if ($http_user_agent ~* "libwww-perl"){ return 403; }             if ($http_user_agent ~* "^Link"){ return 403; }             if ($http_user_agent ~* "LinksManager.com_bot"){ return 403; }             if ($http_user_agent ~* "linkwalker"){ return 403; }             if ($http_user_agent ~* "lwp-trivial"){ return 403; }             if ($http_user_agent ~* "^Maxthon$"){ return 403; }             if ($http_user_agent ~* "MFC_Tear_Sample"){ return 403; }             if ($http_user_agent ~* "^microsoft.url"){ return 403; }             if ($http_user_agent ~ "Microsoft"){ return 403; }             if ($http_user_agent ~* "^Mozilla.*Indy"){ return 403; }             if ($http_user_agent ~* "^Mozilla.*NEWT"){ return 403; }             if ($http_user_agent ~* "^MSFrontPage"){ return 403; }             if ($http_user_agent ~* "^Navroad"){ return 403; }             if ($http_user_agent ~* "^NearSite"){ return 403; }             if ($http_user_agent ~* "^NetAnts"){ return 403; }             if ($http_user_agent ~* "^NetSpider"){ return 403; }             if ($http_user_agent ~* "^NetZIP"){ return 403; }             if ($http_user_agent ~* "^Nutch"){ return 403; }             if ($http_user_agent ~* "^Octopus"){ return 403; }             if ($http_user_agent ~* "^PageGrabber"){ return 403; }             if ($http_user_agent ~* "panscient.com"){ return 403; }             if ($http_user_agent ~* "^pavuk"){ return 403; }             if ($http_user_agent ~* "PECL::HTTP"){ return 403; }             if ($http_user_agent ~* "^PeoplePal"){ return 403; }             if ($http_user_agent ~* "^pcBrowser"){ return 403; }             if ($http_user_agent ~* "PHPCrawl"){ return 403; }             if ($http_user_agent ~* "PleaseCrawl"){ return 403; }             if ($http_user_agent ~* "^psbot"){ return 403; }             if ($http_user_agent ~* "^RealDownload"){ return 403; }             if ($http_user_agent ~* "^ReGet"){ return 403; }             if ($http_user_agent ~ "^Rippers"){ return 403; }             if ($http_user_agent ~* "SBIder"){ return 403; }             if ($http_user_agent ~* "^SeaMonkey$"){ return 403; }             if ($http_user_agent ~* "^sitecheck.internetseer.com"){ return 403; }             if ($http_user_agent ~* "^SiteSnagger"){ return 403; }             if ($http_user_agent ~* "^SmartDownload"){ return 403; }             if ($http_user_agent ~* "Snoopy"){ return 403; }             if ($http_user_agent ~* "Steeler"){ return 403; }             if ($http_user_agent ~* "^SuperBot"){ return 403; }             if ($http_user_agent ~* "^SuperHTTP"){ return 403; }             if ($http_user_agent ~* "^Surfbot"){ return 403; }             if ($http_user_agent ~* "^tAkeOut"){ return 403; }             if ($http_user_agent ~ "^Teleport"){ return 403; }             if ($http_user_agent ~ "^Toata"){ return 403; }             if ($http_user_agent ~* "URI::Fetch"){ return 403; }             if ($http_user_agent ~* "urllib"){ return 403; }             if ($http_user_agent ~* "User-Agent"){ return 403; }             if ($http_user_agent ~* "^VoidEYE"){ return 403; }             if ($http_user_agent ~* "webalta"){ return 403; }             if ($http_user_agent ~* "^WebAuto"){ return 403; }             if ($http_user_agent ~* "^[Ww]eb[Bb]andit"){ return 403; }             if ($http_user_agent ~* "WebCollage"){ return 403; }             if ($http_user_agent ~* "^WebCopier"){ return 403; }             if ($http_user_agent ~* "^WebFetch"){ return 403; }             if ($http_user_agent ~* "^WebLeacher"){ return 403; }             if ($http_user_agent ~* "^WebReaper"){ return 403; }             if ($http_user_agent ~* "^WebSauger"){ return 403; }             if ($http_user_agent ~* "^WebStripper"){ return 403; }             if ($http_user_agent ~* "^WebWhacker"){ return 403; }             if ($http_user_agent ~* "^WebZIP"){ return 403; }             if ($http_user_agent ~* "^Wget"){ return 403; }             if ($http_user_agent ~* "^Widow"){ return 403; }             if ($http_user_agent ~* "^WWW-Mechanize"){ return 403; }             if ($http_user_agent ~* "^WWWOFFLE"){ return 403; }             if ($http_user_agent ~* "zermelo"){ return 403; }             if ($http_user_agent ~* "^Zeus"){ return 403; }             if ($http_user_agent ~* "^Zeus.*Webster"){ return 403; }             if ($http_user_agent ~* "ZyBorg"){ return 403; }         # End HackRepair.com Blacklist              location ~ /\.ht { deny all; }         location ~ wp-config.php { deny all; }         location ~ readme.html { deny all; }         location ~ readme.txt { deny all; }         location ~ /install.php { deny all; }         set $susquery 0;         set $rule_2 0;         set $rule_3 0;         rewrite ^wp-includes/(.*).php /not_found last;         rewrite ^/wp-admin/includes(.*)$ /not_found last;         if ($request_method ~* "^(TRACE|DELETE|TRACK)"){ return 403; }         if ($args ~* "\.\./") { set $susquery 1; }         if ($args ~* ".(bash|git|hg|log|svn|swp|cvs)") { set $susquery 1; }         if ($args ~* "etc/passwd") { set $susquery 1; }         if ($args ~* "boot.ini") { set $susquery 1; }         if ($args ~* "ftp:") { set $susquery 1; }         if ($args ~* "http:") { set $susquery 1; }         if ($args ~* "https:") { set $susquery 1; }         if ($args ~* "(<|%3C).*script.*(>|%3E)") { set $susquery 1; }         if ($args ~* "mosConfig_[a-zA-Z_]{1,21}(=|%3D)") { set $susquery 1; }         if ($args ~* "base64_encode") { set $susquery 1; }         if ($args ~* "(%24&x)") { set $susquery 1; }         if ($args ~* "(\[|\]|\(|\)|<|>|ê|\"|;|\?|\*|=$)"){ set $susquery 1; }         if ($args ~* "("|'|<|>|\|{|||%24&x)"){ set $susquery 1; }         if ($args ~* "(127.0)") { set $susquery 1; }         if ($args ~* "(%0|%A|%B|%C|%D|%E|%F)") { set $susquery 1; }         if ($args ~* "(globals|encode|localhost|loopback)") { set $susquery 1; }         if ($args ~* "(request|select|insert|concat|union|declare)") { set $susquery 1; }         if ($http_cookie !~* "wordpress_logged_in_" ) {             set $susquery 2$susquery;             set $rule_2 1;             set $rule_3 1;         }         if ($args !~ "^loggedout=true") { set $susquery 3$susquery; }         if ($susquery = 4321) { return 403; }         rewrite ^/login/?$ /wp-login.php?nw61e1jrijsnetr1xokgx redirect;         if ($rule_2 = 1) { rewrite ^/totalaccess/?$ /wp-login.php?nw61e1jrijsnetr1xokgx&redirect_to=/wp-admin/ redirect; }         if ($rule_2 = 0) { rewrite ^/totalaccess/?$ /wp-admin/?nw61e1jrijsnetr1xokgx redirect; }         rewrite ^/register/?$ /wp-login.php?nw61e1jrijsnetr1xokgx&action=register redirect;         if ($uri !~ "^(.*)admin-ajax.php") { set $rule_3 2$rule_3; }         if ($http_referer !~* wp-admin ) { set $rule_3 3$rule_3; }         if ($http_referer !~* wp-login.php ) { set $rule_3 4$rule_3; }         if ($http_referer !~* login ) { set $rule_3 5$rule_3; }         if ($http_referer !~* totalaccess ) { set $rule_3 6$rule_3; }         if ($http_referer !~* register ) { set $rule_3 7$rule_3; }         if ($args !~ "^action=logout") { set $rule_3 8$rule_3; }         if ($args !~ "^nw61e1jrijsnetr1xokgx") { set $rule_3 9$rule_3; }         if ($args !~ "^action=rp") { set $rule_3 0$rule_3; }         if ($args !~ "^action=register") { set $rule_3 a$rule_3; }         if ($args !~ "^action=postpass") { set $rule_3 b$rule_3; }         if ($rule_3 = ba0987654321) {             rewrite ^(.*/)?wp-login.php /not_found redirect;             rewrite ^/wp-admin(.*)$ /not_found redirect;         }     # END Better WP Security      I'm not actually sure whether the changes from the plugin have really taken effect since I have modified any file myself with these rules. I asked and did some Googling, but I could not find an answer. So I'm just wondering how I can "rewrite" this rules to make sure the security is properly in place.


title: Pre populate gravity form with admin only drop down of WP users

text: I am building a directory with GF + Directory addon (lovely) However, one glitch: I am creating the user accounts and the form entires to begin with - so a user that logs into their account later to edit their entry will not see their entry (when using the directory addon shortcode) because their user account did not create the entry. I need the user account I create to be associated with an entry I create - I dont want to have to login as each user to create the entries. I want to create them as Admin and assin them to a user account. The best way I can think to do this is to have an Admin only field in the form that allows me to select a WP user to be the creator/owner of the entry. I imagine using a dropdown pre-populated with the WP users. How to do this ? Will it actually work ? Is there a better way to achieve what I am trying to do ? thanks a lot Joe


title: Wordpress custom archive page

text:
I am trying to build up a custom archive page. However, I would like this archive page to skip the first 5 posts. I've been able to accomplish this with the offset property. However, the pagination seems to break. Here's my code before the while:                <?php      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      $wp_query = new WP_Query();      $wp_query->query('posts_per_page='.get_option('posts_per_page').'&paged=' . $paged);      ?>      And this is the code I'm using for the pagination:               <?php wp_reset_postdata(); ?>
<?php next_posts_link(__('« Entradas anteriores', '')) ?>

<?php previous_posts_link(__('Entradas recientes »', '')) ?>
      Any help is deeply appreciated. Johann


title: Cannot stop wpautop from messing up my plug-in output

text: I have a plug-in that embeds some javascript. I've tried using remove_filter() to stop wpautop in every way recommend and still can't get wordpress to stop wrapping my `<script></script>` tags with with `<p>` tags like this `<p><script></script></p>` I tried adding the following to both the short code php and also in the functions.php               remove_filter( 'the_content', 'wpautop' );     remove_filter( 'the_excerpt',     'wpautop' );


title: Buddypress: Edit activity when new blog post

text: I am trying to edit the activity on Buddypress (1.7 and running latest Wordpress) for when a new blog post is created. By default it displays the excerpt and shows any attached images, it also strips any code (I think). What I'm trying to achieve is to show the full blog post, including things like galleries. Doing some searches through the internet and the docs led me to: `bp_activity_content_body() and bp_create_excerpt` Help from the online community has led me to: `bp_activity_truncate_entry in bp-activity-filters.php` But I can't seem to figure out how to work the filters (apply / add). I tried the following (for bp_activity_truncate_entry), but no succes so far:               apply_filters ('bp_activity_excerpt_length', 500);       And the following for bp_create_excerpt:               remove_filter( 'bp_create_excerpt', $length, $options );      function pnb_excerpt(){     $lenght = 500;       $options = array(       'ending' => __( ' […]', 'buddypress' ),      'exact'             => false,       'html'              => false,       'filter_shortcodes' => $filter_shortcodes_default); }      add_filter( 'bp_create_excerpt', 'pnb_excerpt', $length, $options );      (Also tried apply instead of add) Neither of them seem to work. But again I am not sure how to work these filters. Can anybody point me in the right direction?


title: Shared Content but "Updatable" Through the Main Site

text: I have been doing quite a lot of research the past week, and have not been able to find a solid answer that fixes my problem. So, I decided to come here to ask to see if anyone knows of how to help with my problem. I'm going to working on a project using WordPress Multisite that will allow users to register for a site and be able to re-brand the content that we will be giving them as their own (ie: the company I will be working with has a slew of realtor information that they want to give away - for a fee - to other realtors and allow them to brand it with their logo and contact info). So, it would be easy to create a template site with all the content already pre-loaded. When MS creates a new site, it grabs the template and creates the new site using the template. However, I need to be able to modify this content across all sites. We will have approximately 50 pages that need to be "shared" throughout all these sites, and if I need to make a change, I need to change across the board. I have tried using this               <?php switch_to_blog(1); ?>     Some code that displays the menu of the Main Blog     <?php restore_current_blog(); ?>      But that will link everything to the main site (which defeats the purpose of paying to have the content branded as your own). I have found plugins that allow you to broadcast posts to all your sites, but this is content that will be preloaded. With all of that said, I am hoping someone around here has done this before and is willing to share some expertise on the matter. Thanks for taking a look at this! * * * ## **EDIT #1** I've done my research through the WordPress support forums as well as here at StackExchange. Is there a way to share content amongst wordpress sites :: This option doesn't really work for me - I have to be able to charge for users to set up their new sites as well as give them the option to add their domain name to their site, which is why Multisite is the way I believe I need to go. Re-Blogging - WP MS Support Forum :: This is what I have found the most of - ways to re-blog content across all platforms. If I needed to shoot out posts to everyone, that would be great. However, this is not what I would like to accomplish. Exactly what I am looking for :: But sadly there isn't an answer. I did a search through WordPress Answers of variations of "multisite content share" and found nothing (other than #3) that pertained to my topic (or what I am looking for in general) * * * ## **EDIT #2** So, after doing some more research yesterday, I found ThreeWP Broadcast. It happens to do quite a lot of what is actually needed, but hid itself during my first few days of research. It allows you to broadcast pages throughout all subsites as well as send out updates to those pages as well. Awesome! So, a new question arises. My client doesn't want the end users editing their content (copyright and legal reasons). So, I wrote some code that automatically appends some JS to the top of the Edit Page in the backend:               function hidePublishingNow() {     global $blog_id, $wpdb;     $prefix = "ssr_";               if(is_super_admin()) {}     else {                        $page = $_GET['post'];         $pageFound = false;                   if($page > 0 && isset($blog_id)) {             $sql = "SELECT * FROM ssr__3wp_broadcast_broadcastdata WHERE blog_id = $blog_id";             $results = $wpdb->get_results($sql, "ARRAY_A");                  foreach($results as $r) {                 if($r['post_id'] == $page) { $pageFound = true; }                 else {}             }                  if($pageFound == true) {                 wp_enqueue_script(                     'hide-publishing',                     get_template_directory_uri() . '/js/removePublishing.js',                     array('jquery')                 );             }         } else {}     }      } add_action('admin_head', 'hidePublishingNow'); Basically, when the **post.php** is loaded within the admin panel, it checks to see if the current page being edited is a page that has been connected via Broadcasting. If it has been connected, the JS is loaded and removes all elements to that page and replaces it with a warning. The end user will never see the content in the editor or be able to Update the page. That is working well. If this is what I have to go off of, that's great - it's the best solution I have found yet. What I would **love** to do would be to take control of the main **wp-admin/edit.php?post_type=page** page (this is where the admin panel lists out all the pages available for editing). It would be great to intercept a WP action when it is making that list and strip out specific pages while it is creating that list. Still doing research on it to see if that is even possible. I just wanted to update my progress on here in case anyone has a word of advice, or down the road if someone else is running into this same issue. * * *


title: How to add Custom Fields to Settings in Widget Options for all Registered Widgets?

text: I want to add input box in the custom form when we click for Widget Settings. Really like to have this additional text box in all widgets be Custom Made or the default ones. I'll be needing help in adding new configurable inputbox in Wordpress widget for all widget registered with Theme. Your inputs/suggestions awaited, Thanks.


title: Applying filters to the_content() to separate content if any `add_shortcode()` is found?

text: I don't even know if this possible, with `array_map` or `str_replace`, but the idea is the follow: This function gets the content and before is sent out, `clean_custom_content`, there is where i cant figure out how to procede.. so lets assume that we have all the content, this content it will be wrapped in a `section` but each time there is a short code`[]` this needs to be close and when the content of the short code has been outputted. them open a new `section` and continue with the content from that page. make sense? any ideas or help it will be great .. thanks               function get_custom_content( $more_link_text = null, $strip_teaser = false) {         $content = get_the_content( $more_link_text, $strip_teaser );         $content = apply_filters( 'the_content', $content );         $content = str_replace( ']]>', ']]>', $content );         $final_cotent = clean_custom_content($content);         echo $final_cotent;     }      **clean_custom_content()::**               function clean_custom_content($content){         if(do_clean_shorcode('someshorty')){              $content = "<section>".$content.'</section>';          return $content;         }         return null;     }


title: How to make a WP_Query search with custom post types?

text: I've registered a custom post type called "node". When I create a basic WP_Query to get posts of that type, it works just fine. Example:               $args = array(       'post_status' => 'publish',     'post_type' => 'node');          $query = new WP_Query($args);             This will get all published posts of type "node". However, as soon as I combine this with a search, nothing is returned. Example:               $args = array(       'post_status' => 'publish',     'post_type' => 'node',     's' => 'My search term');          $query = new WP_Query($args);      This will get nothing, although it should get several posts of type 'node' that contain 'My search term'. As far as I can see, the post types are automatically set to "post" and "page" as soon as I include the "s" parameter in $args. If I print out a var_dump of $query, it shows the following: Without "s":               object(WP_Query)       public 'query' =>          array (size=2)           'post_status' => string 'publish' (length=7)           'post_type' => string 'node' (length=4)       public 'query_vars' =>          array (size=63)           'post_status' => string 'publish' (length=7)           'post_type' => string 'node' (length=4)     ...      With "s":               object(WP_Query)       public 'query' =>          array (size=2)           'post_status' => string 'publish' (length=7)           's' => string 'My search term' (length=14)           'post_type' => string 'node' (length=4)       public 'query_vars' =>          array (size=66)           'post_status' => string 'publish' (length=7)           's' => string 'My search term' (length=14)           'post_type' =>              array (size=2)               0 => string 'post' (length=4)               1 => string 'page' (length=4)     ...      So Wordpress seems to override the post types as soon as a search is involved. How can I fix that?


title: Thumbnail with different sizes

text: I want make all my blog thumbs the size of 227x133. I need images width have 100% (for responsive design). Some images have width greater than the other and vice versa. I'm using this code to show the thumbs of my blog:               / / Post thumbnails sizes     add_theme_support ('post-thumbnails');     add_image_size ('blog-page', 9999, 545, true);      The problem is that the images are not the same size as each other: How is: http://img834.imageshack.us/img834/1856/77751386.png How I want: http://img17.imageshack.us/img17/5461/68767097.png What's wrong?


title: Importing csv file

text: I'm using the CSV Importer plugin developed by dvkob. It works fine, may be because I upload only few posts each time (about 50). What I need to know now, is how to add the meta data meta_value and meta_key. They should be inserted in the postmeta table. I'm a newbie in coding. When importing directly via php-myadmin, I get a syntax error message. I suppose it depends on wrong sequence of fields. Anyway, before wasting time shuffling fields and columns, can anybody help me? Which tool do I need? How do I format the csv file correctly? Thanks, Patrick


title: If search matches taxonomy

text: Is it possible to redirect the user to the taxonomy page IF the search input matches the taxonomy name exactly? For instance i have a taxonomy called "Actors". If someone put into the search field "Tom Hanks" instead of going to the regular search page, it would redirect them to the taxonomy page for Tom hanks.


title: Multi-site, different dashboard

text: I'm looking into using Wordpress Multi-site to have a three separate wordpress sites on one installation of Wordpress. I have the Mulit-site set up and I can add sites but I have one admin log in to the multi site Dashboard showing all the sites. Is it possible to have separate logins that login into the separate sites. So if I have a cars website it would have it's own dashboard that the cars- admin could log into but wouldn't be able to see the multi-site dashboard.


title: Migrating Wordpress users into Disqus

text: I'm thinking of migrating my comment system from Wordpress to Disqus. I'm pretty satisfied with options it offers, but I have one problem: I have few hundred registrated users on my Wordpress instalation, those accounts were used for commenting. Can I import my Wordpress users so they don't have to go through registration once again? But still retain Disqus login options for those who have account there? edit: So, basically, can user just log into his WP account and post on Disqus comment system?


title: Can you make a custom metabox field be required to save a new post?

text: I am working on a custom post type, I have removed all the standard wordpress form items and started from scratch with custom meta boxes, except the title field. In my situation, it is really important that some of the custom meta dropdown selections be selected. Is there an easy solution to make it where they must select some items before they can post the item? I assume javascript would be the easiaest solution but it would be nice to let the user know what is going on, like highlight the box if they try to post and it isn't selected yet, another issue is with a drop down menu, there is by default a value selected already even if they did not pick one


title: How can i put "posted x minutes ago on my posts?

text: wordpress by default writes the the date on posts, but how can I transform it to : "x" time ago ?? like 3 days ago, or 5 minutes ago ??


title: How to use wp_enqueue_style() and wp_enqueue_script() only when needed?

text: My plugin uses wp_enqueue_style() and wp_enqueue_script() to load resources, but I have kept in mind not to degrade the performance for the user and only load these when the current set of posts contain the shortcode for my plugin. I do this by using:               add_filter('the_posts', 'CrayonWP::the_posts');      the_posts is called before wp_head, but it is also called a few times afterwards (probably for recent posts in the widgets etc). The problem here is that when I am searching the post contents for my shortcode and signalling the enqueuing process, there are times when:   * the_post is called before wp_head (what I want)   * but that set of posts does not have my shortcode and I don't enqueue.   * later on, another call to the_posts tries to enqueue but it's too late. Is there a definite way to check what will appear on a page before wp_head is called so that I can be confident that I will enqueue only when needed but not miss the opportunity? **EDIT:** Great article: http://beerpla.net/2010/01/13/wordpress-plugin-development-how- to-include-css-and-javascript-conditionally-and-only-when-needed-by-the-posts/ But it doesn't take into account multiple calls to the_posts in a single page request :( **EDIT 2:** What I've tried is to use:               add_action('wp', 'CrayonWP::queue');      Since the `wp` action is only used once right after the request is finalised. And inside this function:               global $wp_query;     $posts = $wp_query->posts;      I'm not sure how the $wp_query variable changes over the loop however. If the_posts filter is being called again and again, would it imply the original query may be changing as the widgets send across their own requests? Obviously I don't really want to check for shortcodes in the posts of "recent posts", since they may not be displaying on the page at the moment. So will using the `wp` action hook instead of `the_posts` filter contain the posts requested for that given page, whether it were a single or the home page?


title: Using 'jQuery menu aim' for WordPress (Genesis) drop down menu

text: For this site I want to build a better drop down menu – under 'Data' on the top left – to access the site's content. The website is built using the Genesis theme. I would like to use Ben Kamens 'jQuery menu aim' for that. It is explained nicely in an article by him. And it is all stored on his Github account. On jqueryscript net you find an example of how the menu looks like. And Mike Voermans showed how to use it in the online IDE codepen here: http://codepen.io/mikevoermans/pen/EtKxp Can someone point me in the right direction and show me how to use Ben Kamens (or Mike Voermans) code to use that for my website?


title: Error in php code

text:
I was following the Book building wordpress theme from scratch. An options page is created through this method in the wordpress admin panel . There is an error present due to which nothing appears inside it. Firstly this is added to the **functions.php** of WordPress:               <?php require_once('theme-options.php'); ?>      Secondly **theme-options.php** is created which contains this:               <?php      // create custom plugin settings menu      add_action('admin_menu', 'director_create_menu');      function director_create_menu() {           //create new submenu      add_submenu_page( 'themes.php', 'Director Theme Options',       'Director Options', 'administrator', __FILE__,       'wptuts_landing_settings_page');           //call register settings function      add_action( 'admin_init', 'director_register_settings' );      }       function director_register_settings() {       //register our settings       register_setting( 'director-settings-group', 'director_facebook' );       register_setting( 'director-settings-group', 'director_twitter' );       register_setting( 'director-settings-group', 'director_rss' );       register_setting( 'director-settings-group', 'director_logo' );       register_setting( 'director-settings-group', 'director_analytics' );       }       function director_settings_page() {       ?>

Director Theme Settings
            <form id="landingOptions" method="post" action="options.php">       <?php settings_fields( 'director-settings-group' ); ?>

       Logo:	                  <input type="text" name="director_logo" value="<?php print get_option('director_logo'); ?>"      />

       Facebook Link:	                <input type="text" name="director_facebook"        value="<?php print get_option('director_facebook');        ?>" />

        Twitter Link:	                    <input type="text" name="director_twitter" value="<?php print get_option('director_twitter'); ?>" />

         Display RSS Icon:	                    <input type="checkbox" name="director_rss" <?php        if(get_option('director_rss') == true){ print         "checked"; } ?> />

         Google Analytics Code:	                    <textarea name="director_analytics"><?php print        get_option('director_analytics'); ?></textarea>

        <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
           </form>
      The director options page is created however there is nothing inside it. The page should show up like this:![enter image description here](http://i.stack.imgur.com/r56XW.png) However the page is like this : ![enter image description here](http://i.stack.imgur.com/Dxh9u.png) Could you please tell me the problem and a fix to it?


title: Assign parent category to all posts that are already assigned to child category

text: All my website's posts are assigned to subcategories, but not to their parent categories too: ![enter image description here](http://i.stack.imgur.com/DbcCB.jpg) Is there someway that I could massively assign posts to their parent categories too? ![enter image description here](http://i.stack.imgur.com/DRDdk.jpg) My website has more than 3k posts, so I need to find a quick way to do this. I didn't find any plugin that could help me. Any suggestions please?


title: TinyMCE buttons not appearing in Widget

text: I have a widget which uses Black Studio TinyMCE. When I click Visual I don't get any menu items. Looking at the Firebug console I have a jQuery error:               tinyMCE.get(...) is null      However, replacing the theme and disabling all plugins does not fix the problem. Any suggestions?


title: Get custom field from other post in carousel

text: Im using a plugin called wp carousel to display custom post types in a carousel in the footer in the singular view of posts. By default the plugin gets the featured image and the title of the post, but i want to add a custom field (plain text) I've added to the custom post type through ACF. I've tried adding this to `plugins/wp-carousel/themes/default/theme- jcarousel.php`               <?php global $post;     $sidans_id = $post->post_id;     $hamta_kund = get_field('kund');     echo $hamta_kund;     ?>      on line 192 (right after the code that gets the `title`. What this does is get the currently viewed posts' custom field, I want to get the custom field that is associated with each post in the carousel. So every item in the carousel gets the same value (the value from the one im currently viewing). Do anyone know what im doing wrong? This is some documentation from the plugin-author. http://sumolari.com/proyecto/wp-carousel/wp-carousel-documentacion-docs/ I've tried the support forum but no answer and im running out of time with the client.


title: Add CPT values to Database

text: I am not sure if this is something easy. I have a plugin with all the functionality needed for a custom post type: Filters, navegation... I need to create a lot of posts (with taxonomies) of this CPT (a lot of work is needed to create it properly). So I would like to add this custom posts only once and not each time I want to take advantage of my plugin in other websites... What is the best way to achieve this? Am I supposed to make some sort of exportation-importation each time? Should I take advantage of wp_insert_post and hardcode the content of the posts? Apologies for my english, I do not know if I have explained myself... Thanks¡¡


title: my index does not show the slider in start

text:
My slider is not show in the start, but when we go to other pages and return it starts working? and other pages are normal. Also in all browser my nav menue works but in mobiles browsers is not inline. and is asking for attribute "alt" in valdity.                                  <div class="dwuserEasyRotator" style="width: 968px; height: 250px; position:relative; text-align: left;" data-erconfig="{autoplayEnabled:true, lpp:'102-105-108-101-58-47-47-47-67-58-47-85-115-101-114-115-47-72-37-50-54-77-47-68-111-99-117-109-101-110-116-115-47-69-97-115-121-82-111-116-97-116-111-114-80-114-101-118-105-101-119-47-112-114-101-118-105-101-119-95-115-119-102-115-47', wv:1, autoplayDelay:3000, autoplayStopOnInteraction:false, autoplayPauseOnHover:false}" data-ername="NMO" data-ertid="{yjk5r3ym537786896430731}">

 This jQuery slider was created with the free EasyRotator software from DWUser.com.

              Use WordPress? The free EasyRotator for WordPress plugin lets you create beautiful WordPress sliders in seconds.

              OK
                          Rotator powered by EasyRotator, a free and easy jQuery slider builder from DWUser.com.  Please enable JavaScript to view.

              Thanks, Ray