title: Admin user getting redirected to /wp-admin/user

text: I recently added a network to my multi-network wordpress install (that is, a single install with multiple subdomain networks, each with multiple subdirectory sites). Although everything appears normal on the new site from the front end and network admin view, any users I add to the site automatically get redirected to `/wp-admin/user` upon login. This shows only the WordPress news widget and the Profile menu. If I manually navigate back to `/wp-admin`, the full dashboard becomes available, but the redirect is unacceptably inconvenient and hard to diagnose. A few details that are unique and likely relevant:   * When creating the new subdomain, I first created a blog on an existing network, then manually went in and modified `wp_sites` and `wp_blogs` to promote it to its own subdomain   * I recently upgraded to 3.9.2   * This only affects the new subdomain. All existing sites and networks are fine (ruling out plugin conflicts or a botched upgrade in my eyes) I am relatively certain this problem is probably just one or two database rows away from a fix, but laboriously comparing the values of `wp_sitemeta` and `wp_*_options` for a working network to this one reveals nothing different.


title: Querying multiple values from a single key

text: Bainternet assisted me earler with the relation AND parameter. What I need to do now is determine how to query multiple vales from a single key. If I try to specify two arrays with the **same key** the query fails. Is there a way to use an array in the value?Something similar to.               'value' => array( 'Install Manual', 'User Manual' ),      I've searched quite a bit with no results. This is where I'm at so far.               $documents = array(         'post_type' => 'documents',         'meta_query' => array(         'relation' => 'AND',             array(                 'key' => 'document-type',                 'value' => array( 'Install Manual', 'User Manual' ),             ),            array(                 'key' => 'document-status',                 'value' => 'current',             )         )     );     query_posts( $documents );     get_template_part( 'loop', 'documents' );     wp_reset_query();


title: Unable to browser posts in categories

text: Hoping someone can help with this. Clicking on a category either returns a "not found" error, or opens a random post in the category. Verified that the issue is independent of a plugin or theme. Have also messed with .htaccess to no avail. Only works if I use the default permalink structure, which I do not want. See these links to see the problem firsthand: http://www.linuxbsdos.com/category/tutorialstips/ http://linuxbsdos.com/category/mandriva/ TIA


title: How to make open/closed and hidden/shown metaboxes status saved on a per-post basis?

text: My real problem is a bit complex, so I'll try here to abstract it and keep it simple. I'm working on a custom app based on WordPress. I registered a custom post type, let's call it "people" where I store information about... people. The CPT supports only post title and post content default fields, but there are some metaboxes to store person informations (think my app as an address book). So there is a metabox to store personal info, one to store social networks info, another to store work-related info, i.e. if that person is to me a customer, a supplier, if we have credits or debits... I simplified here, but there are a consistent amount of metaboxes, let's say 12. My problem is that, some people for which I want to store info are just random contacts, and I want to store only personal info, other are friends and I want to store personal info and social networks info, other are customers or suppliers and I want to store work-related info. If when editing a post I hide (via screen option menu) or close any metabox I don't need, when I open another post where I need them I have to show or open them again. That **because metaboxes position/status/order are saved on per- user basis as user metadata**. If you imagine in some posts I need 2 metaboxes, in some 10 and in some 5, you understand that's annoying because keeping all them shown/open make the edit screen low accessible (scrollbar seems endless), and sometimes the info I look for is at the end of the page after a bunch of metaboxes with no info... **Question:** Is possible to save metaboxes position/status/order on a per-post basis for a specific post type? * * * _PS: I know some js/jQuery can solve the issue, but if possible I would avoid javascript solutions._


title: Querying posts by latitude and longitude to build a Google Maps with several markers

text: I have 4 different post types and 4 differey taxonomies Each term for each taxonomy stores a marker (url to a png icon). Each post has coordinates attached with Advanced Custom Fields and I'll probably use Geo Data Store to optimise scalability.   * a) how would you ideally query for the posts which fall under a specified km radius by lat and lng with Wordpress? I'd like to avoid, if possible, direct db queries.    * b) I'm going to store coordinates in a different table with Geo Data Store. But how about markers? Is it a good idea to store the icon/marker url of each term in a meta field for these terms?   * c) in general, what do you think would be the best practice to approach the project outlined above? I'd like to avoid to use further plugins (except for ACF) Thanks in advance for all your advices.


**Can't get options with $data['variable'].** _(I'm use SMOF - Slightly Modded Options Framework)_ For example in the header.php (index.php, footer.php, etc.):               global $data;     $logo_type = stripslashes( $data['type_logo'] );      and nothing happens, variable `$logo_type` contains nothing. But if I use the same code in the \css\styles.php - all works fine. Code from \css\styles.php:               <?php           /* Background Body */      $bg_color = stripslashes ( $data['ct_bg_color'] );          ?>          /* Body BG Color */      body, .body-class { background-color: <?php echo $bg_color; ?>      }      Function as part of framework :               /*-----------------------------------------------------------------------------------*/     /* Generate a static css file from the defined options     /*-----------------------------------------------------------------------------------*/     // This function will generate a static css file which you can use in your theme.     // Some examples of the dynamically generated options has been defined in css/styles.php     function generate_options_css($newdata) {              $data = $newdata;            $css_dir = get_stylesheet_directory() . '/css/'; // Shorten code, save 1 call         ob_start(); // Capture all output (output buffering)              require($css_dir . 'styles.php'); // Generate CSS              $css = ob_get_clean(); // Get generated CSS (output buffering)         file_put_contents($css_dir . 'options.css', $css, LOCK_EX); // Save it          }      Link to Framework files: https://github.com/sy4mil/Options- Framework/tree/master/admin/functions First encountered this problem... And can not understand what could be the problem (php, web hosting, etc.) Anyone else encountered this problem?


title: Customize Wordpress Media Upload and New Media Manager Menu in add post Metabox

text: I am using Wordpress Media Upload (< 3.5) and Media Manager (>=3.5) in metabox as an upload field, and need to customize the menu so that they only have upload and media library functionality without "From URL"/"Insert From URL" and "Create Gallery". So I need to remove them. I can't use Wordpress filter such as mentioned in this solution, since I am using it in metabox, which is exists in Wordpress new post page that already has "add media" functionality and will be broken if I use such filter. Is there any solutions via Javascript or any other methods? Thanks in advance.


title: Allow admin roles to add images to comment replies

text: this may be a step too far but I publish occasional tutorials on my personal blog and sometimes in comments get asked questions where an image would be very helpful to include as the answer. I've done a plug-in search and also looked for code but come up with nothing. Is there any way I can allow those with Admin role to upload an image as part of their reply to a comment? I don't want to allow readers to upload images really. Also I'm not really looking to add a link to an image in the reply, I'd ideally like it in the comment reply itself. Just a 'too difficult' or 'can't be done' response would put me out of my misery :-)


title: wp enqueue inline script due to dependancies

text: Is there a way to use wp_enqueue_script() for inline scripts? I'm doing this because my inline script depends on another script and i would like the flexibility of inserting it after it's loaded. Also, It's an inline script because i'm passing php variables into the javascript (like theme path, etc) Thanks in advance.


title: Is there a way to check which template file is being loaded, if it is not a page template file?

text: I don't see any way of testing which template file is being loaded, if the template file is not a page template. Otherwise I would use is_page_template(). For instance, I am using a home.php template file to pull in the content from multiple pages(don't ask), how would I check that home.php is the template file being used when viewing the sites root url?


title: change standrad postformat metabox

text: i add meta box to my theme (wordpress admin) for video , image , gallery , chat but i cant add meta box for standard post when i create post format support standard then i see in admin standard post format is duplicated and when select standard 2 i see meta box is added i want to add meta xob please help me thank you ! ![enter image description here](http://i.stack.imgur.com/dqRRf.png)


title: user_can() not working for comment authors

text: I'm trying to do some capability checks on comment authors using the user_can() function, but for some reason it isn't working at all. I have a custom capability setup with the Role Manager plugin called "read_citizen". My check looks like this:               if(user_can($commentAuthor->user_id, 'read_citizen') {        //do stuff here     }      I have confirmed that the $commentAuthor object is set correctly. Ideas?


title: Can you host WordPress using Amazon Web Services such as EC2, RDS, EBS etc?

text: I've been looking into the feasibility of using something like Amazon Web Services for hosting WordPress sites. I was wondering if it was possible and if so what are people's experiences of having done so and what aspects of AWS did you use?


title: How much should I charge for creating a WordPress plugin?

text: How much should I charge for creating a custom WordPress plugin? (working as a freelancer)


title: Thesis -style Navigation

text: I am working on a theme where I would like users to be able to select pages to show in the theme options page much like Thesis. I've been Googling / reverse engineering Thesis for a couple hours but haven't found a great solution. I am wondering if anyone has done this or has seen a tutorial. ![alt text](http://i.stack.imgur.com/5Fu7o.png)


title: Disable dragging of meta boxes?

text: Anyone know how to disable this functionality so the meta boxes can't be repositioned?


title: Commentform input area issue

text: This is probably really simple, but I just can't figure it out. So I change the input form on my comment form php. The changed snipped looks like this: http://pastebin.com/3Mj1XHGJ Yet when somebody doesn't click on "Website" at all, still a "http://Website" link will be generated for some. Is there any way to make it so that there won't be any url display if they haven't inserted a website url at all? Right now only when I click on the "Website input" textarea and make the "Website" text actually disappear it works. (The following is just a side question and I'm also not sure if it's okay to ask this, so you might as well ignore this): I also wanted to insert little icons in front of the text (before Website, Mail etc.) I know how to do it (just as background image using the stylesheet), but I'm already using a background image and I was wondering if there's another way round as using two background images won't work. Probably I have to rewrite the comment.php a bit instead, but I don't think it's possible to insert a "img src" into the input command? My website is here. Thanks a lot in advance! :D


title: set a chosen image-file-input as a featured image from wp frontend

text: **SCENARIO** : I allow to create posts from front-end. The form also has four image upload fields. I use the code pasted below for image attachments and setting the post thumbnail.               //insert attachments         if ($_FILES) {         foreach ($_FILES as $file => $array) {             $newupload = insert_attachment($file,$pid);             }             }                 //attachment helper function         function insert_attachment($file_handler,$post_id,$setthumb='false') {         if ($_FILES[$file_handler]['error'] !== UPLOAD_ERR_OK){ return __return_false();              }              require_once(ABSPATH . "wp-admin" . '/includes/image.php');             require_once(ABSPATH . "wp-admin" . '/includes/file.php');             require_once(ABSPATH . "wp-admin" . '/includes/media.php');                  $attach_id = media_handle_upload( $file_handler, $post_id );             //set post thumbnail             if ($setthumb) update_post_meta($post_id,'_thumbnail_id',$attach_id);             return $attach_id;                 }      The post-thumbnail/featured image that is set through this code is the **LAST** image that is uploaded. I tried a google search for "set post thumbnail from frontend wordpress" and grazed through a lot of articles but none came close to what I am asking here. Majority of threads I came across at SE in regards to front-end posting, either talks about setting the featured image or about multiple uploads. I have also checked all the suggested questions which were prompted, while I was writing this question just to make sure if it has been asked before.' If it matters, here is the html that is used in the form, pretty standard.               <input type="file" name="image-one" id="image-one"/>     <input type="file" name="image-two" id="image-two"/>     <input type="file" name="image-three" id="image-three"/>      **REQUEST** : It would be great if I could get a solution that helps to assign any chosen image-input-field as a featured-image but at this moment, at least what I need to set the **FIRST** image input to be set as a featured- image/post-thumbnail. Kindly suggest a solution. > Bottomline here is that I do not have an issue with setting post-thumbnail > but question is about having a choice to choose any of the uploaded images > as post-thumbnail or at least the first image, instead of the last image as > set by the current code. Footnote : I have just put here what came to my mind as necessary. If you want some more information, please let me know. Thanks in advance.


title: How to get_queried_object on multiple objects?

text: **My Setup** I have a custom post type "zap_apartments" with 2 custom taxonomies "zap_audience" & "zap_cities". I wrote some RewriteRules to access all "zap_apartments" for a "zap_audience" + "zap_cities" assigned. It is to filter the results with seo-friendly URLs: it makes a request like `my-url.de/holiday/cologne/` internally an url like `my- url.de/index.php?post_type=zap_apartments&zap_audience=holiday&zap_cities=cologne` **My Problem** When I try to access the taxonomy information on the custom archive page I only get 1 taxonomy returned:               print_r( get_queried_object() );      prints:               stdClass Object     (         [term_id] => 17         [name] => Cologne         [slug] => cologne         [term_group] => 0         [term_taxonomy_id] => 17         [taxonomy] => zap_cities         [description] =>          [parent] => 0         [count] => 2         [filter] => raw     )      Is there any way I can get the other assigned taxonomy "zap_audience" too? I already asked google, but couldn't find anything useful. I also tried to access any value by `$_GET['zap_audience']` but it's empty. Please help! Thank you!


title: How does printf( __( ) ); work?

text: Today I work through a theme to get a better understanding of WordPress and templating. I discovered this:               <?php      printf(          __('Designed by %s', 'Anyword'),          'Blub'     );      ?>      I know it shows "Designed by Blub" (Where Blub is linked) But what does the `__()` mean or why is there a string insert? What for is the Anyword? Can someone exactly explain this line for me?


title: Strange widget behavior

text:
I've created widget by simple copying one of the default widgets class and modifying it.   The strange thing is in the widgets admin area, this widget is not shown. When I searched the page source code the widget was there but it had inline style `display:none;`.   The other weird thing is that the title filed is not shown either!   Here is my widget code:               /**      * Mood widget class      *     **/     class WP_Widget_Mood extends WP_Widget {              function __construct() {             $widget_ops = array('classname' => 'widget_mood', 'description' => __( "Mood widget") );             parent::__construct('mood', __('Mood'), $widget_ops);         }              function widget($args, $instance){             extract($args);             $title = apply_filters('widget_title', empty($instance['title']) ? 'Mood' : $instance['title'], $instance, $this->id_base );                   $user_id = get_current_user_id();                  $table_name = $wpdb->prefix . "mood";                  $get_same=$wpdb->get_row("SELECT * FROM $table_name where user_id='".$user_id."' order by id desc");             $get_mood_row = mysql_query("select * from wp_mood where user_id='".$user_id."' and mood='".$get_same->mood."'");             $pathredirect = get_bloginfo('url').'/m/'.$current_user->user_nicename.'/settings/mood/';             global $current_user;             $current_user = wp_get_current_user();                  ?>
<?php echo $title; ?>

Make

<a href="<?php echo $pathredirect;?>">Setting

                         <?php                             //echo "select * from wp_mood where user_id!='".$user_id."' and mood='".$get_same->mood."'";                             $res_mood = mysql_query("select * from wp_mood where user_id='".$user_id."' and mood='".$get_same->mood."'");                             $ii=0;                             while($result_mood = mysql_fetch_array($res_mood)){                                 $ii++;                                 $uuserid = $result_mood['user_id'];                                 $user_info = get_userdata($uuserid);                                 ?>
                                     <a href="<?php echo bloginfo('url');?>/m/<?php echo $current_user->user_nicename; ?>/profile">                                         <img title="<?php echo $result_mood['nikename'];?>" src="<?php echo bloginfo('url').'/wp-content/uploads/mood/'.$result_mood['image'];?>" /><?php echo $result_mood['nikename'];?>
                              <?php } ?>

             <?php         }              function form( $instance ) {             $instance = wp_parse_args( (array) $instance, array( 'title' => '') );             $title = $instance['title'];     ?>
<label for="<?php echo $this->get_field_id('title'); ?>"><?php _e('Title:'); ?> <input class="widefat" id="<?php echo $this->get_field_id('title'); ?>" name="<?php echo $this->get_field_name('title'); ?>" type="text" value="<?php echo esc_attr($title); ?>" />
     <?php         }              function update( $new_instance, $old_instance ) {             $instance = $old_instance;             $new_instance = wp_parse_args((array) $new_instance, array( 'title' => ''));             $instance['title'] = strip_tags($new_instance['title']);             return $instance;         }          }     function mytheme_register_widgets()         register_widget( 'WP_Widget_Mood' );     }          add_action( 'widgets_init', 'mytheme_register_widgets' );


title: Is it safe to use 'date_default_timezone_set' in plugin file?

text: I am using a sitemaps plugin which in very complex ways sets the timezone of `<lastmod>` (i.e. last modified time) for posts to GMT. Temporarily, until the plugin developer fixes it, I need to enforce a custom timezone _on the plugin_. The simple and straightforward way that I've found is to add something like `date_default_timezone_set( 'America/New_York');` right after the first `<?php` in the file responsible for outputting the sitemaps. It works, and it doesn't seem to affect timestamps displayed on the rest of the site. So, can I go with this? or is there a better solution?


title: get post by nav id

text: I am trying to get the post id by the navigation id to use in a loop. I made a new query to get posts. I am using multiple queries on a page because I need to. one of the queries gets page templates that have categories that you make a post to and it gets displayed by that template. My problem is that if I put in the query to get posts, then I end up with the data in the theme twice. So I want to make it so that only a post that has a navigation link will be displayed. It will still be able to link to the post but I only want the query to get a post that has a nav item. Every time I try, all I end up with is a bunch of this                bool(true)      The functions I have read about, some from this site aren't working the way I understand they should. I have taken code straight out of the codex and it comes up empty http://codex.wordpress.org/Function_Reference/wp_get_nav_menu_items                               $menu_name = 'primary';          if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {     $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );          $menu_items = wp_get_nav_menu_items($menu->term_id);     echo $menu_items->ID;      My attempts have returned nothing.


title: Trying to Display wp_nav_menu(); dynamically in WordPress?

text:
I am trying to display / show WordPress Menu dynamically like this image ![enter image description here](http://i.stack.imgur.com/nP8sg.jpg) try this code. it shows result but not exactly what i want. i need exactly like image, in image i have Menu name ABOUT US and right below it has WHO WE ARE, i am stuck to call WHO WE ARE and also DROPDOWN help needed. THANKS               $defaults = array(         'theme_location'  => '',         'menu'            => '',         'container'       => 'div',         'container_class' => 'top-menu',         'container_id'    => '',         'menu_class'      => 'sf-menu sf-js-enabled',         'menu_id'         => '',         'echo'            => true,         'fallback_cb'     => 'wp_page_menu',         'before'          => '',         'after'           => '',         'link_before'     => '',         'link_after'      => '',         'items_wrap'      => '
%3$s
',         'depth'           => 0,         'walker'          => ''     );          wp_nav_menu( $defaults );          ?>      here is my HTML code

HomeMain Homepage

About UsWho We Are

Alternate Homepage

Full Width Page

Blog Single Page

ServicesWhat We do

Web Designing

HTML / CSS Coding

Designing

Graphics

SEO Marketing

 PortfolioOur Works

Websites

Logos

Prints

 BlogOur Community

Blog Single Page

 Contact UsLocation Info

      i need menus like image thanks.


title: Retrieve New user's ID

text: I'm trying to retrieve the user id of a new user as soon as they're created. I tried using the hook "user_register" but there appears to be no id in there...maybe it grabs the data before a userID is created? Anyway, if anyone could recommend a hook that would serve this purpose, I'd appreciated. Many thanks!


title: Sell one unique item with Woocommerce?

text: I would like to sell drawings and paintings using Woocommerce. Woocommerce is expecting that there are more copies of each product, but the problem is there is only one (1) of each drawing/painting. How can I create in Woocommerce a unique product? So after this product is sold, processed and completed it is shown as 'sold out'. Can this be solved with a piece of code? Or does anyone know about a plugin? I wasn’t able to find anything. Please help an artist!


title: How to change default image rename?

text: When i upload image with same name Wordpress automatically adds the number before the extension like `some_name1.jpg`. Is it possible to change this process that id also added a bottom line like `soma_name_1.jpg`


title: Filter EVERY category link with my plugin

text: Im writing a plugin to let users customize the colors of their category links. But in order to make this work, Ive gotta figure out a way to target all category links regardless of theme. So clearly I can't go after classes so I was thinking I could write a filter to het all category links. I was thinking this would work:               add_filter('category_link ','kjd_filter_category_links');     function kjd_filter_category_links($id){         die();     }      But it doenst look like the function is ever called. I just tried dropping that into my functions file as well but its not working there either.


title: Custom Post Conditional for Parent & Child Single.php?

text: Following on from previous question but needs to be more specific so thought a new topic would be best... Conditional tag for custom post parent and children on their corresponding single.php, currently i have the following..                   <?php if ( is_home() || is_page( 'overview' ) || is_page( 'about' )  ) : ?>             Home Page         <?php elseif ( 'artists' == get_post_type() ): ?>             artist parent                        <?php elseif ( $post->post_parent > 0 ): ?>           artist   child         <?php else : ?>          empty other pages etc             <?php endif; ?>      The issue being the parent shows up on all the single-artists.php pages. I need to specifically target the parent single and the child single, is it possible as i don’t think it is...? Thank you.


title: Target edit post content with plugin

text: I am writing a plugin that adds an extra metabox onto the edit post dashboard page. In this metabox is a button which when clicked will scan the content of the post to check for certain words and then display an icon in the metabox to indicate the result. I have the scanning routine itself doen bu how would I go about targeting the content to be scanned? I am aware that the content may not have even been saved yet either which could present further issues Can anyone help or have an example they can point me in the right direction of?


title: Including file or library from other plugin

text: I'm creating a plugin I would like to use from other different plugins. This plugin declares classes and functions. So, I am thinking about the best way to include, from one plugin, a php file present in _another_ plugin. I think this should work:               require_once WP_PLUGIN_DIR . "/the-other-plugin/required-file.php";      But I am not sure; is it a good solution? I think this would work even if `the-other-plugin` is not enabled, and probably that is not a good idea. This can be done also by using Must Use Plugins. Is this a best practice, or is the other solution better?


title: Transients API conditional

text: I have the following transient, but if the user changes the value of $url the transient should not be used. I want to know what is the most appropriate way to use this variable with the transient. Should I save the value of $url with Options API to compare it with the new value?               if ( false === ( $videos_result = get_transient( 'html' ) )){         //HTTP API         $videos_result = wp_remote_get( $url );              $response_code = wp_remote_retrieve_response_code( $videos_result );         $response_message = wp_remote_retrieve_response_message( $videos_result );         set_transient('html', $videos_result, HOUR_IN_SECONDS );     } else{         $response_code = 200;     }


title: How to save data of an input field to an array

text:
I'm writing a plugin to edit my profile page. How can I save data of an input field to the database and then display it? This is my code. The first part is the display in HTML:               <form method ="POST">
             <input type='text' name='group[]' id='group[]' class="regular-text"                 value="<?php echo esc_attr( get_the_author_meta( 'group', $user->ID ) ); ?>" />                  <input type="button" class="button-primary" value="Add"                 onClick="addInput('dynamic_input_groups');">
     </form>      And the second part is the script for the button click and the input field:                     And the final part saves the data to the database:               update_usermeta( $user_id, 'group', $_POST['group'] );


title: The offset option breaks the pagination

text: I have a problem with a website of mine, I was hoping you can help me. I added the offset option to ignore the first couple of posts in the main loop. It does its job, but the navigation got broken. When navigating through older pages (2nd page, 3rd page etc), no matter what page I am on, I always get the first page posts. This is the code I edited:               <?php query_posts("cat=-27,-28&paged=$page&posts_per_page=10&offset=5"); ?>      Can you please let me know how to fix this? Thanks a lot!


title: How to disable 3.1 "Admin Bar" via script for the admin user?

text: Every time I create a new site under 3.1, my first trip is to the Users > Admin User profile page to uncheck the "admin bar" checkbox. I'd like to place a script in my theme's functions.php to do this automatically. Anyone know what that would be?


title: WordPress CSS doesn't update

text: I've got a new WordPress website that I'm testing that hasn't been updating properly when CSS styles are updated over FTP. I haven't got a cache plugin and I have cleared my browser cache and have tried a different browser. The changes I make are definitely being uploaded to style.css as I have downloaded it and checked it on a web FTP site. I can tell the code is not wrong because I have copied it to a new file, included it in header.php and it has changed. Also, when I delete style.css, the styles on the page do not change. I've checked my HTML a hundred times and I'm not including other stylesheets and making huge obvious changes to styles doesn't do anything either.


title: Installing multisite network admin on sub-domain

text: I was searching the Net and also playing around Wordpress to achieve my desired multisite installation, but I wasn't successful yet. What I want to do is to have the network admin site installed on a sub-domain like `www.example.com` (not `example.com`) and other sites in the network on sub- domains like `client.example.com` (not `client.www.example.com`). Is there any way to make it possible!? Important Note: I want to map `example.com` to a different server with different IP than `www.example.com` and the rest of sites. Also, I don't want to map each sub site address by hand. I want it to be automatic. Server specification: I use nginx + php-fpm + fastcgi + centos 5.9.


title: How to pull in photos from an RSS feed on another wordpress.com site

text: I'm creating a "portal" (wordpress.org) site and I want to pull in some photos from a related wordpress.com blog site. There is a cartoon on each blog post and I want to display the latest one in my portal site. I've tried using using wordpress's standard RSS widget but it only pulls in the article title, no image. I don't want to have to go to the other site to see the image. How can this be done? Thanks! Corinne


title: different post-class when template is loaded via ajax

text:
my **event-item.php**               <?php     /**      * The event template      */      ?>
         <article id="event-<?php the_ID(); ?>" <?php echo event_canceled($post) ? post_class('wrapper canceled') : post_class('wrapper'); ?>>      This leads to this …
      However when loading this event-item.php template via ajax the custom-post- type class of `wr_event` is not added. Anyone an idea why that could happen or what could lead to it? **Update:** Ajax:               $.get(         ajax.url,          {             'action': 'get_event_list',             'order' : 'DSC',         },          function( response, status ) {             $('ul.event-items').append(response);             }     );      **functions.php**               add_action('wp_enqueue_scripts', 'theme_name_scripts');          function theme_name_scripts() {              wp_enqueue_script( 'script-name', get_bloginfo('stylesheet_directory') . '/js/min.js', array(), '1.0.0', false );         wp_localize_script( 'script-name', 'ajax', array( 'url' => admin_url( 'admin-ajax.php' ) ) );     }          add_action('wp_ajax_get_event_list', 'get_event_list');     add_action('wp_ajax_nopriv_get_event_list', 'get_event_list');          function get_event_list( $latest = true, $order = 'ASC', $return = false, $year = NULL, $cat = '' ) {      Now I got rid of my tag that embeds my script in the header.php file. The admin-ajax and the embeded script works however doesn't change anything at the behaviour, still no `wr_event` in the post-class.


title: Implement phpunit testing on a plugin

text: I've just finished writing a WordPress plugin implementing shortcode tag based autocompletion based on values retrieved from a database given an id set on a cookie. The plugin has a variety of combinations of possible scenarios, based on parameters such as: whether or not to display matched fields whether to limit (matched or not) fields to be displayed to a certain maximum whether to show a particular set of fields under any circumstances, if matched As simple as it seems it's giving me a considerable headache (and taking a considerable amount of time) to test all scenarios after every revision. My contractor is also a little pissed off of the constant regressions and missed bugs he is finding on my code as the project gets bigger. So, my question is quite simple: What would be the best approach for designing PHP unit tests for a plugin implementing shortcode tags in WordPress? My best idea is to write a set of posts containing the test cases and use file_get_contents($posturl) to compare the expected content output with the actual output but there has to be a better way. Any ideas?


title: wordpress shortcode A executing code from shortcode B

text: I am having a problem with wordpress. I have created some shortcodes in wordpress. None of them use hyphens as suggested by the wordpress codex. One is for validating a user email (just a success or fail) in which in case of success, I add this e-mail address to a mailchimp mailing list. Antother is just to test mailchimp subscription functionality. Problem is that when the user validation page is executed it always fires the mail no matter what. If I remove the shortcode in the test page, this stops. I am really puzzled. Here is the full code: http://pastebin.com/7wHwxc5q


title: Developing plugin, where to place action hooks etc?

text: I am dividing my plugin code into multiple files and functions. When I have a function and straight after it an action hook, or for example add_shortcode, should that line go straight after the function or in a plugin init function? As an example, should I have something like this:               // Shortcodes.php file            function myplugin_shortcode( $atts ) {             if ( !empty ($atts) ) {             foreach ( $atts as $key => &$val ) {                 $val = html_entity_decode($val);             }         }         myplugin_display_items( $atts );            }          // Register shortcodes     add_shortcode( 'output-items', 'myplugin_shortcode');      OR a combination of the following two:               // Shortcodes.php file            function myplugin_shortcode( $atts ) {             if ( !empty ($atts) ) {             foreach ( $atts as $key => &$val ) {                 $val = html_entity_decode($val);             }         }         myplugin_display_items( $atts );            }      and               // Myplugin.php file     myplugin_init() {                // other initialisation code           add_shortcode( 'output-items', 'myplugin_shortcode');     }


title: How to get the post id from a permalink?

text: How can I get the post id from a permalink like "http://localhost/wordpress/animals/cat" in functions.php, I have tried url_to_postid() and get_page_by_path() but none seem to work.


title: Selecting New & Edit Page for Custom Post Types

text: I'm probably missing something unless it's really not possible, for some reason I can't get my function to only execute on the **new** and **edit** page of a custom post type (the new not being a problem): I'm currently using:               if ((isset($_GET['post_type']) && $_GET['post_type'] == 'events') || (isset($post_type) && $post_type == 'tf_events')) {         add_action('admin_init', "admin_head");     }      However this only works for **adding a new post** where the URL is:               /post-new.php?post_type=events      But for editing a post it doesn't work, where the URL is:               /post.php?post=12&action=edit      (although the post type isn't added to the link attribute) **WORKING CODE (See Mark's response below):**               // 7. JS Datepicker UI          function events_styles() {         global $post_type;         if( 'tf_events' != $post_type )             return;         wp_enqueue_style('ui-datepicker', get_bloginfo('template_url') . '/css/jquery-ui-1.8.9.custom.css');     }          function events_scripts() {         global $post_type;         if( 'tf_events' != $post_type )             return;         wp_deregister_script('jquery-ui-core');         wp_enqueue_script('jquery-ui', get_bloginfo('template_url') . '/js/jquery-ui-1.8.9.custom.min.js', array('jquery'));         wp_enqueue_script('ui-datepicker', get_bloginfo('template_url') . '/js/jquery.ui.datepicker.min.js');         wp_enqueue_script('custom_script', get_bloginfo('template_url').'/js/pubforce-admin.js', array('jquery'));     }          add_action( 'admin_print_styles-post.php', 'events_styles', 1000 );     add_action( 'admin_print_styles-post-new.php', 'events_styles', 1000 );          add_action( 'admin_print_scripts-post.php', 'events_scripts', 1000 );     add_action( 'admin_print_scripts-post-new.php', 'events_scripts', 1000 );


title: Janrain/Simple Modal under Redirected Domain

text: I have a wordpress site running on one domain that has the main 'client' domain for the site redirecting to it. I've got my Wordpress Address/Site Address entered correcting in Wordpress, and the .htaccess is formatted properly afaik. Everything else seems to work properly other than this issue. So I have Janrain Engage, SimpleModal Jainrain Engage and SimpleModal Login. Everything was working fine when we were building the site on the hosted domain. When it came time to switch the live sites and redirect the published URL to our host, things went all screwy. So, basically; If you go to www.publishedurl.com and attempt to login with your Wordpress user/pass the loggin in progress bar appears and just hangs indefinitely. If you try and loging with your Facebook ID it appears to successfully log you in, but on www.publishedurl.com it shows you as not logged in. If you then go to www.backendurel.com/wordpressinstall/ it will show you logged in with Facebook -- and back there, if you attempt to log-in, that works fine as well. I've updated Wordpress and the plugins, I've scoured the wp_options table in the database for a setting that might be wrong. I completely uninstalled and reinstalled everything, created new Jainrain and Facebook widgets. ATM I have the files and folders of all 3 plugins set to 775 permission. We also use Mingle and a few other widgets that block users from viewing the WP backend daskboard and allow front-end posting. PS. Actually, during the course of this whole re-install I've now broken everything at the www.backendurl.com/wordpressinstall... same action... endless "loggin in" progress bar... had to pull the php redirect off my wp- login page... ugg.. help please! =D


title: How to use Disqus for some categories, and FB comments for others?

text: I didn't find anything related to what i'm trying to do. My WP blog have several categories. For one specific category, in which I publish short news and viral content, I'd like to use Facebook comments as the default commenting system. For any other categories, i'd like to keep using Disqus as usual. My problem : since Disqus is taking over with a hook (I guess), how can I have Facebook comments take over instead of Disqus if in_category(x) ? Where would that happen, and how would you do ? (Ideally, i'd like to deal with it in functions.php instead of having to edit core Disqus plugin files)


title: How to use the widget area to extend the page content?

text: I want to remove a widget area (lateral), and extend the page width getting this area. What is the better way to do it?


title: WP_Query, custom sort and custom filter

text: Is it possible using WP_Query to return a filtered list of items based on the following criteria set? I seem to be struggling as there are numerous queries against custom fields.               Select all posts that are of type business_club (post_type)     Where the post has a zone of 'Asia' (meta_value)     Order by country ASC (meta_value)     then by town ASC (meta_value)     then by title (wp value)      Any help is greatly appreciated.


title: Wordpress remove filter wpautop not working

text: i have a trouble. I tried to use too many plugins and funciont and also               remove_filter( 'the_content', 'wpautop' );      but it is not working. I've added a shortcode into a text widget but wordpress add always tags p. Why??


title: is user logged in not working

text: I am creating a plugin and wish to check if the user is logged in the run another function. This is my first ever plugin and i am still learning how to program at the same time. following I have a simple user conditional, if user is logged in and i am also retrieving data from an array to check if the admin has checked Yes in the plugin options to check for user logged in then execute another function. however I am getting an error `Call to undefined function is_user_logged_in()` i think i may need to wrap my conditional in a function and then add an action, can someone please help me. thanks               /* Logged user conditionals */          $logged = get_option('lu_ban_data');          if ($logged['loggedU'] == 'loggedYes' && is_user_logged_in() ) {         lu_ban_detect();         } else {         return false;         }      **update** Okay I think i managed to get it to work               add_action( 'init', 'lu_user_logged' );     function lu_user_logged() {     $logged = get_option('lu_ban_data');     echo $logged;     if ($logged['loggedU'] == 'loggedYes' && is_user_logged_in() ) {         lu_ban_detect();         } else {         return false;         }     }      is this the proper way?


title: How to modify search.php to not show pages only show posts

text: I want to modify search.php so that it only shows posts and not pages. Can you help? Here is the loop in search.php:               <?php if (have_posts()) : ?>     <?php while(have_posts()): the_post(); ?>


title: Description of a sub-taxonomy

text: I am using this code to display description of a taxonomy.               <?php $my_taxonomy = 'institute'; $terms = wp_get_post_terms( $post->ID, $my_taxonomy ); echo term_description($terms[0]->term_id, $my_taxonomy); ?>      What to do if I want to show description of sub or even sub-taxonomy?


title: Are private posts visible to search engines?

text: I want to display a list of posts (deals) on homepage (and having a link to original deal on deal provider's site) but I don't want individual posts to be accessible by anyone even search engines. Is this possible? Can making such posts private work?


title: Hosting Requirements for a WordPress e-commerce site?

text: I can't seem to find out what level of hosting I'll require for a WordPress e-commerce website. (yes, I realise this will vary based upon a heap of factors but I'm looking for some ballpark ranges for each factor) I'm thinking about such plugins as WP e-Commerce, Shopp, etc... for instance all those mentioned in http://mashable.com/2011/06/16/wordpress-ecommerce- plugins/ ! (tips with direction there would be nice... but perhaps I just need to research more first, or maybe later create an entirely new question for that instead!) This isn't a massive store I'm talking about, I'm referring to the e-Commerce twin of your typical business brouchure site (the sort of thing which would easily be fine on your standard decent shared hosting provider if it was non- e-commerce). So just a handful of products, few dozen at the very most. So, should I go for a good shared host still (I've been using Hostgator for websites in the past) or go for a VPS? (and if VPS, what level of VPS?!) I'm quite sure a dedicated server is way over the top for what we need (plus I don't expect my client's budget would stretch that far, they're a non-profit). I'm just trying to get a handle on the starting point, for instance even when I look around with Zen Cart, Magneto, etc (which can be "integrated" with WordPress and would be the next step up) they don't seem to be clear with what is the minimum starting level for a small low traffic site. Although I'm sure it would be at least a VPS, and shared hosting is out of the question entirely! Thanks in advance! :-)


title: Get wp_title() from page ID into a variable

text: I'm pretty sure that it's not possible but can I get the result of `wp_title()` into a variable if I know post's ID? So, for instance I'm on a "blog" page and I want to have the title of "about" page in a variable (not in the `<title>` tag like in this questions: Setting title using wp_title filter).


title: Create a select drop down of available menus

text: I'm attempting to create a custom field on my page creation that allows a user to choose which menu to display on the page. Right now I have my custom meta field setup, but can't figure out how to make a drop down menu of the available menus. Is there a function that I could use and then for loop though? Thanks!


title: adding a numbers to a item from navigation menu

text: I search in Internet but i didn't find a good documented way how to add to item from menu a number , my current menu is like               Item1     Item2     Item3 ,      I'm calculating with WP_Query how many post for category i have , and within function to update a specific menu item like :               Item1(10)      Item2(5)      Item3(20)      Thank you a LOT ! :) i finded a solution , but i don't know how to filter by specific menu , location > function wpa_filter_nav_menu_objects( $items){ >   >   >     foreach( $items as $item ){ >   >         if( strtolower($item->title)=='sample page' ){ >             $item->title = $item->title.'(10)'; >         } >     } >     return $items; } add_filter( 'wp_nav_menu_objects', > 'wpa_filter_nav_menu_objects' ); >   menu i'm creating in admin panel , from Apperance > Menus Thank you again !


title: How to adjust found_posts so that it accounts for offset and pagination

text: So far this is the code I have in my index.php file:               <?php                   // Custom code to offset posts and setup pagination             $page = get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1;                  $ppp = get_option( 'posts_per_page' );                        if ( $page == 1 )                 $offset = 6;             else                 $offset = 6 + ( $page - 1 ) * $ppp;                  $args = array(               'posts_per_page' => $ppp,               'offset'     =>  $offset,             );             $offset_query = new WP_Query ( $args );          ?>      At this point everything works fine except that there is an extra page with no posts on the site. Apparently this occurs because found_posts doesn't account for offset and so found_posts thinks there are more posts and adds an extra page. So how would I deduct the offset from the found_posts value so that the extra page doesn't occur. Or, how would I just get rid of the extra page that is showing up.


title: Pricing Tables admin page capability

text: I'm creating a plugin that will allow to create Pricing Tables in a fast and easy way. But, I'm not sure what rule to use for capability. What would you use? Right now I'm using `edit_pages`:               add_submenu_page( 'tools.php', 'SMK Pricing Tables', 'SMK Pricing Tables', 'edit_pages', 'smk_pricing_tables', 'admin_page' );      Should I use `edit_theme_options` ?


title: Rewrites and Attachments

text: I'm currently working on a custom post type that has rewrite tags to allow for sub pages. e.g: showcases/project-name/media/ Media being the page. My problem is with attachments and media uploads, we currently have a front end that supports uploading images, the problem is media attachments require passing a post id for attaching it to the page, Because these pages are custom, I've no idea how to pass a post id for a page that to wordpress doesn't exist. Can anyone assist me with this? -Sythen


title: How to set a custom post type to have viewable future posts

text: I've setup a CPT to act the same ways as posts but used to post event details. Thing is that some of the posts are in the future and such have a future date set on them. Problem is that normal users cannot see these posts. So:   * How do I alter archive-events.php to list future posts too? Showing far future posts first and oldest posts last while maintaining pagination.   * How do I make it so that when a user clicks a future post they don't get a 404 page not found as the post is not technically published yet?


title: Mystique theme: widgets on sidebar falling under the page content

text: I'm using the default two columns layout of the Mystique theme.   If I insert widgets into the main sidebar from the dashboard, instead of being showed aside in the page, they fall under the post (even overlapping the comment box).   What am I doing wrong?


title: Wordpress is not displaying CSS file

text: I have a crazy problem happening and it is blowing my mind. I installed Wordpress on my Localhost and began developing. I modified the standard twenty twelve theme and add custom HTML and CSS to the whole site (4 or 5 pages.) The site shows up great on my local machine (Mac OSX - Safari 6.0.5, Firefox 23.0. Chrome 29.0). I transferred my site to my live host (under GoDaddy) and I migrated the database by dumping it and then importing it. Now I can pull my site up under both my localhost and by going to the live host URL and the site looks exactly like it should. However, when I crosscheck the CSS via sites like (browsershots.org and browserstack) the site look terrible. Its almost like the main style.css file is not being linked properly. These browser check sites shows the site in ruins on all operating systems and all browsers. Still though when I bring the site up on my personal machine it looks just as it should. My client pulled the site up from their machine and it looked in ruins, just as the css checking sites depicted it. I have cleared my browser cache thinking I may be reloading a cached version of the site (giving me false hope that it looks good) however it still appears just like it should while viewing the remote version through my local machine. Side note:All elements of the page appear to be loading fine. The menu bar is there. The text and content is there. It's just not styled. Does anyone have any idea what may be going on?


title: Comment form vaildation

text:
I've build a custom comments form which hooks onto the default `comment_form()` in twenty twelve child theme. Here is my code `functions.php`               function pietergoosen_custom_comment_fields($fields) {                          $commenter = wp_get_current_commenter();                     $req = get_option( 'require_name_email' );                     $aria_req = ( $req ? " aria-required='true'" : '' );                          $fields =  array(            'author' =>         '
' . __( 'Name', 'pietergoosen' ) .         ( $req ? '*' : '' ) . ' ' .         '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .         '" size="30"' . $aria_req . ' />
',            'email' =>         '
' . __( 'email', 'pietergoosen' ) .         ( $req ? '*' : '' ) . ' ' .         '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .         '" size="30"' . $aria_req . ' />
',            'verwysing' =>         '
' . __( 'Where did you hear about us', 'pietergoosen' ) . '' .         '<input id="verwysing" name="refer" type="text" value="' . esc_attr( $commenter['comment_author_refer'] ) .         '" size="30" />
',     );             return $fields;     }          add_filter('comment_form_default_fields','pietergoosen_custom_comment_fields');      This is the how I enqueue my jquery scrips in `functions.php` and also the jquey validation in `comment-validation.js`. It works fine without going to the default error page wordpress uses.               function pietergoosen_comments_validation() {     if(is_single() && comments_open() ) {          wp_enqueue_script('jqueryvalidate', get_stylesheet_directory_uri().'/js/jquery.validate.pack.js', array('jquery'));         wp_enqueue_script('commentvalidation', get_stylesheet_directory_uri().'/js/comment-validation.js', array('jquery','jqueryvalidate'));         }     }     add_action('wp_enqueue_scripts', 'pietergoosen_comments_validation');          jQuery(document).ready(function($) {     $('#commentform').validate({          rules: {       author: {         required: true,         minlength: 2       },            email: {         required: true,         email: true       },            comment: {         required: true,         minlength: 10       }     },          messages: {       author: "Please provide a valid name",       email: "Please provide a valid email",       comment: "Comments needs to be at least 20 characters"     },          errorElement: "div",     errorPlacement: function(error, element) {       element.before(error);     }          });     });      The problem is, I modified the code to include other customizations for the form as in here:                function pietergoosen_custom_comment_fields($args = array(), $post_id = null) {             if ( null === $post_id )                     $post_id = get_the_ID();             else                     $id = $post_id;                  $commenter = wp_get_current_commenter();             $user = wp_get_current_user();             $user_identity = $user->exists() ? $user->display_name : '';                  $req      = get_option( 'require_name_email' );             $aria_req = ( $req ? " aria-required='true'" : '' );             $html5    = isset( $args['format'] ) && 'html5' === $args['format'];                     $fields =  array(                          'author' =>                     '
' . __( 'Name', 'pietergoosen' ) .                     ( $req ? '*' : '' ) . ' ' .                     '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) .                     '" size="30"' . $aria_req . ' />
',                          'email' =>                     '
' . __( 'email', 'pietergoosen' ) .                     ( $req ? '*' : '' ) . ' ' .                     '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) .                     '" size="30"' . $aria_req . ' />
',                          'verwysing' =>                     '
' . __( 'Where did you hear about us', 'pietergoosen' ) . '' .                     '<input id="refer" name="refer" type="text" value="' . esc_attr( $commenter['comment_author_refer'] ) .                     '" size="30" />
',     );                  $required_text = sprintf( ' ' . __('Fields marked %s are required and must be filled in'), '*' );                  $arg = array(                     'fields'               => apply_filters( 'comment_form_default_fields', $fields ),                     'comment_field'        => '
' . _x( 'Share your thoughts on this post', 'noun' ) . ' <textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea>
',                     'must_log_in'          => '
' . sprintf( __( 'Please sign in to share your thoughts' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
',                     'logged_in_as'         => '
' . sprintf( __( 'You are currently signed in as %2$s. Sign out?' ), get_edit_user_link(), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '
',                     'comment_notes_before' => '
' . __( 'Be assured, your email will never be shared with anyone' ) . ( $req ? $required_text : '' ) . '
',                     'comment_notes_after'  => '
' . sprintf( __( 'Thank you for sharing your thoughts.' )) . '
',                     'title_reply'          => __( 'Share your thoughts' ),                     'title_reply_to'       => __( 'Share your thoughts on %s' ),                     'cancel_reply_link'    => __( 'Remove your thoughts' ),                     'label_submit'         => __( 'Send' ),                     );             return $arg;     }          add_filter('comment_form_defaults', 'pietergoosen_custom_comment_fields');      Everything in my comment form works like it should, but now my validation script is not working. If validation fails, it redirects to the default wordpress error page. My custom validation script is not working to validate the submitted info on page. Am I using a wrong hook, or is there something I missed in the validation script.


title: Responsive Admin Themes

text: I was looking at this example of an admin theme (http://themepixels.com/main/themes/demo/webpage/shamcey/dashboard.html). As for the Left Admin bar labeled "Navigation," Is there a way to achieve this type of Left dashboard Admin menu without using a plugin? I would like to achieve this with css, js, or Jquery anything dealing with coding it out.


title: WordPress emails translate to French

text: My client's site is in French and we want to translate the canned emails (such as user registration and password lost) to French. What are the hooks/filters for these? The default language is french, i.e.               define('WPLANG', 'fr_FR');


title: Theme/Plugin/Widget Data and Staging/Production Servers

text: I did some searching before asking and didn't quite come across an answer. Recently I started on a project where they were hosting the development version of WP on an internal multisite, and I was tasked to bring it to a more modern workflow. The setup is Development (localhost) > Staging (Client Approval) > Production (World Facing) So I got an instance up and and running on PagodaBox, which is uses Git for deployment, which is awesome, and they will be two instances running off branches of the Git repo. For this project they used some plugins such as:   * Aqua Page Builder   * Royal Slider   * Extended Text Widget   * Cacoon (Theme) That all seem to save their settings to a magical place I can't find (except RoyalSlider, I clearly see that in the database). So once I got the staging server set up, I used the WP Export tool, pushed the same repo (Different branch) to production, imported with the WP-Import....and basically got a wordpress site lacking all the designs they did with those plugins. Looking at the database from staging, I don't see anywhere that holds this data (Except Royal slider which holds stuff blatantly in the database). _Where is this magical data, and how can I keep it synced between the three stages?_ This also goes for things like images. Do I have to change all kinds of canonical links from one stage to the next? I feel like I am missing something about WP development. Any resources would be appreciated. :)


title: Getting "ReferenceError: jQuery is not defined" - don't know why!

text: I've asked this question here before, but never got an answer. In Firebug, in the Console, I get 'ReferenceError: jQuery is not defined'. I have no clue why. Can anyone help? Here is the page I'm working on: http://goinspire.com/jwrp-hotel-registration/ I can provide other code files from my site if it will help - please let me know which ones you want. Thank you in advance! Edit: How do I figure out why jQuery is not included in the page early enough? thank you!


title: Problem with get_the_title in <a href""> not rendering the way I want

text:
It's quite hard to put a title on this question. So the problem is if my page title is "BLA BLA" my href link will not work.               <a  href="#<?php echo get_the_title();?"> <?php echo get_the_title();?>        It could be great if it automatically translate it to                bla bla       so I'll have                href=#bla bla.      I hope you understand what I'm struggling with for now the only option is to put in the page title               bla bla      Here is my loop it's a menu in a page calling sub-pages:                <?php           $args = array (         'posts_per_page' => -1, //Showing all the pages         'post_type' =>  'page', //Retrieving pages not posts.         'post_parent'   => $post->ID,       'orderby' => 'menu_order',                     'order' => 'ASC'              );          $the_query = new WP_query($args);     while($the_query->have_posts()):         $the_query->the_post();             if ($the_query->current_post == 0){ ?>
 <a href="#<?php echo get_the_title();?>" data-toggle="tab"><?php echo get_the_title(); ?>
                     <?php  }             else{   ?>
  <a href="#<?php echo get_the_title();?>" data-toggle="tab"><?php echo get_the_title(); ?>
                 <?php }     endwhile;     wp_reset_postdata();            ?>


title: Prevent WordPress from interpreting a subfolder?

text: **How do I prevent WordPress from interpreting a subfolder?** Right now WordPress is installed in the root folder (grassrootsmedia.net/) and I have several other subfolders like (/Clients) that should NOT be styled and interpreted as part of the main WordPress site. In the past, when you surfed to (grassrootsmedia.net/Clients) the site was not styled nor interpreted by the main WordPress site. Now you get a 404 Error. Help! How do I hide the subfolders? Or how do I block WordPress from thinking the subfolders are a part of the main site?


title: How to secure the release of WordPress plugins / avoid copying plugins?

text: I'm new to the WP arena and considering doing some plugin development. In releasing a WordPress plugin, how do you keep from the plugins getting distributed to those who haven't genuinely purchased the plugin? I guess I'm not entirely clear how plugins like Software Licensing for Easy Digital Downloads keep users from copying the plugin after it's installed and distributing it to other users. Clarification would be nice. Thanks.


title: How to make a child theme independent of parent?

text: I recently made a twentyten child theme, but I'm curious as to how I can make the child theme independent of its parent, ie exist without the twenty-ten theme folder present. I couldn't find any information on this and thought WP answers could shed some light.


title: Advanced Custom Fields Post Object

text: I am looking to create a custom proposal system with WP and ACF. I created 3 custom post types.   1. Proposal Objectives    2. Proposal Items   3. Proposals I created some custom fields in ACF to include in these sections. When generating a new proposal, I have a flexible content field with a Post Object (to pull a Proposal Item) and underneath that drop down, a full WYSIWYG editor. Is it possible to have the content from the post_object load in the editor? So from a list of 10 posts from the Proposal Items section you select the title of of them and the editor populates with the content from that post, so that you have your canned response with the ability to customize it for that proposal. Just not sure where to start to achieve this and any help would be awesome! Example of post_object and the editor below EDIT: I just found this: http://www.advancedcustomfields.com/resources/tutorials/dynamically-populate- a-select-fields-choices/ just trying to see if I can apply it to what I need


title: Custom Fields - Boolean Display of True/False to Yes/No

text:
I am importing fields from a Real Estate site. The Import of one Custom Field looks like this... Field Name after Import ---> assistedLiving Field Value ---> false to output the display in wordpress i use this...               <?php          global $wp_query;         $postid = $wp_query->post->ID;              if ($immopress_property['assistedLiving']): ?>
                 <?php echo 'Seniorengerechtes Wohnen' ; ?>:                 <?php echo get_post_meta($post->ID, 'assistedLiving' , true); ?>
                  <?php wp_reset_query(); ?>         <?php endif; ?>        The Result on Site looks so... **Seniorengerechtes Wohnen:false** I also tryed...                   <?php                   if ( get_post_meta($post->ID, 'assistedLiving', true) ) { ?>
           <?php echo Seniorengerechtes Wohnen ; ?>:           <?php $assist=get_post_meta($post->ID, 'assistedLiving' , true); if ($assist=="") echo "keine Daten"; else if(strtolower($assist)=='true') echo "Ja"; else if(strtolower($assist)=='false') echo "Nein"; ?>
              <?php wp_reset_query(); ?>         <?php } ?>       But Result on Site looks so... * _Seniorengerechtes Wohnen: *_ How can i display False/True Values to display Yes/No or in German Ja/NEIN? The Funktion to display all Field (Display it Right with yes/no):               function immopress_the_fields( $args ) {         global $post, $ImmoPress;         extract( wp_parse_args( $args, array (             'id' => $post->ID,             'exclude' => $exclude,             'echo' => TRUE         ) ), EXTR_SKIP );              $fields = immopress_get_fields( $args );              if ( !$fields )              return false;              $output = '';              $output .= '
';              foreach ( $fields as $key => $value) {                  $entry = $ImmoPress->values[$value];             if ( $entry == '')                  $entry = $value;                  $output .= "
";             $output .= "{$ImmoPress->fields[$key]}: ";             $output .= "$entry";             $output .= "
";          }              $output .= '
';              if ( $echo ) {             echo $output;         } else {             return $output;         }      **But i need to display only a view Custom Fields not all importet fields.** Code for the Shortcode..               function immopress_fields_shortcode( $atts ) {         $args = wp_parse_args( $atts, array (             'echo' => FALSE         ) );         return immopress_the_fields( $args );            }     add_shortcode( 'immopress_fields', 'immopress_fields_shortcode' );      Hope someone can Help me with that. Thanks Tony


title: Downgrade user from role that allows post creation

text: I am an admin of a multi-author blog. I am implementing a monitoring system which will require me to downgrade a user from an 'author' (this role allows them to make a custom post) back to the 'reader' role if I think it is a spam account, or if they are breaking website rules. After changing their role using the admin screen, how can I make all the posts they made delete automatically, without having to scroll and find them myself? Many thanks **EDIT using advice from answers below** :               add_action( 'set_user_role', 'wpse98904_remove_demoted_user_posts', 10, 2 );     function wpse98904_remove_demoted_user_posts( $demoted_author_id, $role ) {      // In here you'd search for all the posts by the user           $args = array(                 'numberposts' => -1,                 'author' => $demoted_author_id,                 'post_type' => 'custom_post',                 // So if your custom post type is named 'xyz_book', then use:                 // 'post_type' => 'xyz_book',      );      $demoted_author_posts = get_posts( $args );      foreach( $demoted_author_posts as $p ) {          // delete the post (actually Trash it)          if($role == 'subscriber') {          wp_trash_post( $p->ID);          // To force the deletion (ie, bypass the Trash):          // wp_delete_post( $p->ID, true );          }      }     }      I used wp_trash_post to trash the events because adding 'false' to wp_delete_post did not work for me.


title: Viddler oEmbed not working with specified width

text: I'm working on a widget that embeds videos using oEmbed and I'm testing it out using the default providers in WordPress. So far, they are all working fine, except Viddler. The video is displayed, but not with the width and height I specified. To get the oembeds to work properly in the widget, I'm using the wp_oembed_get() function, which requires the video's URL and optionally an array with the width and height.               // Test Data:     $url = 'http://www.viddler.com/v/bdce8c7';     $width = '250';     $height = '140';          echo wp_oembed_get( $url, array( 'width' => $width, 'height' => $height ) );      This yields a video with dimensions of 620 x 349. I've hacked a way around it, but wp_oembed_get() is supposed to be able to do all this for me, right? Here's what I've put together:               require_once( ABSPATH . WPINC . '/class-oembed.php' );          // $service is detected by parsing the URL for the host     if ( $service == 'viddler' ) {              $oem    = _wp_oembed_get_object();         $json   = 'http://www.viddler.com/oembed/?format=json&url=' . urlencode( $url );         $return = $oem->fetch( $json, $url, array( 'width' => $width, 'height' => $height ) );         $oembed = $return->html;          } else {              $oembed = wp_oembed_get( $url, array( 'width' => $width, 'height' => $height ) );          }          return $oembed;      This works, but I'm wondering if this is a bug I should report to WP or Viddler. In the WP Core (wp-includes/class-oembed.php), the URL format for Viddler is: http://lab.viddler.com/services/oembed/ Should that be changed to what I have above? http://www.viddler.com/oembed/ Anyone else having this issue?


title: Users Select inside custom metabox

text: I'm using human made's custom meta boxes framework (https://github.com/humanmade/Custom-Meta-Boxes). I want to add a select drop down in my metabox wich is populated from the users with multiple roles on my WP site. Referencing this post : Get multiple roles with get_users I came up with:               add_filter( 'cmb_meta_boxes', 'users_metabox' );          function eusers_metabox( array $meta_boxes ) {              $prefix = 'user_';              global $wpdb;         $blog_id = get_current_blog_id();              $user_query = new WP_User_Query( array(             'meta_query' => array(                 'relation' => 'OR',                 array(                     'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',                     'value' => 'Administrator',                     'compare' => 'like'                   ),                 array(                     'key' => $wpdb->get_blog_prefix( $blog_id ) . 'capabilities',                     'value' => 'Editor',                     'compare' => 'like'                   )               )           )          );              $fields = array(         array(                  'id'   => $prefix . 'user_sub',                  'name' => 'Subscriber User',                  'type'     => 'select',                 'use_ajax' => false,                 'options'  => $user_query,  // this is where you populate the select in metabox             ),         );              $meta_boxes[] = array(             'title' => 'Location Info',             'pages' => 'em_users',             'context'    => 'normal',             'priority'   => 'high',             'fields' => $fields         );              return $meta_boxes;           }      Works somewhat, but seems to return just capital letters. Any ideas? Need to output (UserID) as variable constant


title: check for shortcode in post/pages AND widgets AND template files

text: For the next version of my plugin www.mapsmarker.com I would like to output the plugin´s css and js-files only if the shortcode [mapsmarker ...] is used. For posts/and pages I already found this working code:               function lmm_detect_shortcode()     {         global $post;         $pattern = get_shortcode_regex();         preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches );              if( is_array( $matches ) && array_key_exists( 2, $matches ) && in_array( 'mapsmarker', $matches[2] ) )         {             echo 'shortcode is used';         }     }     add_action( 'wp', 'lmm_detect_shortcode' );      Problem is, that the maps can also be embedded in widgets (by shortcode) or template file directly by using the function do_shortcode() (http://www.mapsmarker.com/docs/how-to-add-maps-to-your-site-using-template- tags/) and the code above does not check, if this is true - resulting in the map not being displayed. As a workaround I could add an option in the plugin settings if the js/css- files should only be added when the shortcode is added to a post or page and add the description, to disable this setting if a map is added to widgets via shortcode or to template files via do_shortcode(). As this is not a quite usable solution (which would result in some support requests in the long run), I am looking for a solution, where I can turn this feature on by default and don´t have to add an option to the settings, because the code also checks if a shortcode is added in widgets or via do_shortcode() in one of the template files, like this:               ....     if( ( is_array( $matches ) && array_key_exists( 2, $matches ) && in_array( 'mapsmarker', $matches[2] ) ) || ( CHECK IF SHORTCODE USED IN WIDGETS == TRUE ) || ( CHECK IF SHORTCODE USED IN TEMPLATE FILES == TRUE ) )     {         echo 'shortcode is used';     }     .....      My first approach to this problem was to check global variables and see if somehow I could filter out this added code, e.g. by $wp_filter (array) - a multi-dimensional array of all functions that have been added to filters/hooks. Unfortunately I didnt find a solution yet. Any help is appreciated!


title: How to find when qtranslate plugin's language changes?

text: I used qtranslate for make my website multilingual, In fact this plugin just make an option for my content to has another translate, but how can i use it in my code? for example:               if ( $language == "ar" ) {      // somthing }


title: Delete a specific item menu when I deactivate my plugin (resolved)

text: When I activate my plugin (register_activation_hook), I add a new specific page and a corresponding item menu in the custom menu. No problem here. When I deactivate my plugin (register_deactivation_hook), I delete the specific page but I don't know how to delete the corresponding item menu from the custom menu ? Any idea ? Thx


title: Allow all file types for upload

text: I'm using Wordpress 3.4.2 for a private blog, i.e. one on which only I can post. Now, Wordpress prevents me from uploading certain file types (like C# source files). As far as I understand it, there's a white-list that defines what can be uploaded. Is there a plugin that can extend - or better, even disable - this white-list? All other answers tell me I should edit my theme but I'd rather have a plugin for that (so that I don't need to edit all my themes). Also, I found this plugin but, again, it requires me to edit some file on my server (that's probably overwritten when the plugin is updated). So, is there anything else?


title: Retrieve array of attachment IDs attached to a given Post ID

text: I wonder if there's a function to retreive an array containing the attachment IDs of images that are atatched to a given post. Some function like get_post_arry($pid); The array should be ordered like                   ['0':'image1', '1':'image2', '2':'image3', .... etc. ]      Any help would be appreciated. Thank you, Florian


title: Change avatar on themed profile page

text:
I'm using the Theme My Login plugin and trying to allow subscribers to change their profiles to one uploaded from their computer. I've tried the following plugins:   * Simple Local Avatars   * User Avatar   * WP User Avatar   * Avatar manager I can get the file upload form to appear, but when clicking upload or update profile, the avatar does not change. Is there a way I can achieve this? Here is the whole of my 'Theme my login' profile code with 'Simple Local Avatars'               <div class="login profile" id="theme-my-login<?php $template->the_instance(); ?>">                  <?php $template->the_action_template_message( 'profile' ); ?>                  <?php $template->the_errors(); ?>                  <form id="your-profile" action="<?php $template->the_action_url( 'profile' ); ?>" method="post" class="validate"<?php do_action( 'user_new_form_tag' );?>>                     <?php wp_nonce_field( 'update-user_' . $current_user->ID ); ?>
                        <input type="hidden" name="from" value="profile" />                        <input type="hidden" name="checkuser_id" value="<?php echo $current_user->ID; ?>" />
                          <?php if ( has_action( 'personal_options' ) ) : ?>
<?php _e( 'Personal Options' ); ?>

                     <?php do_action( 'personal_options', $profileuser ); ?>
                          <?php endif; ?>                          <?php do_action( 'profile_personal_options', $profileuser ); ?>
<?php _e( 'Name' ); ?>

                        <?php _e( 'Username' ); ?>	                        <input type="text" name="user_login" id="user_login" value="<?php echo esc_attr( $profileuser->user_login ); ?>" disabled="disabled" class="regular-text" /> <?php _e( 'Your username cannot be changed.', 'theme-my-login' ); ?>

                        <?php _e( 'First Name' ); ?>	                        <input type="text" name="first_name" id="first_name" value="<?php echo esc_attr( $profileuser->first_name ); ?>" class="regular-text" />

                        <?php _e( 'Last Name' ); ?>	                        <input type="text" name="last_name" id="last_name" value="<?php echo esc_attr( $profileuser->last_name ); ?>" class="regular-text" />

                        <?php _e( 'Nickname' ); ?> <?php _e( '(required)' ); ?>	                        <input type="text" name="nickname" id="nickname" value="<?php echo esc_attr( $profileuser->nickname ); ?>" class="regular-text" />

                        <?php _e( 'Display name publicly as' ); ?>	                                                   <select name="display_name" id="display_name">                           <?php                              $public_display = array();                              $public_display['display_nickname']  = $profileuser->nickname;                              $public_display['display_username']  = $profileuser->user_login;                                   if ( ! empty( $profileuser->first_name ) )                                 $public_display['display_firstname'] = $profileuser->first_name;                                   if ( ! empty( $profileuser->last_name ) )                                 $public_display['display_lastname'] = $profileuser->last_name;                                   if ( ! empty( $profileuser->first_name ) && ! empty( $profileuser->last_name ) ) {                                 $public_display['display_firstlast'] = $profileuser->first_name . ' ' . $profileuser->last_name;                                 $public_display['display_lastfirst'] = $profileuser->last_name . ' ' . $profileuser->first_name;                              }                                   if ( ! in_array( $profileuser->display_name, $public_display ) )// Only add this if it isn't duplicated elsewhere                                 $public_display = array( 'display_displayname' => $profileuser->display_name ) + $public_display;                                   $public_display = array_map( 'trim', $public_display );                              $public_display = array_unique( $public_display );                                   foreach ( $public_display as $id => $item ) {                           ?>                              <option <?php selected( $profileuser->display_name, $item ); ?>><?php echo $item; ?></option>                           <?php                              }                           ?>                           </select>

<?php _e( 'Contact Info' ); ?>

                        <?php _e( 'E-mail' ); ?> <?php _e( '(required)' ); ?>	                        <input type="text" name="email" id="email" value="<?php echo esc_attr( $profileuser->user_email ); ?>" class="regular-text" />

                        <?php _e( 'Website' ); ?>	                        <input type="text" name="url" id="url" value="<?php echo esc_attr( $profileuser->user_url ); ?>" class="regular-text code" />
                          <?php                        foreach ( _wp_get_user_contactmethods() as $name => $desc ) {                     ?>
                        <label for="<?php echo $name; ?>"><?php echo apply_filters( 'user_'.$name.'_label', $desc ); ?>	                        <input type="text" name="<?php echo $name; ?>" id="<?php echo $name; ?>" value="<?php echo esc_attr( $profileuser->$name ); ?>" class="regular-text" />
                     <?php                        }                     ?>

<?php _e( 'About Yourself' ); ?>

                        <?php _e( 'Biographical Info' ); ?>	                        <textarea name="description" id="description" rows="5" cols="30"><?php echo esc_html( $profileuser->description ); ?></textarea>
                        <?php _e( 'Share a little biographical information to fill out your profile. This may be shown publicly.' ); ?>
                          <?php                     $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser );                     if ( $show_password_fields ) :                     ?>
                        <?php _e( 'New Password' ); ?>	                        <input type="password" name="pass1" id="pass1" size="16" value="" autocomplete="off" /> <?php _e( 'If you would like to change the password type a new one. Otherwise leave this blank.' ); ?>
                           <input type="password" name="pass2" id="pass2" size="16" value="" autocomplete="off" /> <?php _e( 'Type your new password again.' ); ?>

<?php _e( 'Strength indicator', 'theme-my-login' ); ?>

<?php _e( 'Hint: The password should be at least seven characters long. To make it stronger, use upper and lower case letters, numbers and symbols like ! " ? $ % ^ & ).' ); ?>

                     <?php endif; ?>
                         <?php                      global $current_user;                      get_currentuserinfo();                      $myAv = new simple_local_avatars();                      $myAv->edit_user_profile($current_user);                    ?>
                        <input type="hidden" name="action" value="profile" />                        <input type="hidden" name="instance" value="<?php $template->the_instance(); ?>" />                        <input type="hidden" name="user_id" id="user_id" value="<?php echo esc_attr( $current_user->ID ); ?>" />                        <input type="submit" class="button-primary kopa-button blue-button small-button" value="<?php esc_attr_e( 'Update Profile' ); ?>" name="submit" />
                            </form>


title: Call to a member function get_row() on a non-object, Unable to use global $wbdp inside a plugin

text: I am building a custom plugin for my WordPress site. I made a php file called "checkrank" that obtains data from a custom table named "cranking".               $uid = $GET['id'];           function checkExists($id){         global $wpdb;         $table_name = $wpdb->prefix . 'cranking';         $exists = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM $table_name WHERE id = %d" ) );              $error = $wpdb->print_error();              if(count($exists) > 0){            echo 'Exists!';         } else {            echo 'Does not exist!';         }           return $error;     }          checkExists($uid);      The code is just to check whether the cranking table has the user with the provided ID. The problem is, whenever i run this php file, i get this error : > PHP Fatal error: Call to a member function `get_row()` on a non-object Where am I at fault here?   I think `$wbdp` is not initiated.


title: White background, black text - the simplest on earth : "error"!

text: On my site in localhost, why a simple "error" doesn't pass/permit to do anything at all? ![WordPress site "error"](http://i.stack.imgur.com/HWWFm.png) I browsed the homepage of the project `localhost/creative/`, it's Ok. After then, I entered `localhost/creative/wp-admin` and it goes into "error". Then I tried the homepage again: that's go wrong too: "error". I retried:   * Clearing browser cache & history   * Using different browsers, etc.   * Waiting for 5 minutes, and then 10... And SUDDENLY it's back on. :) But the question is: **_WHY?_** Because, this is not the first time, it happened several times, before. :(


title: My website is getting too many dierect home arechives and this is increasing my bounce rate

text: My website is getting nearly 800 direct home archives daily, as a result the bounce rate of my website has increased. Usually i get only around 30 home archives a day These hits are not from Google, so how can i stop them. Actually in my Wordpress Jetpack stats my home archives are going around 800 a day which only used to be around 30 a day, so i think some one is giving fake clicks to my website. So the bounce rate of my website is increasing day by day because these hits are not from any of the search engines and most of these home archives are from india and usa. So please help me by providing some way out please.


title: How to get recent comment link

text:
I'm getting 5 recent comments into my sidebar using the following code:               <?php $recent_comments = get_comments('status=approve&number=5'); ?>     <?php foreach ($recent_comments as $comment) { ?>
             <?php echo get_avatar( $comment, '60' ); ?>
                 <a href="<?php echo get_permalink($comment->ID); ?>" title="on <?php echo $comment->post_title; ?>"><?php echo strip_tags($comment->comment_author); ?>
                 <?php echo wp_html_excerpt( $comment->comment_content, 35 ); ?>...

     <?php }  ?>      But the problem that I am facing is: When I click on the comment link it's redirecting me to the current page instead of the page that is commented. On other hand, when I click on the comment link (that is in sidebar) in homepage, it's redirecting me to the latest post page. I have used `wp_reset_query()` but the problem persists.   Also usingt `get_comment($comment->ID);` instead of `get_permalink` is not working.


title: Require a featured image to publish post

text: I have a multi author WordPress blog.   I'd like to allow publishing of a post only when a featured image is set. How can that be done?


title: If post exists in the database - each time goes on `else`

text: Firstly, I am a newbie when it comes to php. I have a plugin that periodically imports posts into my website. Normally, it should check if the post already exists, and if it does, it updates it. Otherwise it creates a new one. Now for some reason, it always takes the `else` path no matter what. The `if` is like this:               if ( nmp_post_exists( $cam->username ) ) {      and the function is:               function nmp_post_exists($title) {         global $wpdb;         return $wpdb->get_row("SELECT * FROM wp_posts WHERE post_title = '" . $title . "'", 'ARRAY_A');     }


title: URL redirect problem

text: I have 2 pages in my wordpress 3.0.1 site with 2 urls www.mysite.co.uk/sub-page/child-of-sub-page/accommodation/ and www.mysite.co.uk/accommodation/ however any link in my site to www.mysite.co.uk/accommodation/ goes to www.mysite.co.uk/sub-page/child-of-sub-page/accommodation/ instead is this a bug in wordpress 3.0.1? or is there a way round this?


title: Getting the slug into a variable, how to echo that variable

text: The page slug for each of our wordpress articles is a unique set of seven digits, and we are using that string of numbers as the page slug. In trying to learn how to customize our site even further, I'd like to learn how to echo that slug in template files (outside the loop - it would actually be used in the sidebar). Here's what I've tried so far (and failed miserably): At the top of the post template file, I have this code:               <?php $doi = get_page_template_slug( $post_id ); ?>      So I'm trying to create a $doi variable that has the page slug. Later on in the template file, I'm trying to echo that variable:               <?php echo $doi; ?>      That also fails. Anyone got time to help a PHP newbie out?


title: Auto-post to multiple sites like Posterous?

text: I'd like to be able to autopost from my wordpress site (private wordpress.org, not on wordpress.com) to multiple sites with one plugin/hack from within wordpress. I'd like my posts to be able to be auto-posted (linked to) on facebook, identi.ca, twitter, posterous, etc. without multiple plugins. I've looked everywhere for a good plugin and they all seem to be site specific (for example just a twitter plugin). I need a one-stop shop like posterous, but since i have my own site i don't want the links going to posterous when they could be coming back to my official site. is this at all possible as of yet? if not, someone should step up and code it. thanks!


title: Last time a user logged in

text: I'm building a site where users log in to view content specific to them. I would like to display the last date and time they logged in. How would I get this information from wordpress? If it doesn't exist, how could I add it? Example: Welcome Back! Your last visit was on 10/25/2010 at 3:14pm. Thanks!


title: How to insert current date/time in the content of a post?

text: I'm making a list of suggestion here. I need to insert current date/time for each of my suggestions - they are added accumulatively. If you have any idea on doing that, please share.


title: In multisite environment which is the most Popular blog?

text: In a wordpress multisite - selfhosted environment:- how to know which blog has highest number of visitors ? how to know which blog has highest number of comments and posts ?


title: Filter a custom field based on selection of another custom field (ACF)

text: I have 3 custom post types with Advanced Custom Fields:   * Student   * Class   * Homework Assignment **Homework** has a custom field that is a 'relationship' with **Class**. This is because specific pieces of homework are related to specific classes. A **Student** has a relationship field with **Class** because each student is part of a class. Now I want to create a **Homework Assignment** , so I set a custom field (relationship) of **student**. Once I've chosen a student, I want the 2nd custom field (also a relationship) to give me the choice of any **Homework Assignment** records that have the same **class** as the **student**. So basically how do I have a conditional statement with Advanced Custom Fields that 'filters' instead of 'show/hides' the 2nd custom field?


title: Update Post creation date when updated

text: I am wanting to be able to update a Post and have it show up on my home/main feed as if it were just posted. For example, if I had a Post titled "Roadmap" or "Planned Features", etc... and it was a list, everytime I updated THAT post, it would update it's creation time to make it look like it was just created instead of updated, so that it would show up in my recent posts. Any ideas on how to accomplish?


title: When sorting WP_List_Table, table sorts, but I also get SQL errors

text: Here's my lovely `prepare_items()` function:               function prepare_items()     {         global $wpdb;              $table_name = $wpdb->prefix . 'blah';         $per_page = 100;         $columns = $this->get_columns();         $hidden = array();         $sortable = $this->get_sortable_columns();              $this->_column_headers = array($columns, $hidden, $sortable);              $this->process_bulk_action();              $total_items = $wpdb->get_var("SELECT COUNT(id) FROM $table_name");              $paged = isset($_REQUEST['paged']) ? max(0, intval($_REQUEST['paged']) - 1) : 0;         $orderby = (isset($_REQUEST['orderby']) && in_array($_REQUEST['orderby'], array_keys($this->get_sortable_columns()))) ? $_REQUEST['orderby'] : 'title';         $order = (isset($_REQUEST['order']) && in_array($_REQUEST['order'], array('asc', 'desc'))) ? $_REQUEST['order'] : 'asc';              $this->items = $wpdb->get_results($wpdb->prepare("SELECT * FROM $table_name ORDER BY $orderby $order LIMIT %d OFFSET %d", $per_page, $paged), ARRAY_A);              $this->set_pagination_args(array(             'total_items'   => $total_items,             'per_page'      => $per_page,             'total_pages'   => ceil($total_items / $per_page),         ));     }      Now when I sort the table, the URL becomes: `http://blah.dev/wp- admin/admin.php?page=mvc_events&orderby=start_date&order=asc`               [13-Aug-2013 20:55:21 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'asc LIMIT 0, 10' at line 1 for query SELECT `Event`.* FROM `wp_atb_events` `Event`    ORDER BY asc LIMIT 0, 10 made by do_action('toplevel_page_mvc_events'), call_user_func_array, MvcDispatcher->admin_events_index, MvcDispatcher->__call, __lambda_func, MvcDispatcher::dispatch, AdminEventsController->index, MvcAdminController->set_objects, MvcModel->paginate, MvcDatabaseAdapter->get_results, MvcDatabase->get_results     [13-Aug-2013 20:55:21 UTC] WordPress database error You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'asc' at line 1 for query SELECT COUNT(*) AS count FROM `wp_atb_events` `Event`    ORDER BY asc made by do_action('toplevel_page_mvc_events'), call_user_func_array, MvcDispatcher->admin_events_index, MvcDispatcher->__call, __lambda_func, MvcDispatcher::dispatch, AdminEventsController->index, MvcAdminController->set_objects, MvcModel->paginate, MvcModel->get_total_count, MvcDatabaseAdapter->get_var, MvcDatabase->get_var      Any idea why this error is showing up? Everything works, it's just these two error messages keep coming up.


title: Query for page content, and query for posts on the same page?

text:
I'm having trouble with trying to make a blog listing page, I have a page in Wordpress called Blog. Within this is some written content and that's it. I'm using the following query to make it output the content of that page:               <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
Clever Thinking

<?php the_content(); ?>
     <?php endwhile; ?>      This all works fine. Below that, I'm trying to create a query to all my general posts, with a pagination, displays four posts per page.                            <?php                  // The query for 4 posts                 $query = new WP_Query( 'posts_per_page=4' );                      // Output the results of the query                 if ( $query->have_posts() ) :                            while ( $query->have_posts() ) : $the_query->the_post(); ?>
<?php the_title(); ?>
                      <?php endwhile; ?>                                                             <?php wp_reset_postdata();                      // If no results appear                 else : ?>
<?php _e( 'Sorry, no posts matched your criteria.' ); ?>
                 <?php endif; ?>      But this part is apparently not correct as I do not get anything, not even the posts error message, so the function is not even firing? I can't work out why this query would not work.


title: Add a submenu to wp_nav_menu

text: I literally don't know where to begin with this. The only wp_nav_menu() documentation I found was http://codex.wordpress.org/Function_Reference/wp_nav_menu and all submenu docs reference a different function or layout. What can I do?


title: Having problem creating local instance of wordpress site

text: I am trying to make a copy of a wordpress site on my webhost on my local computer. I am using EasyPHP. I downloaded all of the files within content and added them to a folder within EasyPHP\data\localweb\projects. I went on myPHPadmin and created a user and database and connected to it using wp- config.php. Then to make sure everything was working so far I navigated to the localhost url for the site and it asked me to do an install. After doing the install it works correctly, I can see my custom theme and activate it, and I see all of my plugins that are installed on the live site. However, all of the content from the site is of course in the database. I drop all of the tables import the live database (which I explorted also via myPHPadmin). It say 'Cannot connect to database' I do some research and find I have to do the following query because the URL is different:               UPDATE wp_posts SET guid = replace(guid, old url, new url);     UPDATE wp_posts SET post_content = replace(post_content, old url, new url);.     UPDATE wp_postmeta SET meta_value = replace(meta_value, old url, new url);     UPDATE wp_options SET option_value = replace(option_value, old url, new url);      So I do that and am getting data from the database, but its not working correctly. The main page has a 404 error and has links to the articles that are on the live site but if other than that its just black and white text. No theme or anything. If I click anything I get the following error:               Object not found!          The requested URL was not found on this server. The link on the referring page seems to be wrong or outdated. Please inform the author of that page about the error.          If you think this is a server error, please contact the webmaster.      Also when I add wp-admin to log in I get the same error. Help!