title: Event Management plugin

text: I am working on a site that has the option of using Event Expresso Event Manager Pro The events part of the site is quite complicated, and needs to have \- a calendar \- a registration page \- 'buy tickets' functionality with both Paypal and http://www.authorize.net/ \- email confirmations I haven't worked a lot with event plugins, can anyone recommend one of the above plugins over the other? It sounds like there might be quite a lot of customization required, so I guess part of this question is, "Which is the easiest to customize?"


title: Check if has pages?

text: So hard to find this info... I'd like to know a way to find out if there are pages. Something like:               if (has_pages()) { /* do something */ }      I can't find a reference to any similar function... how might one go about finding out if there are pages. In case yr wondering I'd like to only show a pages menu if there are pages.


title: Action inside another action not working

text:
I am trying to load content before the end body tag on admin pages that have a TinyMCE editor on them. To do this I am trying to leverage two action hooks 'before_wp_tiny_mce' and 'admin_footer' but it does not seem to be working as I expected. The following is a simplified version of my code:               add_action( 'before_wp_tiny_mce', 'before_wp_tiny_mce_action' );          function before_wp_tiny_mce_action() {         add_action( 'admin_footer', 'admin_footer_action' );     }          function admin_footer_action() {         echo "
I am in the footer of an admin page with a TinyMCE editor.
";     }      Why doesn't this work?


title: WooCommerce, different prices based on location

text: A client of mine is setting up an e-commerce store but instead of having straight currency conversions for their products ($99.99 = £65.70 for example) they want to be able to set specific prices based on the location of their customer ($99.99 for US customers, £99.99 for UK customers, etc.) Now personally I wouldn't do it this way given the choice but they're keen on doing it, so is it possible with the WooCommerce plugin?


title: Are custom post types lost when the theme is changed?

text: I am about to begin work on a custom WordPress theme and I want to know how careful I have to be about custom posts. Suppose I create a WordPress theme that registers several custom post types. To my understanding this happens upon activation of the theme. If I were to create several posts of this custom type and then change to a theme that does not have that custom post type would I have lost the posts completely? What if I changed to another theme that DID have the same custom post type (if that is possible) would they still exist? Further, what about these same issues in connection with custom taxonomy? If I change to a different theme that does not support the custom taxonomy will the taxonomy data from custom posts be lost (if they are even saved). Will the data for the custom taxonomy still exist?


title: Page Template Changes Not Showing

text: I'm dealing with a weird and very annoying bug where changes to a page template file ("contact.php") are not being registered at all by WordPress. I've made sure that the template has been correctly selected by the pages that are supposed to use it. The pages also clearly use the layout specified by the template, but they don't register any changes, even when I add huge globs of texts in the middle. Nothing shows up. This problem applies to every new page I create, as well as old pages I modify. I don't have any caching plugins installed, so I am at a loss as to why this is the case. Changes to other parts of the website (for example, header.php) show up just fine. Switching to another theme then switching back doesn't help either. This is immensely frustrating, and I'd be grateful for any help.


title: Wordpress category check

text: So I have a plugin, and i want to have a multiselect drop-down list with all categories in widget's settings and store (by admin's choice) selected ones (ids). ![enter image description here](http://i.stack.imgur.com/8OY9s.jpg) Then to check if we are viewing a post "is_single()" and the post has some of the above selected categories "in_category("3") (say we chose cat:Logo with id:3):               if(is_single() && in_category("3")){//do my thing}      and ofcourse if user chose more than 1, say (3,5,6 cat ids(by their names click)) the codition would be something like:               if(is_single() && in_category($categoryholderfromdb)){//do my thing}      Where $categoryholderfromdb="3,5,6" (stored user choices in db (widget settings drop-down)) i've tried to do it, but i can't figure out the part with drop-down multiselect and then "in_category" when checking for multy values. Can anyone give me example of the above question?Thanks!


title: How can I remove the welcome message generated by the New User Approve plugin?

text: I'm using the New User Approve plugin. After installing the plugin the top of the registration page says: > Welcome to XXX site. This site is accessible to approved users only. To be > approved, you must first register. How can I erase this message? I'm am using this code:               $message = apply_filters('login_message', '');      But the top says still stand there!


title: Best way to receive special images in posts

text: Okay, this is what I'm thinking about (and it's not a coding problem right now, but my fundamental thoughts): How to receive / input images in posts for special uses, let's say a customized portfolio post. The post content should not really contain the Work images. These images should be styled specifically in an own image area, separated from the common text content. What I used to do for quite a long time: I created a custom post meta box under the content with an upload button. Users could upload an image and the URL got inserted automatically there after pressing "Insert into post". Problem was, that the image should have the exact needed width. Now I changed this method and started to tell the User they would only have to upload the image, just like always, but don't insert it into post content. This made possible for me just to output the post gallery, and as I created an image size with the needed width, the size of the image wouldn't matter. Now, most Users don't understand the new way and I also got the feeling that it is not as flexible as before (for example I could also add videos and rearrange videos and images in their order which doesn't work with my new method). I could use a thumbnail generation script or do it even myself, but this is not really a nice solution for me, too (performance, another caching, risk in use of scripts for example timthumb exploits...). I'm curious, do You have a solution or any thoughts for this? Greatly appreciated, and please excuse my bad English ;) Best regards, .wired


title: Parse Error when trying to access Products -> Categories

text:
Whenever I try to access the Categories or Tags tab under Products on the WP dashboard, I get this error message:               Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in /home4/benkang/public_html/gibumkang.com/revive/wp-admin/includes/class-wp-terms-list-table.php on line 156      So I checked into my `class-wp-terms-list-table.php`, but I can't seem to find what's wrong with it. I never touched it either. Here is a snippet of the code. Line 156 starts from:'$out .= $this->row_actions( $actions );'.               if ( empty( $terms ) ) {             list( $columns, $hidden ) = $this->get_column_info();                 echo '
get_column_count() . '">';                 $this->no_items(ions', $actions, $tag );             $actions = apply_filters( "{$taxonomy}_row_actions", $actions, $tag );             $out .= $this->row_actions( $actions );             $out .= '
term_id . '">';             $out .= '
' . $qe_data->name . '
';             $out .= '
' . apply_filters( 'editable_slug', $qe_data->slug ) . '
';             $out .= '
' . $qe_data->parent . '

';     }      Please any help or insight will be greatly appreciated.


title: Ordering custom post type by multiple custom fields

text: I was wondering if you'd be able to help with an issue i'm having? I have implemented a fix that you came up with in this post: How to order custom post type by multiple custom fields? however when I add the filter no posts are being displayed. What I'm trying to achieve is to order a league table by points and then by goal difference. This is my function in functions.php               function orderbyreplace($orderby ) {     global $wpdb;     return str_replace($wpdb->prefix.'postmeta.meta_value', 'mt1.meta_value, mt2.meta_value ASC', $orderby);     }      And here's the query in my template file               $args = array(                   'post_type'=>'standings',                   'orderby' => 'meta_value_num',                   'meta_key' => '_pts',                   'meta_query' => array(                         array(                             'key' => '_pts',                             'value' => '0',                             'type' => 'NUMERIC',                             'compare' => '!='                         ),                         array(                             'key' => '_dif',                             'value' => '0',                             'type' => 'NUMERIC',                             'compare' => '!='                         )                     ),                 );                      add_filter('posts_orderby','orderbyreplace');                 $loop = new WP_Query( $args );                 remove_filter('posts_orderby','orderbyreplace');      If you could spare a few minutes of your time to have a look over this and make any suggestions you may have and point anything out where I might have gone wrong that would be greatly appreciated. **EDIT** I've changed the code to the following and it is know returning posts however it's only ordering them by the first meta_key and ignores the other.               function orderbyreplace($orderby) {                     global $wpdb;                     return str_replace($wpdb->prefix.'postmeta.meta_value_num', 'mt1.meta_value, mt2.meta_value DESC', $orderby);                 }                      $args = array(                   'post_type'=>'standings',                   'orderby' => 'meta_value_num',                   'meta_key' => '_pts',                   'meta_query' => array(                         array(                             'key' => '_pts',                         ),                         array(                             'key' => '_dif',                         )                     ),                 );                      add_filter('posts_orderby','orderbyreplace');                 $loop = new WP_Query( $args );                 remove_filter('posts_orderby','orderbyreplace');      Many thanks, Ben


title: Update user_login to change username

text: I'm trying to update `user_login` in the `wp_users` table, to force update a user's username to their email address on submission of a front end edit profile form. I know WordPress forbids this via the `wp_update_user` function so I am trying to use SQL with wpdb functions. Here is what I have, and it is not working :(               global $wpdb;     $tablename = $wpdb->prefix . "users";     $sql = $wpdb->prepare( "UPDATE ".$tablename." SET user_login=".$user_email." WHERE ID=".$user_id."", $tablename );     $wpdb->query($sql);      Can anyone help? **Fixed it, see here:** https://gist.github.com/4045215


title: Show all posts without a custom taxonomy

text: I've searched high and low, but haven't found the exact code to do this. I want to show all posts of a that don't have a custom taxonomy assigned. So something like, pull all posts that have one of the custom taxonomy, then show everything but those posts.


title: Changing the default WP editor font and size

text: The default font is too small and too narrow. Makes editing a pain. I want the default font to be Lucida 16. I am not talking about a pop up menu. I already have that. When I open a new page/post I want Lucida 16 to already be set. I tried editing admin folder php but I couldn't get it to work. Must be set at very deep level. Once that is working, then an interface to change on the fly to match font set for web content(set by theme) would be cool.


title: How to order custom posts by one of the custom fields value, 'date'?

text:
I am using this php code to display a list of gigs, which is a custom post type. I want to order it by the 'when' value of the post, and omit the gigs that have already happened. How can I modify the following code to get that happening?                   <?php     $args2 = array(              'post_type' => 'gig',         'numberposts' => -1     );     $gigs = get_posts($args2);     foreach ($gigs as $gig){         echo '
'.$gig->post_title.'

';         // for each custom fields you want.         echo get_post_meta($gig->ID,'_gigswhen', true).'
';         echo 'Time: '.get_post_meta($gig->ID,'_gigsstart_time', true).'-'.get_post_meta($gig->ID,'_gigsend_time', true).'
';     }     ?>      TO clarify a bit, here is the code in my functions.php                   $config = array(             'id' => 'gigs-info',             'title' => 'Gig Info',             'pages' => array('gig'),             'context' => 'normal',              'priority' => 'high',              'fields' => array(),              'local_images' => false,             'use_with_theme' => true //change path if used with theme set to true, false for a plugin or anything else for a custom path(default false).         );         $my_meta = new AT_Meta_Box($config);              //Add fields to your meta box         $my_meta->addText($prefix.'where',array('name'=> 'Where is the Gig '));         $my_meta->addDate($prefix.'when',array('name'=> 'When is the Gig '));         $my_meta->addTime($prefix.'start_time',array('name'=> 'When Does it Start '));         $my_meta->addTime($prefix.'end_time',array('name'=> 'When Does it End '));         $my_meta->addText($prefix.'with_who',array('name'=> 'With Who is the Gig '));         $my_meta->addTextarea($prefix.'words',array('name'=> 'A few words on the gig '));         $my_meta->Finish();     }     ?>      I'm using a custom meta-box class file that someone kindly pointed me to. So I'm not sure if it's being saved as a unix timestamp or not.. I'm a bit new to wordpress php pogramming :)


title: Wordpress bug with capabilities?

text: EDIT: aha! It appears to be the "Role Scoper" plugin causing this problem. Deactivating it restored the functionality. Consider this question null. I've enabled the capability of uploading files for contributors. However, I found a problem. When the contributor start a brand new post, he will see the "Upload/Insert" icons right above the post edit box. However, if the contributor saves a draft then comes back later, then those icons will be gone! I used the "Capability Manager" plugin to modify the contributor capabilities. I'll try another plugin and see if it makes a difference... EDIT: nope, it doesn't make a difference. THe capabilities are stored in the database, and deactivating plugins leaves the capabilities as they were (they stay modified)... This appears to be a wordpress bug. I'm gunna file a bug repot...


title: Querystring (?page=0%2C1) appended at end of URL

text: Can someone help me with my WordPress site. My query is - `Google Webmasters` is showing some URLs which has `page=0%2C3` or `?page=0%2C1` etc appended to the end of URL. Is it possible to stop appending any such **“query strings”** in order to minimize the duplicate issue? Note that, this does not result in 404 page. Both URLs(one with query string appended and other without query string) are working fine. example : http://www.mysite.com/category-name/post-name?page=0%2C3 http://www.mysite.com/category-name/?page=0%2C1.


title: How to customize a plugin?

text: When I need any functionality, I use a plugin or a snippet code inside `functions.php`. But now, I have a plugin that accomplishes my expected functionality, but I have to replace (not add) some code on it. The problem is that if I upgrade the plugin in the future, my changes may be overridden. The code is too large to add it on `functions.php`, and create my own plugin would take much time. What is the better way to proceed in this case? _As a note, I thought that I may could disable the upgrade button for that plugin, although it doesn't seem the better way to proceed._


title: Attachment Metadata not updated while uploading audio files

text: Suddenly, I am having some issues when uploading audio type of file in wordpress. previously, when I uploaded .mp3 files, the attachment metadata of the files were updated accordingly, for instance; it was looking like something similar to                           array (                   'dataformat' => 'mp3',                   'channels' => 1,                   'sample_rate' => 44100,                   'bitrate' => 48000,                   'channelmode' => 'mono',                   'bitrate_mode' => 'cbr',                   'lossless' => false,                   'encoder_options' => 'CBR48',                   'compression_ratio' => 0.068027210884354,                   'fileformat' => 'mp3',                   'filesize' => 5070,                   'mime_type' => 'audio/mpeg',                   'length' => 1,                   'length_formatted' => '0:01',                   'title' => 'Notifier_Loud',                   'file' => 'notifier_loud.mp3',                 )      but not all of a sudden it has stopped working. Now when I am uploading any audio files, the metadata shows only text '1'. I have no specific plugin installed and only uploading files thru normal media up-loader. Also there is nothing in .htaccess which may create a doubt. any clue is highly appreciated. Regards


title: How to set a custom post type to not show up on the front end

text: I use a custom post type in one of my sites for image slideshows. I have publicly queryable set to false/off but when Google crawls my site I see 404 errors for the URLs for my slideshows. I thought that by having publicly queryable off Wordpress would not create those front end URLs. How can I completely turn off the front end URLs and pages for my custom post type? \---- EDIT ------------------------------------------------- By adding public => false, has_archive => false, publicaly_queryable => false, and query_var => false I have successfully gotten rid of the 404 errors in Google. I also added the function provided by @Norcross just for good measure.


title: Is it possible for a plugin to register a page template file?

text: Is there a way for a plugin to house page template files and have them available after plugin activation? E.g, I have a plugin that requires specific page page templates to be used, so I'd like them to be available in the Page Attributes meta box in the Editor. But in an attempt to keep my plugin compartmentalized and theme-independent, I'd like to keep the needed page template files out of the theme directory and in a sub-folder of the plugin. I know WordPress parses the theme directory looking for page templates, but is there a way to register templates outside the theme directory?


title: the_content() "crashes" for single pages

text: I have big trouble with the_content() for single.php. **Whats my problem?**   * the_content() doesn't give any output on single pages   * furthermore it crashes (no other PHP code below the function call is executed   * There are no PHP or database errors shown   * On all other page and post types the_content() works **What I have done/checked so far**   * deactivated all plugings -> no success   * used original Wordpress themes -> no success   * checked twice if the_content() is inside the loop -> it is inside   * tried to use $post->post_content -> gives output, but I want to use the_content()   * $textt = get_the_content(); echo $textt; -> Works also, so where's the difference between get_the_content and the_content, which keeps the_content from working as supposed to So it seems that the problem is theme and plugin independent. I use Wordpress 3.8 and also tried to reinstall the via the update function.


title: Make featured image required

text: Is it possible to force user to set featured image on some types of posts. For example I've got custom post type `mm_photo` and I want to show some error message or somehow block user from publishing or updating post when there is no featured image set.


title: Filter and Search

text: I am working on my site which is a WordPress based site. It is a sweepstakes site well winprizesonline.com is the site which inspired me most. Now I want a dynamic search like that site on my site but I have no idea how and where to add code. Like here; http://www.winprizesonline.com/new/contests/ you can see the 3 search boxs, Sort By:, Entry:, Next Entry: I want same search box with same function of filtering and search. Anyone know its code and can tell me where to put it on my site. I am using DirectoryPress theme for my site. Please I need its answer urgently.


title: Fatal error: allowed memory size when after using enqueue_script

text: I an trying to enqueue four script files and keep getting this error: `Fatal error: Allowed memory size of 103809024 bytes exhausted ... wp- includes/class.wp-dependencies.php on line 175.` I used wp_register_script like this:                       wp_register_script(              'sat-ba-cond',              $scriptsrc . 'jquery.ba-cond.min.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-slitsl',              $scriptsrc . 'jquery.slitslider.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-moderni',              $scriptsrc . 'modernizr.custom.79639.js',              array('jquery'),             '1.0',              false          );                wp_register_script(              'sat-callslit',              $scriptsrc . 'call_slitslider.js',              array('jquery'),             '1.0',              false          );      And wp_enqueue_script like this:                   wp_enqueue_script( 'sat-moderni' );         wp_enqueue_script( 'sat-slitsl' );         wp_enqueue_script( 'sat-ba-cond' );         wp_enqueue_script( 'sat-callslit' );      What could be causing this problem? I have registered and enqueued other scripts as well, which I haven't included here because they have been working up until now. Only these four and `wp_enqueue_script` in particular is causing problems. What could be going on?               add_action( 'wp_enqueue_scripts', 'sat_load_javascript_files' );     function sat_load_javascript_files() {                $scriptsrc = get_template_directory_uri() . '/js/';              wp_deregister_script('jquery');              wp_register_script(              'jquery',              'http://code.jquery.com/jquery-1.7.2.min.js'          );              wp_register_script(              'sat-bootstrap',              $scriptsrc . 'bootstrap.min.js',               array('jquery'),                '2.2.1',                true         );              wp_register_script(              'sat-masonry',              $scriptsrc . 'jquery.masonry.min.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-fitvid',             $scriptsrc . 'jquery.fitvids.js',             array('jquery'),             '1.0',             true          );               wp_register_script(              'sat-callfitvid',             $scriptsrc . 'call_fitvid.js',             array('jquery', 'sat-fitvid'),             '1.0',             true          );               wp_register_script(             'sat-flexslider',             $scriptsrc . 'jquery.flexslider-min.js',             array('jquery'),             '1.0',             true         );              wp_register_script(             'sat-callflexslider',             $scriptsrc . 'call_flexslider.js',             array('jquery', 'sat-flexslider'),             '1.0',             true         );                wp_register_script(              'sat-mobcust',              $scriptsrc . 'jquery.mobile.customized.min.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-infinite',              $scriptsrc . 'jquery.infinitescroll.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-trigger',              $scriptsrc . 'manual-trigger.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-biggtoggle',              $scriptsrc . 'call_biotoggle.js',              array('jquery'),             '1.0',              false          );              wp_register_script(              'sat-mas-inf-blg',              $scriptsrc . 'masonry_isotope.js',              array('jquery', 'sat-masonry', 'sat-infinite'),             '1.0',              true          );              wp_register_script(              'sat-maslin-blg',              $scriptsrc . 'infinite_scroll_lin.js',              array('jquery', 'sat-infinite'),             '1.0',              true          );              wp_register_script(              'sat-mas_hyb',              $scriptsrc . 'masonry_hybrid.js',              array('jquery', 'sat-masonry', 'sat-infinite'),             '1.0',              true          );              wp_register_script(              'sat-ba-cond',              $scriptsrc . 'jquery.ba-cond.min.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-slitsl',              $scriptsrc . 'jquery.slitslider.js',              array('jquery'),             '1.0',              true          );                wp_register_script(              'sat-moderni',              $scriptsrc . 'modernizr.custom.79639.js',              array('jquery'),             '1.0',              false          );                wp_register_script(              'sat-callslit',              $scriptsrc . 'call_slitslider.js',              array('jquery'),             '1.0',              false          );              wp_enqueue_script( 'jquery' );         wp_enqueue_script( 'sat-fitvid' );         wp_enqueue_script( 'sat-flexslider' );           wp_enqueue_script( 'sat-infinite' );         wp_enqueue_script( 'sat-trigger' );         wp_enqueue_script( 'sat-masonry' );         wp_enqueue_script( 'sat-biggtoggle' );         wp_enqueue_script( 'sat-callflexslider' );         wp_enqueue_script( 'sat-callfitvid' );              wp_enqueue_script( 'sat-moderni' );         wp_enqueue_script( 'sat-slitsl' );         wp_enqueue_script( 'sat-ba-cond' );         wp_enqueue_script( 'sat-callslit' );              if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' );           }


title: Setting up Wordpress MU off of a subdomain

text: I would like to create a network using Wordpress MU, but I want to keep certain sites together by theme. For example, if I was setting up an ecommerce site, it would look like shop.domain.com/site-name Likewise, setting up a restaurant site would be restaurant.domain.com/site- name But these would really be on different networks. I want to do this to be able to feature those sites by category on a network homepage. Is this possible? Would it be efficient, or is there a better way to do this?


title: How to embed local video in a wordpress post

text: How can I embed videos (wmv, mp4, mpg, flv) to my post from the local server. I am using WordPress 3.1.1 version. I have searched for wordpress plugins which supports this kind of feature but couldn't find any good plugins. Is there any way to accomplish this.


title: clone image sizes dropdown as custom fields to attachments

text: How can I clone the images sizes dropdown as a custom fields to save its value like other fields in attachments does. ![enter image description here](http://i.stack.imgur.com/X5qqO.jpg) Here is my code but not able to save its value               <?php $clone_sizes = get_intermediate_image_sizes(); ?>     <select name="clone_size">       <?php foreach ($clone_sizes as $size_name => $size_attrs): ?>         <option value="<?php echo $size_name ?>"><?php echo $size_name ?></option>       <?php endforeach; ?>     </select>


title: Is there a move_attachment_file() function in wordpress?

text: I would like to move (or copy) an attachment from the the "standard" uploads directory to another directory and at the same time make sure all the attachment metadata is updated to reflect the change in directory and all image sizes are created.. The 2 functions I would imagine would be:               move_attachment_file($attachment_id, $old_directory, $new_directory);          copy_attachment_file($attachment_id, $old_directory, $new_directory);      Are there any such functions? If not could someone point me in the right direction and let me know which functions I have to use to accomplish that. Then I can try and code it myself, but I am a bit lost to start with.


title: post category exclusion in main loop

text: I have mostly posts from category A. Whereas other categories have very few posts. Due to which my main loop shows posts of category A and other category posts don't get seen much on homepage which shows posts set in settings. What I want to do is alternate the posts shown by main loop such as:               category A post     exclude category A post (any other category post)     category A post     exclude category A post (any other category post)     category A post     exclude category A post (any other category post)     etc etc.      Being a beginner in wordpress, I changed my main loop in index.php with this code:               <?php if ( have_posts() ) : ?>         <?php for($y=0;$y<5;$y++) { ?>     // 5 posts of each category                  <?php $off_num = ($paged-1)*5+$y; ?>  // post offset                  <?php if(is_home()) query_posts("posts_per_page=1&cat=10&offset=$off_num"); ?>    // category id of A is 10             <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', get_post_format() ); ?>                              <?php endwhile;  wp_reset_query();?>                  <?php if(is_home()) query_posts("posts_per_page=1&cat=-10&offset=$off_num"); ?>             <?php while ( have_posts() ) : the_post(); ?>                 <?php get_template_part( 'content', get_post_format() ); ?>                              <?php endwhile; wp_reset_query(); ?>               <?php } ?>     <?php else : ?>      There are pagination problems. e.g page 2 shows posts from page 1, even-though offset is defined. Similarly with other pages. I couldn't come up with any other way to do this. Hope someone can help on this problem. Any other way to obtain same is also welcomed.


title: Best way to assign post position in a news site homepage? (no categories, no sticky posts)

text: I'm currently redesigning a local news website. The old design used a whole lot of categories to handle the position of the content in the static homepage as in "top news", "middle box", "left box" and so on. This is working in someway but it's very ugly, in my opinion, very wrong on a semantic level: categories should be used to categorize. Another option could be using sticky posts, but you can have only a "sticky" vs "non sticky" situation which is kind of limited. I wouldn't use custom post types: basically all post are news and it would be overkill have a separate CPT to position my content on the homepage. The perfect solution would be:   * being able to choose between n position (I need 4)   * having a default status that puts the post on the "other news" box   * control the number of post going into a specific box: the main news box contains only one news, if there is a new "main news" the old one shouldn't disappear from the homepage but switch to a lower position. To recap, I've 5 boxes, 4 of them are a "higher level" single news container, the last one holds 10 news in a reverse chronological order. These 10 news should be "normal" news and "higher level" news pushed out from the upper boxes. I was thinking about Advanced Custom Field as a solution to let the editor choose the position but I'm not sure it's doable on the front end. Thanks!


title: Trying to use qtranslate in WPSC checkout form?

text: I need to have 3 different languages checkout forms for WPSC. When i tried to use AddressAdresse it isn't translated. Or should i created 3 different forms and have the lang check hardcoded? How can i make WPSC to work with qtranslate to have multilanguage webshop?


title: Activation error on first try, not subsequent tries

text: I'm getting an activation error, the first time a plugin is activated, even though it activates. Subsequent activations (after db tables etc are already sorted) don't throw the error which is... Fatal error: Cannot redeclare ca_myplugin_init() (previously declared in /home/together/public_html/themoyles/clients-test-area/wp- content/plugins/church-admin/index.php:68) in /home/together/public_html/themoyles/clients-test-area/wp- content/plugins/church-admin/index.php on line 69                // add localisation      function ca_myplugin_init() {       load_plugin_textdomain( 'my-plugin', false, dirname( plugin_basename( __FILE__ ) ). '/languages/' );       }      add_action('plugins_loaded', 'ca_myplugin_init');      //end add localisation      Line 68 starts load_plugin_textdomain Line 69 starts } The file is encoded UTF-8, no spaces at start or end. If I comment out that section - it'll throw the error with a different function. The doesn't require itself, the functions only appear once! Any ideas?


title: Query Posts With Over 1000 Views

text: _The code below is from this **link**. It basically creates a hit counter, but I'm probably gonna have to do this by IP._ How do I make a WP_Query, where only posts up to 1000 views can be seen on the trending list? Of course. I would want to do it by date as well, but it won't appear at the top one after another, it will only be in the list where it was originally posted. So, that's another solution I'm gonna need to figure out. This is similar to 9GAG.               //Add to functions.php         function get_hits(){         global $post;         $hits = get_post_meta($post->ID, '_hit-counter', true);         return $hits;     }          function update_hits($count){         global $post;         $count = $count ? $count : 0;         $hits = update_post_meta($post->ID, '_hit-counter', $count++);         return $hits;     }          //Usage within the loop     update_hits(get_hits());


title: Blog Title not showing up on main Blog page

text:
I cannot get the main blog page with the current blog to show the current blog title. It shows on all other pages, just not the current/most recent blog. Any help will be greatly appreciated. Thank you.

                  <?php if ( $paged < 2 ) { // Do stuff specific to first page?>                  <?php $my_query = new WP_Query('category_name=featured&showposts=1');             while ($my_query->have_posts()) : $my_query->the_post();              $do_not_duplicate = $post->ID;?>                  <div class="featurepost" id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>"><?php the_title(); ?>"><?php the_title(); ?>"><?php the_title(); ?>

By <?php the_author_posts_link(); ?> on <?php the_time('M j, Y') ?> in <?php the_category(', ') ?> | <?php comments_popup_link('0 Comments', '1 Comment', '% Comments'); ?><?php edit_post_link('Edit', ' | ', ''); ?>

                         <?php the_content('Read the rest'); ?>

              <?php endwhile; ?>


title: How can I make a page for post formats (specifically quotes) in wordpress 3.5

text: I am trying to create the ability for the end user to add quotes (testimonials) as posts. So far, so good. I have enabled the 'quote' post- format in my theme. So the ability exists to enter said testimonials, and I have even figured out how to show some random quotes in the sidebar. The next obvious step is to have a "testimonials" page, where all of the quotes are archived, over time. It needs the ability to be a page, which means that the client can alter the text in the page, and it can be linked to, in menus and on pages. Following the opening (editable) text, would be a list of the quotes, like an archive page, except that the entire quote would be on the page. For that reason, it would at some point, have to become paged. Any ideas?


title: Interrupted cron script sending me hourly emails. Please help!

text: One of my Wordpress installs (cPanel VPS) had a cron job (backup to Dropbox script) that was interrupted. Ever since the interruption I receive hourly emails from root@ cPanel/WHM:   -Excessive resource usage   -Suspicious process running under user […] The suspicious process emails include the following:   **_Network connections by the process (if any):   tcp: 108.160.148.116:52480 -> 54.235.162.219:443_** That last IP address is a Dropbox IP. The thing is I have checked for any running jobs, have deactived and deleted the plugins responsible and have installed Cron checking plugins and no cron scripts are currently in place that have anything to do with the Dropbox backup. I have also checked in cPanel and no cron jobs are listed. And yet I still receive the emails. Every hour. They are driving me crazy! But I don't just want to set up a rule in the email to delete them as I figure something must be going on to make cPanel/WHM send me these emails. Does anyone have any suggestions, I'm desperate!


title: Update the permalinks in posts (not domain change)

text: A group that I joined created a wordpress site before I joined. they did not set up permalinks for the site. So when I took over maintaining the site, I been optimizing the site both for SEO and speed. So I am getting to the posts task, which contain links to other posts on the same site, but because permalinks were off they look like `http://THE_SITE/index.php?post_id=432` within every post. I already enabled the %postname% permalink, so google is already updating its urls because of the 301's, but the problem is the posts still have the old default links. So the question is: What is the best way to update the old links to the new permalinks


title: dbDelta not creating tables

text: I went through a lot of threads, codex page and tried messing with a lot of things but my code doesn't seem to be creating the tables. And I am not able to figure out where I am going wrong. I checked booking_db_version in the database, it gets updated when I update it in the file. Here's the code               global $booking_db_version;     $booking_db_version = "1.0.0";          function booking_install() {         global $wpdb;         global $booking_db_version;         global $tableprefix;         $installed_version = get_option('booking_db_option');              $tableprefix = $wpdb->prefix . 'booking_';              require_once(ABSPATH . 'wp-admin/includes/upgrade.php');              if ( $installed_version !== $booking_db_version ) {             /* Create table for packages */             $packagetable = $tableprefix . 'packages';             $sql = "create table  $packagetable (                 id mediumint(9) NOT NULL AUTO_INCREMENT,                  name text NOT NULL,                  description text NOT NULL,                  city1 text NOT NULL,                  city2 text NOT NULL,                 PRIMARY KEY  (id)             );";             dbDelta($sql);                  /* Create table for hotels */             $hoteltable = $tableprefix . 'hotels';             $sql = "create table $hoteltable (                 id mediumint(9) NOT NULL AUTO_INCREMENT,                  name text NOT NULL,                  city text NOT NULL,                  price decimal(10,2) NOT NULL,                 PRIMARY KEY  (id)             );";             dbDelta($sql);                  /* Create table for addons */             $addontable = $tableprefix . 'addons';             $sql = "create table $addontable (                 id mediumint(9) NOT NULL AUTO_INCREMENT,                  name text NOT NULL,                  addongroup text NOT NULL,                  price decimal(10,2) NOT NULL,                 PRIMARY KEY  (id)             );";             dbDelta($sql);                  /* Create table for addon groups */             $addongrouptable = $tableprefix . 'addon_groups';             $sql = "create table $addongrouptable (                 id mediumint(9) NOT NULL AUTO_INCREMENT,                  name text NOT NULL,                  perhead text NOT NULL,                 PRIMARY KEY  (id)             );";             dbDelta($sql);                  update_option('booking_db_version', $booking_db_version);         }     }     register_activation_hook(__FILE__, 'booking_install');


title: Possible to switch between admin view and author view?

text: The wordpress admin dashboard can be a bit daunting for "normal" wp authors. Is it possible for users who need admin privileges to only see the simpler author view, but be able to switch to the full admin dashboard when required? I understand we could simply create another author account for them. Or use a plugin to create a unique dashboard for each user type. But is it possible to switch between admin / author dashboards at will, without having to log out and then back in again as a different user? Thanks


title: How to make page navigation just below the content?

text: I use the P2 theme, and find that the page navigation is not right blow the content, how make it correct? You can refer my site here. ![enter image description here](http://i.stack.imgur.com/z5Y1O.png)


title: if the post has content

text: I am setting up a one page wordpress site. I am getting some pages listed in my site that does not have content. For example, I will get the empty blog page as well as the blog template. So I thought I could throw in a check to see if the page has content and if it does go ahead and post that information. I am having trouble getting it to work. I am using a custom query for the homepage. So I thought I could do this                if ( $page_query->have_posts() ) : while ( $page_query->have_posts() ) : $page_query->the_post();      if( $page_query->post_content != ''){            get_template_part( 'content', get_post_format() );      }      endwhile; endif;      problem is that I get an error on that code and I can't figure out why. I get this error Notice: Undefined property: WP_Query::$post_content in


title: Is it possible to have a taxonomy archive that lists taxonomy terms?

text: For example, I have a post type called foo. I can view all posts of type foo at the following url: mysite.com/foo. I then attach a taxonomy called bar, in which the terms are foobar and foobaz. I can access the posts assigned the term foobar at mysite.com/bar/foobar. But is it possible to get an archive containing foobar and foobaz at the url mysite.com/bar? Yes, I am aware that I can just create a page and call wp_list_categories(), but I was looking for an automatic solution that mirrors the post type functionality.


title: IIS 7 Rewrite with parent categories

text: I have seen quite a few questions on here asking around the same thing but either have been unanswered or slightly different! I have tested the following on a linux machine and all works fine, when I transfer it to windows to run under iis7 it breaks. So I know its setup right as far as the post type and taxonomy code goes. I create a product(my custom post type) and have the following as product categories(custom taxonomy):   \- test1   \-- test2   \--- test3   \---- test 4   I assign the product to the test 4 category. So on my linux machine `http://localhost/products/test1/test2/test3/test4/product-1/` works perfect. On IIS7 it breaks BUT if I assign the product to the test 1 category it works so: `http://localhost/products/test1/product-1/` I am using the 'Custom Post Type Permalinks' plugin and have my posttype permalink set to: '/%product_categories%/%postname%/' Here is my web.config file:               <configuration>       <system.webServer>         <rewrite>         <rules>             <rule name="Main Rule" stopProcessing="true">                 <match url=".*" />                 <conditions logicalGrouping="MatchAll">                     <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />                     <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />                 </conditions>                 <action type="Rewrite" url="index.php" />             </rule>         </rules>        </rewrite>       </system.webServer>     </configuration>      Any ideas would be great! \-- Edit -- I also just tried this `http://localhost/products/test4/product-1/` and it worked. So its just not liking the parent categories.


title: Custom RSS Feeds & Post Meta Data

text:
Rss feeds normally display media files along with post excerpts. I am using post meta to add media files to a post. Unfortunately, since the audio file is not being inserted into the main textarea the audio files are not being displayed in the RSS feed. How can I edit the RSS feed in such a way that the `rss_enclosure()` displays media files from post meta? This is the code I'm using to edit the RSS feed:               function custom_postrss( $content ) {     global $wp_query;     $postid = $wp_query->post->ID;     $audiourl = get_post_meta( $postid, 'custom_audio_url', true );          if( is_feed() ){         $content = '
This post has an audio file. '.$content.'Subscribe for more.'.$audiourl.'
';     }     return $content;     }     add_filter('the_excerpt_rss', 'custom_postrss');     add_filter('the_content', 'custom_postrss');      This only returns the URL, but not the media file box that is usually seen in RSS feeds. Any ideas? I'd be happy for any pointers.


title: One user per computer

text: I need to allow only one registered user per computer. I have searched for over one hours, but I did not find any properly solution. Actually I found no solutions at all. How could I do it? Is there any plugins or any other ways?


title: Turn off ms-files.php after network setup

text: I have a multisite that was setup on WordPress 3.4. That means that uploads for sub-sites are stored in `wp-content/blogs.dir/{blog_id}/files` and are served through ms-files.php. In WordPress 3.5, ms-files.php was disbanded completely for new installs and uploads are stored and accessed at `wp-content/uploads/sites/{blog_id}`. Is there anyway I can switch my install from the pre-3.5 way of serving/uploading files to the new way? I would like to continue serving uploads through `files/` for current blogs.


title: Help splitting a custom post type archive into "past" and "upcoming"

text: I'm working on a wordpress site that keeps track of a series of `event` posts (custom post type), and I'd like to split up my `archive-event.php` page into two sections – "upcoming events" and "past events," based on today's date. Using `meta_query`, I've been able to successfully show only events which have not yet happened, based on today's date. Changing my query to show past events instead of future ones should not be difficult. What I don't understand is how to enable both of these queries at the same time. Is there a way to create a second `archive-post-type.php` page for my custom post type? Alternatively, is there a way to create a new page template (ex. `past-events.php`) and somehow connect add it into the site's template hierarchy? By way of context, the page I'm trying to modify is here: http://artsrestore.la/events/ And you can see the `archive-event.php` code here: https://gist.github.com/egardner/7324310 Many thanks, Eric Also – I'm pretty new at wordpress and PHP generally, so explanations of code are greatly appreciated!


title: Load more posts with Ajax and masonry

text: I'm using this method to load more posts with Ajax: http://www.problogdesign.com/wordpress/load-next-wordpress-posts-with-ajax/ I'm also using masonry for the posts layout. Masonry works fine for the first set of posts, but not for the next set of posts that are appended after clicking load more posts. How can I make masonry work after loading more posts?"


title: Use comments as notes, visible for comment author only

text: My question is exactly the same as this, not sure if it can be bumped so thought I'd post again. Basically I'm trying to create a scenario similar to how comments work. On a page, a registered user can submit a comment, except, only they can see it, no one else. These comments would be called notes. Is it possible to change the comments so that only the submitted user can see it? I am mainly looking for something that's right under a post, page, that I can put in a template.


title: How do I find out where my website is being directed to on a mobile phone? Mobile site is redirected to the wrong page

text: I cannot find where the site is being redirected on the wordpress.org site but can tell on my phone that it is trying to go to the wrong address. I did not originally try to make it mobile but am trying to fix it - there are no mobile plugins or redirects that appear to be responsible. Please Help!


title: Sub category templates

text: I've inherited a Wordpress site that my company built before I started working here. I would go and ask this question of the guy who built it, but he has now left the company. My query relates to custom templates for wordpress categories. I know that you're able to create a template file called category-.php, and when that category is accessed, it'll use that custom template. In this instance, the file is called 'category-limousin-magazine.php' That is working fine - my issues relates to the sub-categories of this category, i.e. under Limousin Magazine, I've got categories of 2011, 2010, 2009, 2008, 2007 and 2006. Somehow, when building the site, he was able to get all of these sub-categories to use the template of 'category-limousin- magazine-templates.php' - but I can't figure out how he did it, as when I run the current site, next to an archive copy of the site previously, the category-limousin-magazine-templates.php file is being totally ignored. So I have one of two questions - first of all, is there an easy way to get multiple categories to use one single template file, or failing that, what is the best way of getting multiple (potentially dynamic) categories from using a custom template. Thank you.


title: Comment form - different title if no comment yet

text: this isn't major but would be nice. Would like to have 2 titles for the comment form, one that says "no comments yet start the discussion" and another that says "join the discussion". I've had a good look around but I can't see anything already posted about doing this. Can anyone assist? Skip. (I may use different phrases but you get the general idea I'm sure).


title: JS script not being included

text: I am trying to enqueue a js file in functions.php but its not working. Following is my code                add_action('init','shopswing');     function shopswing(){              if(!is_admin()){             wp_register_script('swing',get_stylsheet_directory_uri(). '/js/swing.js',array('jquery'));               wp_enqueue_script('swing');         }     }      and somehow, my site stop responding when i include the code of swing.js               jQuery(document).ready(function() {             $("ul>li>img").mouseenter(function(){             $(this).parents("ul")             .find(".toolTip")             .animate({ 'height':'200px'})             //.css({"display":"block"});         })         .mouseout(function(){             $(this).parents("ul")             .find(".toolTip")             .animate({ 'height':'0'})             //.css({"display":"none"});         });     });


title: If custom field is empty, use one from a previous post

text: Let's say you have a few custom fields (I use the advanced custom fields plugin for it). There is an extra field in posts called 'afbeelding_onder'. It is not required but on `index.php` within the loop the custom field 'afbeelding onder' from the last post will be printed. If it is possible, is there a way to check if the custom field is empty, if it isn't than it will print the value, but else (when the custom field is empty) the value of the last post which contains a value in that box will be printed. Hope my question was clear enough, my English grammar is not that good.


title: Top admin bar / toolbar not showing even when logged in, but empty top margin showing?

text: I wrote a theme and the top admin / tool bar is not showing. I still see an empty margin. Any ideas? Here the top margin I never set anywhere in my files. I actually want to show the toolbar completely. ![enter image description here](http://i.stack.imgur.com/eS93f.png)


title: How to use wp_insert_user on Wordpress Multisite?

text: I previously had a WordpressMU install, but this is deprecated and I'm trying to find my way around multisite. I need to programatically create a new user account for a particular site. wp_insert_user looks like it does everything except say which site the user is _for_ (perhaps it takes this from the domain the request was sent to?). It's important that the created user is a member on one blog (site), but not the other(s).


title: How to query categories with Advanced Custom Fields?

text: I'm currently using Advanced Custom Fields and I was wondering if anyone know how to filter categories by custom fields? I have a custom field in my categories using the checkboxes field. I want to make a page that will list categories that contain a specific checkbox field that is ticked. For example I have 3 checkboxes in my categories which are Romance,Action & Drama. I have ticked checkbox Action and I want to list categories on the page that have ticked checkbox Drama. It is kind of similar to this tutorial http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts- filtered-by-custom-field-values/ except I want to get categories instead of posts. What’s the easiest way to do this cause I’m not a programmer?


title: Setting a Default 'Theme Location' When Creating a Menu

text: I'm trying to create a theme which when activated, sets up a primary navigation, adds the homepage to it and then enables it in the correct location. Here's what I've got so far:               register_nav_menu('Primary', 'Primary Navigation');          $primary_nav_menu_id = wp_create_nav_menu('Primary');          wp_update_nav_menu_item($primary_nav_menu_id, 0, array(         'menu-item-title' =>  __('Home'),         'menu-item-classes' => 'home',         'menu-item-url' => home_url( '/' ),          'menu-item-status' => 'publish'     ));      The above creates the menu, adds a link to the homepage but how would I go about automatically assigning this menu a theme location of 'Primary Navigation'? Is this possible?


title: Media Library Custom Taxonomy Archive

text: I have added two custom taxonomies to wordpress media library audio_cats and audio_tags. Using a plugin, I have uploaded some mp3s and have attached to these two taxonomies. My media library structure looks like this               Taxonomy audio_cats has these categories          -MJ             --album1 (3songs)             --album2 (4songs)             --album3 (1 song)     Taxonomy audio_tags has these tags            -mp3            -MJ      what I want is.   1. index.php -> show all audio_cats (parent only) as a link with total number of child_cats inside and total number to audio assigned to it. For example MJ (3 albums and 8songs) to be shown on MJ cats   2. taxonomy.php -> When a parent category is clicked, it should take to the page where 1) if there are sub cats assigned, it should list them all otherwise list all the songs assigned to it as a link   3. attachment.php -> if song name is clicked it runs the player.   4. audio_tags is displayed as a tag cloud  I hope I make myself clear and anticipate your feedback. Regards


title: Is there any plugin development framework

text: Since I am new to wordpress plugin development I have been examining internal structure of many plugin's and I could find most of them doesnt fit any pattern and understanding how they works is pretty much difficult. I was wondering if there is more generalised way of plugin development, possibly with a framework, other than the methods discribed in official documentation.


title: Upload PDF and other files from the Front-End

text: I am trying to create a medical website, where logged-in doctors can actually upload pdfs and other files (such as jpg) from the front-end in posts. Then, after reloading the page, the uploaded files should be retrieved within the same post, so other users can easily find the info, without any access to the back-end whatsoever. Can this be done in WP? Thanks in advance! Miguel


title: Multiple authors with different "author roles"

text: I´m using Co-Authors Plus plugin to manage multiple authors in a e-magazine, but I´m trying to go further and credit "text authors", "photography authors" and "video authors", so I´m adding a new field in the author´s profile to specify a role (writer, photographer, videographer) and trying to show the extra meta information in single.php and in the frontpage (through a widget). This is the new function in functions.php:               // Add Twitter, Facebook and Role profile field in user profiles.     function add_twitter_contactmethod( $contactmethods ) {     // Add Twitter     $contactmethods['twitter'] = 'Twitter';     // Add Facebook     $contactmethods['facebook'] = 'Facebook';     // Add Role     $contactmethods['role'] = 'Role (writer / photo / video)';     return $contactmethods;     }     add_filter('user_contactmethods','add_twitter_contactmethod',10,1);      And this is the output in single.php and in the widget, which is intended to show the role before the author´s name and a link to the Twitter or Facebook account (e.g. Text: John Doe @johndoe · Photo: John Williams @photowilliams):               <?php $i = new CoAuthorsIterator(); ?>           <?php while($i->iterate()){ ?>     <?php if(get_the_author_meta('role') == "writer"){ ?>     <?php _e('Text:','alegria'); ?>     <?php } else { ?>     <?php _e('Photo:','alegria'); ?>     <?php } ;?>     <?php the_author_posts_link(); ?>     <?php if(get_the_author_meta('twitter')) : ?>     <a href="http://twitter.com/<?php echo the_author_meta('twitter'); ?>" class="author-twitter" title="Follow <?php echo $authorname; ?> on Twitter">@<?php echo the_author_meta('twitter'); ?>      <?php endif ;?>      This works fine, but I´ve been trying to add a third possibility, which involves the role "video" (if the role is "video", then show "Video:" before the author´s name. I´ve been dealing with new instances of "if(get_the_author_meta('role')" and "elseif", but in a intuitive way, since I´m not a programmer and know very little about PHP and conditional sentences. Could anybody point me in the right way to achieve what I´m looking for? Thank you.


title: Hooks are not executing

text: Based on my understanding of hooks, you create a hook, by doing do_action('hook_name'); then add something to said hook and call the method where you want it to do the hook, so:               public function hook_name(){         do_action('hook_name');     }      some where you do something like:               add_action('hook_name', 'some_hook');      and then some where in the theme you call:               hook_name();      and there ya go, where you call that function your hook will execute. Well I attempted to create a class to simplify this, because what if you have a theme with say 50,000 hooks (dont ask why, I am going with the extreme), thats 50,000 functions much like the one I did above. So based on: This previous post I attempted to create a class such as:               <?php          class AisisCore_Hooks{              protected $_hooks;              public function __construct($hooks){             $this->_hooks = $hooks;                  $this->_setup_hooks($this->_hooks);                  $this->init();         }              public function init(){}              protected function _setup_hooks($hooks){             foreach($hooks as $hook=>$param){                 if(is_array($param)){                     do_action($hook, implode(',', $param));                 }else{                     do_action($hook);                 }             }         }          }      I then tried doing:               $array = array(         'hook_name_one'     );          $hooks = new AisisCore_Hooks($array);          function test(){         echo "I am a test for this idea";     }          add_action('hook_name_one', 'test');      But soon realized that I am doing an action which has nothing attached to it. So my question is: Do I, in my class, Want to pass in a action name and a function and do add action and then out side call do_action(); ? so:               protected function _setup_hooks($hooks){         foreach($hooks as $tag=>$action){             add_action($tag, $action);         }     }      then do: do_action(//what ever the tag is);


title: Conditional based on the User Role of the Current Profile the user is viewing - BuddyPress

text: I'm using BuddyPress and need a certain block of code to show up on user role Store Owner profiles only. I'll be putting it in member_header.php, so it's just a template file. I've been digging for a long time now and just can't seem to figure this out. I found a way to target _current_ user role, but that makes it show up on everyone's profile for a user in the Store Owner user role. I understand I need a conditional, but I just can't seem to find the _right_ conditional... Am I missing something, somehow? Thanks so much!! ## **Edit** : OK, so I've been fiddling around and moved on to something a little different... I still need similar help, just in a slightly different and less flexible setting. I've changed my mind and moved this block of code to a separate profile page entirely. I have the page built and linked to in the profile menu. So what I need the conditional for is to show this menu item based on the user role of the profile being viewed. Here's the code that works and shows up on every single user's page:               // Set up Custom BP navigation     function my_setup_nav() {            global $bp;           bp_core_new_nav_item( array(                 'name' => __( 'Calendar', 'buddypress' ),                 'slug' => 'calendar',                 'position' => 20,                 'screen_function' => 'calendar_template'            ) );                // Change the order of menu items           $bp->bp_nav['messages']['position'] = 100;     }          add_action( 'bp_setup_nav', 'my_setup_nav' );      Here's the code that I've been playing with, but it causes the menu item to just not show up _anywhere_.               // Set up Custom BP navigation     function my_setup_nav() {           if(user_can($user->ID, "store_owner")) {           global $bp;           bp_core_new_nav_item( array(                 'name' => __( 'Calendar', 'buddypress' ),                 'slug' => 'calendar',                 'position' => 20,                 'screen_function' => 'calendar_template'            ) );                // Change the order of menu items           $bp->bp_nav['messages']['position'] = 100;     }     }          add_action( 'bp_setup_nav', 'my_setup_nav' );      My site is: http://www.pureplayhaven.com And the user "sample" is a "Store Owner" user. Thank you so much!!


title: If/Else Statement for Advanced Custom Fields

text:
I'm still trying to wrap my head around PHP (no pun intended) and am trying to get something to work using the Advanced Custom Fields plugin in WordPress. So, I've got a repeater field that's made up of two Number Fields and a True/False field. I'm basically trying to write a statement like this: If the True/False field is `true` then `echo` both `sub_field_1` and `sub_field_2`, else echo just `sub_field_1`. So far, I've got this:               <?php            while(has_sub_field('parent_repeater')) {              if( the_sub_field('true') ) {            echo '
' . get_sub_field('sub_field_1') . get_sub_field('sub_field_2') . '
';         }              else  {           echo '
' . get_sub_field('sub_field_1') . '
';         }     }     ?>      What am I doing wrong? I'm currently going through the ACF documentation, if anyone could point me in the right direction, I'd really appreciate it. Thanks in advance! **EDIT:**
          <?php while ( have_rows('blend') ) : the_row(); ?>              <?php             $field = get_sub_field_object('blend');             $value = the_sub_field('blend');             $label = $field['choices'][ $value ];         ?>
             Pct: <?php the_sub_field('percentage'); ?> Mix: <?php the_sub_field('mix'); ?>
          <?php endwhile; ?>
          <?php else :          echo '
No Rows found
';          endif; ?>


title: Wpdb generates too many queries

text:
I googled for hours, then found some codes on stackexchange (http://wordpress.stackexchange.com/a/108279/108270) and created the codes below. I'm trying to get alphabetical A-Z posts lists (e.g. A B C D E ...). Everyting works fine but this code generates too many queries. When there is only post titles, page generates 15 queries but when I add `the_permalink()` it jumps to 33. I suspect there is something wrong here. Can anybody advice me a more efficient way to do what I want? Thanks in advance!                global $wpdb;      $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;      $postsperpage = 10;           $posts = $wpdb->get_results( $wpdb->prepare(          "SELECT * FROM $wpdb->posts          INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id)          INNER JOIN wp_term_taxonomy ON (wp_term_relationships.term_taxonomy_id = wp_term_taxonomy.term_taxonomy_id)          WHERE          wp_term_taxonomy.term_id = 107          AND post_type = 'post'          AND post_status = 'publish'           AND post_title LIKE %s ORDER BY post_title ASC",          $letter . '%'        ));      }           echo '
';      foreach ( $letters as $l) {        $param = $l;        printf('
%s
',$page_link, $param, $param);      }      echo '
';           if ($posts):           $i = $postsperpage * ($paged-1);        while ( $i < $postsperpage*$paged ):           $post = $posts[$i];           setup_postdata($post); ?>
<a href="<?php the_permalink();?>"><?php the_title(); ?>
      <?php      $i++;      endwhile; endif;      ?>


title: Filter multiple different main queries on custom pages

text: Ok so I have multiple different page templates with a main query that I want to filter the loop for. In my example I try to use a function to filter the main loop of my site and also the main loop for the page 'new'. Now this works fine for the main page but makes the 'new' page return a 'page not found' not taking the custom template that's assigned to it. What's the right way to do this?               function fod_filter_main_query( $query ) {              if( is_front_page() && is_main_query() ) {                       $query->set('meta_key', 'hotness');             $query->set('meta_value', 0 );             $query->set('meta_compare', '>');             $query->set('orderby', 'meta_value_num' );             $query->set('order', 'desc');             $query->set('cat', -1 );             $query->set('posts_per_page', 16 );             $query->set('post_type', array( 'post','fod_videos','fod_music','fod_articles', 'fod_albums'  ));              } elseif  ( is_page('new') && is_main_query() ) {                  $query->set('cat', -1 );             $query->set('order', 'asc');             $query->set('posts_per_page', 16 );             $query->set('post_type', array( 'post','fod_videos','fod_music','fod_articles', 'fod_albums'  ));              }          }     add_action('pre_get_posts', 'fod_filter_main_query', 9999);


title: Redirect posts to sub domain except pages

text: We have a WordPress site, which contains posts and pages. Now we moved posts into sub domain but we kept pages into root domain. Only Posts has `.html` extension and there is no difference in the URL for Posts & Pages. Sample Post: `www.mydomain.com/sample-posts.html` need to redirect with `blog.mydomain.com/sample-posts.html`. Sample Page: `www.mydomain.com/sample-pages` How to redirect only posts in to sub domain?


title: Error post_type link admin pagination

text: I have an error with bad links on all my specials post_type created by the plugin "magic-fields-2". on the admin link (pagination, eg: go to page 2) i can see : http://myserver.cl/cedennatest/wp- admin/edit.php?post_type=integrantes%3Fpost_type%3Dintegrantes&paged=2 like you can see i have two times the same variable post_type and two time the character "?" How i can modify this link in wordpress ? Process with "magic-fields-2" :   1. created a new type   2. the new type is now present in the lateral bar (where there is "Dashboard" etc)   3. when the number of this special type exceed the maximum of autorised post i see a arrow for pagination   4. this link for ALL new type created have the problem


title: Highlight current post title on a page

text:
In my menu I have a page that is called `Campaign`. When the user enters to `Campaign` the page displays the last custom post type of `campaign-post`. In the sidebar of `Campaign` page, I'm displaying a list of all `campaign- post` custom posts. The problem is that I don't know how to highlight (add `current` class) to the last post title in the list that is displayed when the user enters to `Campaign` page. This is how I'm displaying the list:
         <?php $query = new WP_Query( array( 'post_type' => 'campaign-post' ) );                      while ( $query->have_posts() ) : $query->the_post();             echo '
';             the_title();             echo '
';         endwhile; ?>
      Any ideas?


title: Order by optional meta key?

text: I'm building the sorting functionality for a custom post type, and I have a custom meta value for "Featured" posts. This value is set when you tick the checkbox, otherwise it is not set. Using the default `orderby=meta_value` with `meta_key=featured` makes it so that the screen only displays posts that have the meta key. If they don't, they don't even appear. I want it so if it is not set, they do appear, but they appear last. I assume I need to use `meta_query` instead, but I couldn't get that to work either. **How do I allow empty, false, or non-existing meta keys in the WP_Query arguments?** My code is below. This is for sorting columns in the dashboard, so it is modifying the default WP Query args.               function featured_sortable_order( $vars ) {       if ( isset($vars['orderby']) && $vars['orderby'] == 'featured' ) {              $vars = array_merge( $vars, array(           'meta_key' => 'featured',           'orderby' => 'meta_value',           'order'     => isset($vars['order']) ? $vars['order'] : 'asc',         ) );            }       return $vars;     }     add_filter( 'request', 'featured_sortable_order' );


title: How to list all external URLs that I have posted on my WordPress blog?

text: I want to list all the external links of my posts in a single place/file. How can I achieve this?   * Is it possible to achieve this via a plugin?   * Is it possible to achieve this with a built-in wordpress api?   * Is it possible to achieve this via some free 3rd party tool? What approach should be followed for achieving this?


title: How to display custom taxonomies at multiple levels

text:
I have built a custom post for products, as well as a custom taxonomy for it. I am attempting to have a main product page that lists the top level categories. That works fine. Then that page links to the corresponding sub category, using a custom archive template, where this code is. Goal is to display each sub category, and it works for the first level only. It displays proper, then when clicking on a link to go to its child category list, it just goes back to the initial products page. Any thoughts on how to do this? This is the code for where I output the child categories. Thank you!
         <?php         $current_cat = get_query_var('products_category');         $args = array(                         'hide_empty'    => false,                         'parent'        => get_cat_ID( $current_cat )                     );              $categories = get_terms( 'products_category', $args);              foreach ($categories as $category ) { ?>
             <?php             $cat_img = get_field('category_image', 'products_category_'.$category->term_id);             $cat_link = get_term_link( $category,$category->slug ); ?>                      <a href="<?php echo esc_url( $cat_link ); ?>" title="Category Name">                     <img src="<?php echo $cat_img ?>" alt="<?php echo $category->name ?>"/>                              <?php } ?>


title: How to replace settings in WordPress plugin from a theme

text: I created an array with some default settings in a plugin, and want to allow it to be replaced from functions.php in a theme without using stored data (eg. add_option). I want this to be just a hook with new values. example array inside plugin:               $default_settings = array(        'key_one' => 0,        'key_two' => 1     );      I need to allow this to be changed from a theme's functions.php, so a developer can add something like this:               add_filter('the_hook','my_function');     function my_function(){       $default_settings = array(            'key_one' => 1, //changed value            'key_two' => 1       );     }      If a developer makes this call, then I want the new values replacing the old array inside the plugin. Any help is appreciated.


title: Attaching a media file to email link from webpage? How?

text: When someone clicks a link on my webpage I want it to come up as an email with a document from my media folder already attached to it. How do I do this? Thanks!


title: Super simple shortcode not working

text: Have been looking at various tutorials and answers here and elsewhere and just can't get this to work. Just trying to display a simple output from a shortcode as below, but it is just outputting the actual shortcode tag to the page instead of the content from the shortcode **Functions.php**               <?php      function welcome_roundels_func(){         return "testing";     }     add_shortcode( 'welcome_roundels', 'welcome_roundels_func' );     ?>          add_action( 'init', 'register_shortcodes');      **Usage**               [welcome_roundels]      Is there anything else I have to do to enable shortcodes, or should the above work? **Edit** I am also using the below code to output the content               $welcomePage = get_post( 5 );      echo $welcomePage -> post_content;


title: Why my custom post posts aren't showing (404 error / page not found)

text: I just installed a new wp installation. I have created a new child theme based on the TwentyTwelve theme. In the child theme functions.php, I have created a new custom post called "news". I have added two posts in the "news" and when I view either of them, I get a "page not found" error. See screenshot: http://pasteboard.co/dtIOK6g.jpg I am expecting the posts to be displayed but am getting a 404 page. why. **Update** (to make my question clear): From installation, I have done very little work, apart from the following:   * Added a new child theme (of Twenty Twelve)   * I have applied the new child theme   * I have created a new custom post by updating the creating a functions.php in the child theme and ading in this code here (http://pastebin.com/DKny8QH1)   * In WP admin, I have created a 2 new posts under news (new custom post created above)   * if I try to access the post, i get 404 (as shown in screenshot above). However, I can access the posts created normally. Thanks **RESOLVED** : This is really weird but I have resolved it. It appears I needed to reselect the "Post name" option for my permalinks settings even though it was already selected. Selecting this option again solved my problem. Sorry about any confusion.   * I went to settings > permalink


title: Import tumblr post to wordpress blog

text: When I add a new post in my tumblr account, automatically that post of tumblr would be sync with my wordpress account. Its not necessary that at sync time I have to be logged in wordpress. In simple words, tumblr post will be automatically shown to wordpress blog. I donot know how it will work. If any body have any plugin or api which match to my requirement. I will very much thankful. i am using this plugin :- http://wordpress.org/extend/plugins/tumblr-importer/ But problem is that i have to import every time post is added in tumblr.Hope that makes sense. Its really annoying for me. TIA


title: WordPress calendar hook to filter days that are marked with posts

text: The `get_calendar` function returns a calendar and is part of the core widgets that come with WordPress. But I've written a custom solution for controlling the visibility of posts based on user associations. (Certain posts are visible only to users with certain terms associated with them; for example, users who belong to the "associates" term of the "groups" taxonomy see posts that are targeted towards associates, while they are invisible to other users and guests.) This works for the post view and the archive view. But if I include a calendar widget, it marks days incorrectly. For instance, on December 3rd, only one post was made and it is only visible to associates. But the number 3 on the calendar is a link. When I click on it, it goes to the archive, which is empty for that day. I have overridden the `posts_where` hook, but when I viewed the source of `get_calendar`, it doesn't appear to use that hook. Is there something I'm missing? Should I use a calendar plugin instead, or try to manipulate the resulting HTML code using the `get_calendar` filter?


title: WordPress htaccess

text: I got the following from the html5 boilerplate htaccess file. Is this safe to add to my wordpress htaccess? And will it help?               <IfModule mod_deflate.c>          # Force compression for mangled headers.     # http://developer.yahoo.com/blogs/ydn/posts/2010/12/pushing-beyond-gzipping     <IfModule mod_setenvif.c>         <IfModule mod_headers.c>             SetEnvIfNoCase ^(Accept-EncodXng|X-cept-Encoding|X{15}|~{15}|-{15})$ ^((gzip|deflate)\s*,?\s*)+|[X~-]{4,13}$ HAVE_Accept-Encoding             RequestHeader append Accept-Encoding "gzip,deflate" env=HAVE_Accept-Encoding         </IfModule>     </IfModule>          # Compress all output labeled with one of the following MIME-types     # (for Apache versions below 2.3.7, you don't need to enable `mod_filter`     #  and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines     #  as `AddOutputFilterByType` is still in the core directives).     <IfModule mod_filter.c>         AddOutputFilterByType DEFLATE application/atom+xml \                                       application/javascript \                                       application/json \                                       application/rss+xml \                                       application/vnd.ms-fontobject \                                       application/x-font-ttf \                                       application/x-web-app-manifest+json \                                       application/xhtml+xml \                                       application/xml \                                       font/opentype \                                       image/svg+xml \                                       image/x-icon \                                       text/css \                                       text/html \                                       text/plain \                                       text/x-component \                                       text/xml     </IfModule>


title: WordPress and Git Workflow

text: I know this question has been asked a thousand times, but I'm really trying to work out how to get the best out of Git when working with WordPress. I've scoured the web and read dozens of articles, all that seem to cover the topic briefly. Here's a few of the most notable one's I've read recently. \- Version Controlling WordPress \- Managing WordPress Theme Deployments with Git \- Manage your custom WordPress theme using git instead of FTP Currently, my workflow looks like this.   * Install WordPress locally   * Develop Theme   * Export WordPress Databases from local server   * Import WordPress Database to remote server   * Upload WordPress files and theme via FTP   * _Client makes changes_   * Download WordPress files and theme via FTP and export WordPress Databases from remote server   * Replace files locally   * _Make development changes_   * Re-upload via FTP, export and import database to remote server I realise Git can streamline this process. It seems the best way to do this is to have a .gitignore file that ignores certain directories that don't need to be tracked, as well as having both a local and remote wp-config.php file. But how do you handle the databases? Clients will usually make changes (posts/pages/plugins). Do I still need to export from the remote database and import back on my local server? Can someone suggest the best workflow for me here? And walk me through the steps. Also, I'd probably like to use Bitbucket as private repos with them are free, unlike GitHub. Any help would be appreciated. Thanks in advance!


title: 404 error with nested WordPress installations

text: I'm making changes to a site that someone else built in the root directory of their server and trying to add another directory with wordpress onto the root of the server, it gives me a 404 error from the wordpress site that is installed onto the root. The theme has a setting where you can edit the .htaccess file... right now it has the code at the bottom in it, if I add this to the top of it will it screw up the website. Last thing I need is for this main site to go down. WANT TO ADD THIS...               RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} ^/subdirectoryname1/(.)$ [OR] RewriteCond %{REQUEST_URI} ^/subdirectoryname2/(.)$ [OR] RewriteRule ^.*$ - [L]      TO THIS.... (already there)               BEGIN WordPress          RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L]          END WordPress


title: How to include first assigned category in the post URL?

text: What are the options for creating URLs like: _site.com/category-name/post-name_ Where, "category-name" is the first category that the post was assigned to (in the event that the post is assigned to multiple categories) Note: if the post is assigned to "uncategorized", I don't want to display the category name in the URL, so in that case, I just want _site.com/post-name_ PS: it will also require the removal of the word "category" from the URL. I was able to get that done with the plugin "no category base", however, it does not include the parent category name in the URL to a post.


title: Installing WP twice in same Directory?

text: I have a website that has Wordpress installed in the root directory `/` I have another website, that's contents is within that root directory, `/seperatesite/` that stores a separate, small, splash page type website, with a separate domain pointing to it. I want to setup another Wordpress install inside of this folder. Is it hazardous to have two Wordpress installs setup this way? I'm wondering as I currently don't have the host credentials to create a separate database within the host area if need be, is this simple enough to move without this - or still a sensitive setup? **Thanks for any pointers!**


title: Standard wordpress importer seems to be missing blog images

text: I have 2000+ images and I've used the importer both locally and on my hosted site, the hosted site seems to have 100 less images though. I'm importing from blogger. I've ran the importer a few times and it still hasn't picked them up. These images are supposed to get downloaded and stored locally from a blogger website but I'm short ~100. Anyone else ran into this problem and know of a fix?


title: Can the Twenty Eleven theme have a Main Sidbar at all?

text: After pulling my hair trying to find out why my Main Sidebar disappeared, I performed as a last act of desperation a complete wipeout of the database and the entire wordpress directory, then I restored them from the earliest backup of my totally fresh install of WordPress, which includes **only the home page and the original sample page** and **no plugins!**. That didn't help displaying the Main Sidebar. But when I switch to `Twenty Ten`, the Main Sidebar, with the calendar in it, is there! This is insane, as I am now beginning to doubt my memory that I ever saw the Main Sidebar on `Twenty Eleven`. Can the Twenty Eleven theme have a Main Sidebar at all? If so, what am I doing wrong?


title: How to play amazon S3 videos in wordpress 3.6?

text: The latest release of WP has its own media player (mediaelement.js), to include and play a video we no more need a separate media player now. My question is How can I make the `[video]` shortcode work with videos uploaded on S3 which are protected. I try using this               [video mp4="http://xyz.s3.amazonaws.com/test.mp4?AWSAccessKeyId=AKIAIFXXXXXXG7A7A&Expires=1375464588&Signature=ZimqpfuYZQwQIrPaVnodi4WASO0%3D"]      But that doesn't seem to work. The URL I created has expire time of 300s, if I try to run the test.mp4 in a new tab, it works. But it doesn't play in wordpress. Any help would be appreciated.


title: custom url rewrite

text: I have a custom search, one database out of WP, I store the page in wordpress admin panel: http://localhost/wp/wp-admin/post.php?post=96&action=edit&message=1 Then the page's url looks like `http://localhost/wp/directory/view?search=moto&number=12` Now I want to modify it into `http://localhost/wp/directory/view/moto/12`. I tried the method with `RewriteRule ^directory/view/(.*)/(\d+)/$ directory/view?search=$2&number=$3`, and the whole `.htaccess` is:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /wp/     RewriteRule ^index\.php$ - [L]     RewriteRule ^directory/view/(.*)/(\d+)/$ directory/view?search=$2&number=$3      RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /wp/index.php [L]     </IfModule>     # END WordPress      but it does not work, need a work code, thanks, EDIT: I tried `add_rewrite_rule` still not worked... To avoid page name infection, the better way use `directory/view`.               function add_directory_rewrite() {         add_rewrite_tag("%search%", '(.+)');         add_rewrite_tag("%number%", '(\d+)');         add_rewrite_rule('^directory/view/(.+)/(\d+)/', 'directory/view?search=$matches[1]&number=$matches[2]', 'top');     }     add_action( 'init', 'add_directory_rewrite' );


title: Custom Search Not Consistent with Results

text:
I've set up a custom search to use the `s` GET variable on a URL. I want it to fetch certain results but I've come across an odd problem. First, here's my code:               $search_term = $_GET['s'];          if($search_term!=''){         $s = new WP_Query(array('s' => $search_term));         $search_array = array();              if($s->have_posts()){             while($s->have_posts()){                 $s->the_post();                      $title = get_the_title();                 $permalink = get_permalink();                 $search_identifier = $title.$permalink;                      array_push($search_array,$search_identifier);             }         }     }      Essentially, I'm creating an array of unique values for each post because I need to use them for a function immediately after that. I have a post titled 'Kitchen Assistant.' When I search 'kitchen', it shows up. When I search 'assistant' it does not show up. I have other posts with the word 'assistant' in the title and content and those show up when I search 'assistant'. I'm curious as to why it would show up with one search term and not the other? Any help would be greatly appreciated. Thanks! ## EDIT Here is my code in a greater context for clarification. I've created a standalone template PHP page as a new search page because of the customizations I am looking to do. It's a search form that searches for two different terms. One is a search term and the other is a location term. I first do a WordPress query for the search term and add them all to an array (if a search term exists). I then do a search for the location (if the location exists). I then cross-reference them if both exist, otherwise I just do a search depending on the variable that exists. It all seems to work EXCEPT the search part in WordPress. It doesn't affect the location search at all and the location search doesn't really seem relevant to why the Wordpress query is failing to pick up the right variables but everyone keeps asking about the context of it so I figured I'd share. Let me know if this sheds more light on the situation or if you'd like me to clarify any other elements of it. Thanks!               <?php     //DIRECT CONNECTION TO DATABASE     include('job-parsing/connect.php');     //WP CONNECTION TO DATABASE     include('wp-config.php');          get_header();          $search_term = $_GET['s'];     $real_loc = $_GET['location'];     $location = urlencode($_GET['location']);          //QUERY SEARCH TERM INITIALLY     if($search_term!=''){         $s = new WP_Query(array('s' => $search_term));         $search_array = array();              if($s->have_posts()){             while($s->have_posts()){                 $s->the_post();                 //var_dump($s);                      //I ADD POST LONGITUDE AND LATITUDE FIELDS BECAUSE THESE POSTS ARE ENTERED DAILY ON A CRON JOB WITH THOSE VALUES; THESE WILL BE NEEDED LATER DURING A GEOLOCATION TEST BELOW                 $post_latitude = get_post_field('post_latitude');                 $post_longitude = get_post_field('post_longitude');                      //CURRENTLY SOME POSTS DON'T HAVE LONGITUDE AND LATITUDE SO I DON'T WANT TO HAVE THOSE INCLUDED IN THE SEARCH, THEY ARE IN A LIST ON THE SITE BUT DON'T HAVE LOCATIONS SO IT DEFEATS THE PURPOSE OF WHAT WE ARE DOING AND WILL BE EXCLUDED FROM SEARCH                 if($post_latitude && $post_longitude){                 $id = get_the_ID();                 $search_identifier = $id;                      //IF POST LATITUDE AND POST LONGITUDE EXIST ON TERM THAT MATCHES SEARCH TERM                 array_push($search_array,$search_identifier);                 }                }         }     }          //SEARCH RESULTS ARRAY IS NOW SET          //IF LOCATION IS FILLED OUT, RUN GOOGLE API CODE (POSTCODE/TOWN IS THE DEFAULT VALUE/PLACEHOLDER ON THE FORM SO IN THE CHANCE THAT SOMEONE SUBMITS WITH THAT STILL IN THE INPUT, I DON'T WANT IT TO RUN THROUGH THE GOOGLE API     if($location!="Postcode%2FTown" && $location!="" && $location!="Postcode/Town"){         //TAKE THE LOCATION SEARCH TERM AND CONVERT IT INTO LATITUDE AND LONGITUDE COORDINATES         $url='http://maps.googleapis.com/maps/api/geocode/json?address='.$location.'&sensor=false';         $source = file_get_contents($url);         $obj = json_decode($source);         $LATITUDE = $obj->results[0]->geometry->location->lat;         $LONGITUDE = $obj->results[0]->geometry->location->lng;              $center_lat = $LATITUDE;         $center_lng = $LONGITUDE;         $radius = $_GET['radius'];              $query = sprintf("SELECT ID, post_title, post_latitude, post_longitude, post_date, ( 3959 * acos( cos( radians('%s') ) * cos( radians( post_latitude ) ) * cos( radians( post_longitude ) - radians('%s') ) + sin( radians('%s') ) * sin( radians( post_latitude ) ) ) ) AS distance FROM wp_posts HAVING distance < '%s' ORDER BY distance",           $mysqli->real_escape_string($center_lat),           $mysqli->real_escape_string($center_lng),           $mysqli->real_escape_string($center_lat),           $mysqli->real_escape_string($radius));         $result = $mysqli->query($query);         $found_num = mysqli_num_rows($result);     //END GOOGLE MAPS API CALL     }     ?>

<?php echo $found_num; ?> Jobs found for <?php echo $real_loc; ?>"

          //BEGIN JOB LIST
          <?php     //IF LOCATION WAS ENTERED AND A SEARCH QUERY USING GOOGLE MAPS API WAS USED SUCCESSFULLY     if($result){     //INITIALIZE NEW ARRAY         $new_search_array = array();         while ($row = $result->fetch_assoc()){             $post_id = $row['ID'];             $permalink = get_permalink($post_id);             $title = $row['post_title'];                  //IF SEARCH TERM EXISTS, CREATE ARRAY THAT MATCHES LOCATION AS WELL             if($search_array){                 foreach($search_array as $value){                     if($value==$post_id){                         array_push($new_search_array,$post_id);                     }                 }             }             //ELSE IF SEARCH DOESN'T EXIST, JUST DO LOCATION SEARCH             else{             echo $row['post_title'];             }         }         }              //IF SEARCH TERM DID EXIST AND LOCATION TERM DID EXIST, NEW SEARCH ARRAY INITIALIZED AND WE USE THAT TO DISPLAY RESULTS             if($new_search_array){             foreach($new_search_array as $value){                 get_the_title($value);             }         }         else if($search_array){         foreach($search_array as $value){             get_the_title($value);         }     }     ?>
          <?php     get_footer();     ?>


title: How to exclude posts ordered by comment_count from subsequent wordpress loops using WP_Query?

text:
My page has three separate loops on it. The first retrieves the most commented post. The query then resets for the second loop and retrieves the 3 most recent posts, then resets again to get the three most recents posts after that. What I want is for the post that has the most comments to a) only be chosen from the last 24 hours and b) to be excluded from showing up in the 2nd and 3rd queries to prevent duplicate posts showing up. How would I achieve this?                <?php get_header(); ?>

                                  <?php                                   $args = array(                             'posts_per_page' => 1,                             'orderby' => 'comment_count'                                       );                                  $the_query = new WP_Query( $args );                                  ?>                                  <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                                      <a href="<?php the_permalink();?>">
<?php the_title(); ?>

Published on <?php the_date(); ?> by <a href="<?php echo the_permalink();?>"><?php the_author(); ?><a href="<?php the_permalink();?>"> <?php comments_number(); ?>
                                      <?php the_excerpt(); ?>                                  <?php endwhile; else: ?>                                       <?php endif; ?>                                  <?php wp_reset_postdata(); ?>
                                       <?php                                   $args = array(                             'posts_per_page' => 3,                             'orderby' => 'most_recent'                             );                                  $the_query = new WP_Query( $args );                                  ?>
                                  <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                                      <a href="<?php the_permalink();?>">
<?php the_title(); ?>

Published on <?php the_date(); ?> by <a href="<?php echo the_permalink();?>"><?php the_author(); ?>
                                 <?php the_excerpt(); ?>                                  <?php endwhile; else: ?>                                  <?php endif; ?>                                            <?php wp_reset_postdata(); ?>
                                  <?php                                   $exclude = $most_recent;                                       $args = array(                             'posts_per_page' => 3,                             'orderby' => 'most_recent',                             'offset'  => 3                             );                                  $the_query = new WP_Query( $args );                                  ?>
                                  <?php if ( have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>                                      <a href="<?php the_permalink();?>">
<?php the_title(); ?>

Published on <?php the_date(); ?> by <a href="<?php echo the_permalink();?>"><?php the_author(); ?>
                                 <?php the_excerpt(); ?>                                  <?php endwhile; else: ?>                                  <?php endif; ?>                                  <?php wp_reset_postdata(); ?>

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