Wordpress Site Speed (Maybe Server Issue)

Okay so I have a newly created eCommerce site here at work, and I have set up W3 Total Cache with MaxCDN running. It all works correctly, all the static content is run from there without any problems. However, my main problem is the website as a whole is still incredibly slow. Using Chrome Dev tools and watching the Network Timeline I can clearly see that when you load any page of the website, there is a request to the server and it spends roughly 5 seconds just "waiting" before any content begins to load. So I've come to the conclusion that the content is pretty well optimised but there seems to be some issue with the speed at which it gets the initial request from the server.... Can anyone shed some light on what the issue might be, or any potential fixes when consider the slow speeds due to "waiting" for the server? ![enter image description here](http://i.stack.imgur.com/3q3Et.jpg)


Save camera info as metadata on image upload?

I am trying to have WordPress automatically save the "credit" metadata that is stored within images I am uploading. I know this would be entered as a custom post meta field using `update_post_meta()`. The "credit" information is gathered by `wp_read_image_metadata()`, but `media_handle_upload()` doesn't use it. It only uses the "caption" and "title" information gathered from the image for `post_content` and `post_title` respectively. I've found several examples of how to add custom attachment metadata fields **after** the upload when editing the image, but since WP is already gathering this information from the image's metadata, I'd like to find a way to have it saved as the image is uploaded. I'm unclear of what steps to take to hook into `media_handle_upload()` (there doesn't seem to be a hook) so that I can call `update_post_meta` to save the "credit" line for the attachment.


wordpress change the loop order by dynamic value

At the moment i have a custom field named "price" to order my posts correctly. The following already works:                 $query_args['meta_key'] = 'price';       $query_args['orderby'] = 'meta_value_num';       $query_args['order'] = 'asc';      The problem is that this is a "recommended" price, the real price needs to be calculated inside the loop. The question is to know if there is a way or a trick, where we can run the loop, calculate the real price and show the posts based on the real price variable.


Wordpress if in term*

i am having trouble with conditional and custom post types. i would like to set something up like this:               <?php      if (in_term('products')){     include ('products.php');      }elseif (in_term('downloads')){     include ('downloads.php');      }else {         //Nothing Happens     }?>      Obviously this doesnt work, but if there is an alternative anybody knows then please share :) Thank you, Dan


"Cannot redeclare cpt_reg_tax()" because of functions.php

Background: I have a childtheme folder of my Wordpress theme which contains a functions.php. In this functions.php, at the beginning, I wrote code for setting up a custom post type that allows the user to add events to the site. Everything worked fine until today when in the same file I added code for a further separate custom post type that allows the user to add people. Problem: After having added the second custom post type code, I cannot login to my site anymore. Cause of the problem: Via the error logfiles of my domain provider I found out that my code for registering "place" as a category causes the problem. I tried to register this taxonomy via `add_action('init', 'cpt_reg_tax');`, followed by `function cpt_reg_tax() { // code };` Now here comes what the error log file tells me: `PHP Fatal error: Cannot redeclare cpt_reg_tax() (previously declared in ...` The thing is for the events custom post type at the beginning of functions.php I already registered a taxonomy. But why would PHP not allow me to register another taxonomy for another separate custom post type which comes later in the file? How do I achieve that I can register a taxonomy for my second custom post type that I coded today without getting the redeclare-error again?


Disable Please visit the Update Network page to update all your sites. Notice from Dashboard

I would like to hide below message you see on dashboard after a WordPress upgrade in Wordpress MU. I know for hiding version upgrade notice there is one filter as               add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );      But I want to disable the following notice > "Thank you for Updating! Please visit the Update Network page to update all > your sites." ![enter image description here](http://i.stack.imgur.com/F0rLW.jpg)


How to print meta description to posts?

I want to show my meta description content above posts. But i don't know what function I need to call. Resume: i want to put meta description from Yoast Seo above the posts body.


How to get user contact info

In the user profile in Dashboard I have a section 'Contact info' containing email, URL, aim, yahoo, jabber. I would like to build a widget and output that user info within the widget. What function should I use to get just the contact info of a user?


How to filter a query by multiple meta keys and order by other meta keys

I'm trying to query posts using `WP_Query` and `meta_query` parameters:               $args = array(         'post_type' => 'produkty',         'meta_query' => array(             'relation' => 'AND',             array(                 'key' => 'produkt_aktywny',                 'value' => '1',                 'compare' => '='             ),             array(                 'key' => 'produkt_dostepnosc',                 'value' => '1',                 'compare' => '='             )         )     );          $query = new WP_Query( $args );      What should I add to order the results by two other meta keys (`'produkt_kategoria'` and `'produkt_cena'`)?


Various thumbnail sizes for Wordpress/jquery masonry gallery

can someone help me to create a thumbnail gallery in Wordpress using jquery masonry which looks similar to this? I am not sure what the best approach is. Especially regarding the different thumbnail sizes. When and how to assign them? I get the part where I set a few different thumbnail sizes, but how do I decide which size to load? Since that page always loads the same way it doesn't seem to be randomized. Can the masonry script take care of that itself? Thanks a lot for your help!


Use the same slug for posts in different post types

I have 2 post types in my WordPress theme-- one is `destination` and the other is `gallery`. Both post types have a post with the title "Bagan". My problem is that I am unable to create the same permalink for both the post types, like:   * `MYDOMAINNAME.com/destination/bagan`   * `MYDOMAINNAME.com/gallery/bagan` In the gallery post type I am unable to use the slug `MYDOMAINNAME.com/gallery/bagan`


How can I show related posts from multiple separate installations

Say I have three sites, abc.com, def.com and xyz.com. All the three sites are different wordpress installations and different databases. Now in story page I want that related articles should come from all the three sites. Is this possible from any plugin or any custom code? I am not talking about multisite. Any help will be appreciated.


Remove ability to access certain admin menus

I am trying to remove some of the admin features for a user with the role of contributor. What i mean by remove some of the admin features is disable them from seeing certain admin menu items, such as comments, tools, media ect. I have managed to remove the items I want from the admin menu, using this code:               function remove_menus(){          $author = wp_get_current_user();     if(isset($author->roles[0])){          $current_role = $author->roles[0];     }else{         $current_role = 'no_role';     }          if($current_role == 'contributor'){         remove_menu_page( 'index.php' );                  //Dashboard       remove_menu_page( 'edit.php' );                   //Posts       remove_menu_page( 'upload.php' );                 //Media       remove_menu_page( 'tools.php' );                  //Tools       remove_menu_page( 'edit-comments.php' );               //Comments          }          }     add_action( 'admin_menu', 'remove_menus' );      It works a treat. The problem I am facing is that I can just manually add the query string to the url, eg /wp-admin/edit.php and that will take me to the post edit screen. Does anyone know a way to restrict these pages from being accessed altogether, as well as hiding them from the admin menu?


Change only the attachment permalinks to %post_id%

My permalinks are set to _/%category%/%postname%/_ but I would like attachments to live at _photo/%post_id%/_ I already have a rewrite function to change the attachment slug from _attachment/_ to _photo/_ , and I know this is where to start, but I'm not sure how to switch to using the post_id in the url?               // Change /attachment permalinks to /photo     function __filter_rewrite_rules( $rules ) {         $_rules = array();         foreach ( $rules as $rule => $rewrite )             $_rules[ str_replace( 'attachment/', 'photos/', $rule  ) ] = $rewrite;         return $_rules;     }     add_filter( 'rewrite_rules_array', '__filter_rewrite_rules' );          function __filter_attachment_link( $link )     {         return preg_replace( '#attachment/(.+)$#', 'photos/$1', $link );     }     add_filter( 'attachment_link', '__filter_attachment_link' );      Thanks!


How to display the FAQ Archive page in my menu

I'm using the Wordpress standard menu. I've also created a custom post type. I'd like to include my custom post type archive page (the all item) in the Appearance -> Menus, but so far I can select only the individual items. Any idea how I can do this? THanks


How To List Sibling Pages And Include The Featured Image?

I recently came across this cool tutorial on listing sibling pages. Below is the suggested code:               <?php         //GET CHILD PAGES IF THERE ARE ANY         $children = get_pages('child_of='.$post->ID);              //GET PARENT PAGE IF THERE IS ONE         $parent = $post->post_parent;              //DO WE HAVE SIBLINGS?         $siblings =  get_pages('child_of='.$parent);              if( count($children) != 0) {            $args = array(              'depth' => 1,              'title_li' => '',              'child_of' => $post->ID            );              } elseif($parent != 0) {             $args = array(                  'depth' => 1,                  'title_li' => '',                  'exclude' => $post->ID,                  'child_of' => $parent                );         }         //Show pages if this page has more than one sibling          // and if it has children          if(count($siblings) > 1 && !is_null($args))            {?>

Also in this Section

              <?php wp_list_pages($args);  ?>

         <?php } ?>      I was wondering how can I can modify the above code snippet to include the **featured image, post title, and permalink**. I would like to imitate "related posts". Looking forward to your input!


I need to count how many times a file in a particular sub-directory is downloaded and track who downloaded it. I'm using a Php file to do it, it isn't a WP file but I need to include WP to get the current user (if authenticated) and its roles (and maybe caps). Looking at Integrating WordPress with Your Website I first used:               define('WP_USE_THEMES', false);     require('../wp-blog-header.php');      But then I had a problem with the downloads, returning a error `404 (file not found)`. Lucky me on the footer of the same Codex article there's this suggestion: Fixing false 404 headers on external pages including wp-blog-header.php Following the suggestion I just used `init` which seem enough in my case:               require_once("../wp-config.php");     $wp->init();      Still, looking into `$GLOBALS` I think there's much more done and left than I need. I'm using `readfile` for the download, the file size maybe _huge_ , the user check is done before, the ideal would be to include a minimal WP as fast as possible and release the WP resources just after the user check, before the `readfile`. So, there's a way to include a minimal WP for check only the current user, its roles (caps?) and then release/free it? I seen also `wp-load.php` is used and looking/searching around found a lot of _no no_ about including all those `wp-*` directly, but all the results where about _including_ from a plugin, not my case, do I still need to worry about including directly?


Custom field losing p tags on display

I have a Custom Post Type that has several custom fields. One of the fields is multi-line and includes text with p tags. When I view this field in the visual editor the p tags are all there. I suspect the issue is how I am displaying the data in a custom template. This is the code that I am using in the template to pull this particular custom field                <?php $key="story"; echo get_post_meta($post->ID, $key, true); ?>      Is it the get_post_meta that is stripping these tags or something else? If it is this what should I be using instead? Thanks for any clues


Allow users to create post without logging in?

I have this project that requires guests to normally write a post without requiring them to be a user. By normally, I mean they can write posts by going to the posts edit screen like a normal user would do but with limitations. Is this possible?


Custom Post type plugin breaking the front page shows dashboard?

I am following the wp.tutsplus tutorial on Custom post types. Everything was fine until i added this code in my main plugin file               <?php add_filter( 'template_include', 'include_template_function', 1);?>          <?php function include_template_function(){         if( get_post_type() == 'movie_reviews' ){             if( is_single() ){                 if( $theme_file = locate_template( 'single-movie-reviews.php' ) ){                     $template_path = $theme_file;                 }                 else                      $template_path = plugin_dir_path( __FILE__ ).'single-movie-reviews.php';             }         }         return $template_path;     }     ?>       I can still access the dashboard and create new posts but front page is blank. if i remove this code page loads without any problem.


Wordpress multisite and one database

i need to use one database (i mean the same tables) with all sites under my network. I know about switching blog, but it's not good with wp-admin side (for example for custom post type i can't see the list of posts, only on one site in the network). How to share all "main" tables with all sites? Is there any way?


How to enqueue scripts in right way in a plugin?

I am developing a wordpress plugin and just came out with a problem with enqueue scripts. I want to enqueue JQUERY UI (.js) and (.css) in my plugin.   * Is it better to enqueue it from Google CDN or from Wordpress bundled?   * If in a wordpress admin page there are 2 plugins active and both used JQUERY UI of different versions. Then will it be a conflict or problem? I googled many pages and actually didn't still come with a perfect solution. Please share your experience and views regarding enqueue scripts in plugin.


Advanced Custom Fields plugin : displaying a YouTube video

On my page, I have many fields text area fields containing text, and one WYSIWYG field containing a YouTube video (I need it to be WYSIWYG because otherwise only the URL of the video would show, not the video itself). Problem: my text area fields have no tags other than br tags in them, whereas my WYSIWYG is full of p tags, creating layout misalignments. If I remove p tags from the WYSIWYG field containing the video (using $strip = array(' ',' '); echo str_replace($strip,'',$field);), then the iframe of the video becomes invisible, meaning it's there but it's gray in Firebug and doesn't show on the page. Any suggestions?


wp_list_pages - show pages immediately 1 level below current level

I'm setting up an events page in a wordpress site I'm building. Let's take a look at the page menu hierarchy: First of all there is a Events landing page. It will display four regions where events are held. Inside the region are the events. ![Menu example](http://i.stack.imgur.com/KZ39C.jpg) This page is working as intended. The problem arrises when you click through to these pages and what is now shown. When you click through to a region, I want a list of the events in that specific region to be shown. For example if you are on the page of region 2, I want all the events in region 2 listed. I've made sure I've set this up correctly in the backend, with parent pages and such. I'm using an example taken from the codex of wp_list_pages and I have created a new events template and created a new sidebar for the events template. I have added this within the sidebar of the events template (sorry a bit of a mouthful!): http://codex.wordpress.org/Function_Reference/wp_list_pages               <?php     if($post->post_parent)       $children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0&depth=1");     else       $children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0&depth=1");      class="icon-something">');     if ($children) { ?>
       <?php echo $children; ?>
     <?php } ?>      This code is currently showing a list of pages on the same level as the page. So if I'm on Region 1, it shows all the regions and nothing else. I want to be able to see the Events if I'm on a Region. I'm thinking this may be the wrong chunk of code I'm looking for and perhaps below is more what I need to go with? (child of).
     <?php     wp_list_pages('title_li=&child_of='.$post->ID.'&show_date=modified     &date_format=$date_format'); ?>
      If anyone has any better ways or creating this kind of menu hierarchy I would love to hear how you would approach this. Thanks people.


Where to put W3 Total Cache rewrite rules in .htaccess?

Should I put them in the following order or the order doesn't matter at all?               # BEGIN W3TC Browser Cache     # END W3TC Browser Cache     # BEGIN W3TC Page Cache core     # END W3TC Page Cache core     # WordPress default rewrite rules


Post Filter clearing on pagination $_post

I have a form, in which users can select what taxonomy they want the posts filtered by. It works fine except that it doesn't paginate. When I click on the next page of results, it clears the query. How do I get pagination to work? http://www.leschinskidesign.com.php5-10.ord1-1.websitetestlink.com/?post_type=products               <?php if(isset($_POST["submit_filter"])):         global $wp_query;              $params_array = array();              $params_array[] = array(                     'taxonomy' => 'factors',                     'field' => 'id',                     'terms' => $_POST["form_factors"]                 );              $params_array[] = array(                     'taxonomy' => 'badges',                     'field' => 'id',                     'terms' => $_POST["form_attributes"]                 );                      if(count($_POST["form_attributes"])==0 or count($_POST["form_factors"])==0){                     $params_array['relation'] =  'OR';                 }else{                     $params_array['relation'] =  'AND';                 }         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args = array_merge( $wp_query->query_vars, array(         'posts_per_page' => 1,         'order' => 'ASC',     'paged=' => $paged,          'tax_query' =>$params_array             ));              query_posts( $args  );     endif; ?>      As suggested I also tried using pre_get_posts, but the issue remained.               function product_query($query) {          if ( is_post_type_archive( 'products' ) ) {             if(isset($_POST["submit_filter"])):          $query->set('posts_per_page','2');          $params_array = array();          global $query_string;          $params_array[] = array(                 'taxonomy' => 'factors',                 'field' => 'id',                 'terms' => $_POST["form_factors"]             );               $params_array[] = array(                 'taxonomy' => 'badges',                 'field' => 'id',                 'terms' => $_POST["form_attributes"]             );                       if(count($_POST["form_attributes"])==0 or count($_POST["form_factors"])==0){                 $params_array['relation'] =  'OR';             }else{                 $params_array['relation'] =  'AND';             };                         if( ! empty( $params_array ) )             $query->set( 'tax_query', $params_array );     endif;      }               }          add_action('pre_get_posts', 'product_query', 1);


Custom Post type menu highlighted in the archive/post

I created a custom nav menu for my custom post type by custom links (linked to the archive page). Let say I have a custom post type named "product", and when I click on the menu, it will go to the archive page of 'product', and the 'product' will be highlighted. It is pretty easy since WP will automatically add the 'current-menu-item' class to the menu when in the 'product' archive page. But there is a problem, in the archive page, the 'current-menu-item' seem only add to the 1st page of the archive. When I go to page 2 the 'current-menu- item' is not added in the class, and the menu not highlighted. Apart of that, I also want the menu get highlighted when viewing the post under 'product' type. So I tried to add this code to the function:               function add_active_classes($classes = array(), $menu_item = false){     global $wp_query;          if(in_array('current-menu-item', $menu_item->classes)){         $classes[] = 'current-menu-item';     }          if ( $menu_item->post_type == 'product' && is_post_type_archive('product') ) {         $classes[] = 'current-menu-item';     }          if ( $menu_item->post_type== 'product' && is_singular('product') ) {         $classes[] = 'current-menu-item';     }               return $classes;     }     add_filter( 'nav_menu_css_class', 'add_active_classes', 10, 2 );      The result is nothing changed. What did I done wrong?


Echo SKU in WooCommerce Conformation page

I am able to display SKU in a single product page using Product Meta data but it looks like same method does not work on Order Conformation page. Is there any way to echo SKU in a order conformation page? I was able to echo product name by using `<?php foreach($order->get_items() as $item) { echo $product_name = $item['name'];} ?>` but it is not working for SKU.


$wpdb select date range of posts

0 down vote favorite Using this SQL query to sort users by how many votes(meta key) their posts have received.               <?php                                       global $wpdb;                                       $results = $wpdb->get_results ( "                                SELECT u.display_name as name,                                 ( SELECT SUM(pm.meta_value)                                   FROM wp_posts p, wp_postmeta pm                                   WHERE p.post_author = u.ID                                   AND p.post_status LIKE 'publish'                                   AND pm.meta_key = 'epicredvote'                                   AND p.ID = pm.post_id ) as votes                                   FROM wp_users u                                   ORDER BY votes DESC LIMIT 20                             " );                                  foreach ( $results as $result ) {                                          echo "{$result->name}: {$result->votes} votes
";                                  }                     ?>      Never really worked with a direct SQL query in wordpress before like this, it was always the wp loop or variations thereof. Anyway, this will display the username + their score (total). I'd like to do is limit this to a date range of posts, say a week. I think it'd be possible to use strtotime to do this, but I'm not sure of how.                 $date1 = date('Y-m-d', strtotime('+1 days'));         $date2 = date('Y-m-d', strtotime('-8 days'));      So to get posts in the last 7 days? Googled around but can't find much. Any help is appreciated. EDIT:- Full code that isn't working for some reason.               <?php                                       global $wpdb;                                   $date2 = date('Y-m-d', strtotime('-60 days'));                                   $weekly = $wpdb->get_results ( "                           SELECT u.display_name as name,                             ( SELECT                               CONCAT_WS('/',                                 SUM(CASE WHEN p.post_date < '$date2' THEN pm.meta_value ELSE 0 END),                                 SUM(pm.meta_value))                               FROM wp_posts p, wp_postmeta pm                               WHERE p.post_author = u.ID                               AND p.post_status LIKE 'publish'                               AND pm.meta_key = 'epicredvote'                               AND p.ID = pm.post_id ) as votes                               FROM wp_users u                               ORDER BY votes DESC LIMIT 20                         " );                                       foreach ($weekly as $result) {         $name = $result->name;         list( $weekly_vote, $total_vote ) = explode( '/', $result->votes ? $result->votes : '0/0' );         // do stuff with $name, $weekly_vote, $total_vote ...eg         echo  $name, '
', ' Weekly Vote: ', $weekly_vote,'
', ' Total Vote: ', $total_vote, '
', '
';     }                         ?>


Customise the Category Widget

Similar to my Search Widget question Is there a way to customise the Categories Widget? Again trying to add in extra markup. Thanks


Form Data Causes "Page Not Found"

If you go to http://redoakchrysler.net/vehicles/new-vehicle-inventory and select 2012 from the drop down menu in the years list, you will be taken to a 'page not found' page. But if you select any other year, or any other option in the drop down menus, it performs the search correctly. Has anyone ever experienced this before, or know why this is happening? Thanks in advance.


Is there a way to make a custom Page type?

In a theme I'm building, there are two main types of page. One is a product- gallery, one is for general info. I'd like to use `wp_get_pages()` or `wp_list_pages()` twice in the sidebar, one with a list of one type of page, and one with the other. I don't want to hard-code `include` or `exclude` in either list, as I can't predict which page IDs will be which type of page. So I'd like to do something like: > wp_list_pages('type=gallery') and > wp_list_pages('type=page') What technique should I be using here?


Transferring WordPress Site, Broken Links

I just downloaded a friends WordPress site and configured the database. The index.php page works at `http://localhost:8888/chepri/new/index.php` but all of the links are broke. Tailing the apache_error.log gives me:               [Mon Jan 13 18:03:54 2014] [error] [client ::1] File does not exist: /Applications/MAMP/htdocs/wp-content, referer: http://localhost:8888/chepri/new/      Do I need to configure something in my .htaccess? I currently have:               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /chepri/new/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /index.php [L]     </IfModule>          # END WordPress


Can I attach an image to a different post?

Image galleries display those images that were uploaded to that post, by default. If I wanted to move an image to a different post, so it appeared there instead, would I have to delete and re-upload? Or, is there a way to re- assign an image that's already in the Media Library?


Can't output the number 0 in widget

I have an input box where a user can input a number and then that number will be outputted into an html page. It all works fine except when you enter in the number 0 it doesn't output anything but it needs to say 0. This is a live baseball game scoring widget so I need "Inning 1" to read "0" if no runs were scored. Here is the gist of my code:               $t1Inning1 = ( $instance['t1Inning1'] ) ? $instance['t1Inning1'] : '-';
<?php echo $t1Inning1 ?>

<?php echo $t1Inning1 ?>
      <label for="<?php echo $this->get_field_id('t1Inning1'); ?>">      <input id="<?php echo $this->get_field_id('t1Inning1'); ?>"      name="<?php echo $this->get_field_name('t1Inning1'); ?>"      value="<?php echo esc_attr( $instance['t1Inning1'] ); ?>"      maxlength="2" size="3" />           You can see the output at http://juniorregionals.com/ in the middle left. The '-' is just the default value which doesn't change when you input 0 in the widget and save it but again I need it to read 0 if you input 0. If I change it to :               $t1Inning1 = isset( $instance['t1Inning1'] ) ? $instance['t1Inning1'] : '-';      it does output a 0 if thats what you put in but then the res of the inning don't show a default slash. the output is empty. So reiterate I need to be able to enter a 0 and have it output a 0 and if the input is empty I need it to have a dash (-). Let me know if I need to be more specific.


Why does Wordpress Heartbeat login not refresh the nonces?

Here's an interesting experiment: Go to wordpress plugins listing page, notice the activate, deactivate links all have a nonce part in the request. In a second tab, log out of the site, and go back to plugin listing page. After awhile, the page realizes it's not logged in, and pops up a log in screen. Log in, and click an "activate" or "deactivate" button. Notice it gives the nonce-failure message, "are you sure you want to do this"? Because the previous session's nonces don't work. Why does Wordpress not know to refresh these nonces? I thought new nonces would be sent back as a heartbeat-ajax, but it looks like there isn't an ajax request with the login screen. Update: It seems this is called when the user logs in, but I guess not too many scripts are smart about acting on this trigger?               $( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {             if ( 'wp-auth-check' in data ) {                 schedule();                 if ( ! data['wp-auth-check'] && wrap.hasClass('hidden') ) {                     show();                 } else if ( data['wp-auth-check'] && ! wrap.hasClass('hidden') ) {                     hide();                 }             }         }).


How to filter user list by role on page template

The template below displays a directory of restrict content pro users. It works just as it should. I'd like to now filter these results based on custom role (let's say "member"). I thought I could add role => "member" to the args, but that didn't work. I would like help understanding how to only show particular roles on this page template.               <?php     /**      * This file adds the User Directory template to the Minimum Theme.      *      * @author StudioPress      * @package Parallax      * @subpackage Customizations      */          /*     Template Name: Directory     */                    add_action( 'genesis_entry_content', 'ogs_directory', 5 );     function ogs_directory() {             $args = array(                 'blog_id'      => 1, // unless yours is a multisite install, you shouldn't need to change this                 'exclude'      => array(), // IDs of users that need to be excluded                 'orderby'      => 'display_name' // Sort by 'ID', 'login', 'nicename', 'email', 'url', 'registered', 'display_name', or 'post_count'; defaults to 'login'              );              $members = rcp_get_members();             usort($members, create_function('$a, $b', 'return strnatcasecmp($a->last_name, $b->last_name);'));             foreach ($members as $member) {                        echo '
';                 echo get_avatar($member->ID,60);                 echo '
';               echo '
';               echo '
';                      echo '
' .esc_attr( $member->first_name ).  '
 ' ;                 echo '
' .esc_attr( $member->last_name ).  '

 ' ;                 echo '
';                 if ( $member->rcp_address ) {                 echo '' .esc_attr( $member->rcp_address ).  ', ' ;                 }                 if ( $member->rcp_city ) {                 echo '' .esc_attr( $member->rcp_city ).  ', ' ;                 }                 if ( $member->rcp_state ) {                 echo '' .esc_attr( $member->rcp_state ).  '' ;                 }                 if ( $member->rcp_zip ) {                 echo ' ' .esc_attr( $member->rcp_zip ).  '
 ' ;                 }                 if ( $member->rcp_phone ) {                 echo '' .esc_attr( $member->rcp_phone ).  '
 ' ;                 }                 echo '
';                 echo '
';                 echo '
';                 if ( $member->rcp_company_organization ) {                 echo 'Company: ' .esc_attr( $member->rcp_company_organization ).  ',  ' ;                 }                 if ( $member->rcp_title ) {                 echo '' .esc_attr( $member->rcp_title ).  '
 ' ;                 }                 if ( $member->rcp_other_membership ) {                 echo 'Other Memberships: ' .esc_attr( $member->rcp_other_membership ).  '
 ' ;                 }                 if ( $member->rcp_univ_1_degree ) {                 echo 'University: ' .esc_attr( $member->rcp_univ_1_degree ).  ', ' ;                 }                 if ( $member->rcp_univ_1 ) {                 echo '' .esc_attr( $member->rcp_univ_1 ).  ', ' ;                 }                 if ( $member->rcp_univ_1_year ) {                 echo '' .esc_attr( $member->rcp_univ_1_year ).  ', ' ;                 }                 if ( $member->rcp_univ_1_major ) {                 echo '' .esc_attr( $member->rcp_univ_1_major ).  '
 ' ;                 }                            if ( $member->rcp_univ_2_degree ) {                 echo 'University: ' .esc_attr( $member->rcp_univ_2_degree ).  ', ' ;                 }                 if ( $member->rcp_univ_2 ) {                 echo '' .esc_attr( $member->rcp_univ_2 ).  ', ' ;                 }                 if ( $member->rcp_univ_2_year ) {                 echo '' .esc_attr( $member->rcp_univ_2_year ).  ', ' ;                 }                 if ( $member->rcp_univ_2_major ) {                 echo '' .esc_attr( $member->rcp_univ_2_major ).  '
 ' ;                 }                 if ( $member->rcp_univ_3_degree ) {                 echo 'University:  ' .esc_attr( $member->rcp_univ_3_degree ).  ', ' ;                 }                 if ( $member->rcp_univ_3 ) {                 echo '' .esc_attr( $member->rcp_univ_3 ).  ', ' ;                 }                 if ( $member->rcp_univ_3_year ) {                 echo '' .esc_attr( $member->rcp_univ_3_year ).  ', ' ;                 }                 if ( $member->rcp_univ_3_major ) {                 echo '' .esc_attr( $member->rcp_univ_3_major ).  '
 ' ;                 }                                        echo '
';             echo '
';                   }   }          //* Run the Genesis loop     genesis();


Inconsistent temporary 404s on whole install | PHP error with post-template.php

I'm deeply confused by this one: I have a WordPress install on a Media Temple GS [one of many which work fine and are configured almost exactly the same] which is occasionally giving me 404s sitewide. When this happens I get 3 errors together in my PHP error log:               [01-Nov-2013 22:20:50 UTC] PHP Notice:  Trying to get property of non-object in /nfs/---/---/mnt/---/domains/---.---/html/wp-includes/post-template.php on line 275     [01-Nov-2013 22:20:50 UTC] PHP Notice:  Trying to get property of non-object in /nfs/---/---/mnt/---/domains/---.---/html/wp-includes/post-template.php on line 209     [01-Nov-2013 22:20:50 UTC] PHP Notice:  Trying to get property of non-object in /nfs/---/---/mnt/---/domains/---.---/html/wp-includes/post-template.php on line 29      The first two relate to the `$post` object & the 3rd to this: `get_post()->ID;` Which I think is the creation of the `$post` object. I have two of these identical trios of error messages almost exactly 25 minutes apart [off by 2s]. I've tried MT support but they think it must be a WP error. I'm running the latest version of WP but have experienced this problem with earlier versions. I had 2 plugins enabled: W3 Total Cache & AJAX Thumbnail Rebuild I've tested with and without the cache plugin and the problem persists. I've just disabled the thumbnail plug to see if it makes any difference. Please help this is driving me insane! [and I wanted to publicly launch this site today] _**EDIT_** I should have also mentioned that I have seen this error on some but not all of the other wordpress installs on this server. I think but cannot be 100% sure, that those showing errors are newer installs than the ones working fine. Though all installs are fully updated. _**EDIT2_** I'm just working on another WP project and realised at least what those 3 errors mean. I can reproduce exactly those three php errors by going to the index page of a custom post type that does not exist. However this doesn't explain why that would cause the 404 in this question, especially as it doesn't just happen only on custom post type index pages. However I think this must be related to custom post types in some way.


Nothing happens on Wordpress Update command

I made a function in Wordpress, which should update one field **status** to **0**. But no changes are made to the database. I don't know what is the reason. Can someone please help. I tried looking into wordpress own **wp- db.php** , and seen that the same array is going there as well.                       function updateData($temp_array){                 global $wpdb;                 $temp_array = array('status', '0');                 echo $wpdb->update( 'wp_testing_options', $temp_array, array( 'id' => 1 ) );             }


How can I cycle posts with a #next and #previous script?

So, I'm having trouble trying to figure out how I would go about coding this kind of implementation for a Wordpress site. I have the first part done but am a little confused on how I would go about actually making this work. So I'll post some of my code, and screenshot that might be able to help you better understand what I am trying to accomplish.

          <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
                   <?php the_time('D, jS, Y') ?>                    <?php the_category(', ') ?>
<?php the_content(); ?>

              <?php endwhile; else: ?>         <?php endif; ?>

            So pasted above is what my blog template looks like. It fetches your basic article and just ignore the aside stuff (it's for icons). Anyways, I'm thinking of linking the articles with some javascript / jquery listed below. So that when #_btnUp is clicked it can cycle to the previos article, and when #_btnDown is clicked is cycles to the next article.                            http://cl.ly/image/2I0H2O2i2L24 Posted above is a screenshot of what I'm trying to accomplish. What I want to happen is if the arrows are clicked it only shows one post / cycles through them. Though, the problem is I don't know how to piece it together. So I'm asking for your help. Does anyone know how to guide me on how to get this accomplished :) Thanks! :D


How ( and mostly at what time ) can i prevent the alternate cron from running?

I'm using the alternate cron version, but i need to prevent it from running on some calls, how can i do this? In the cron.php file i've seen on line 225               if ( defined('ALTERNATE_WP_CRON') && ALTERNATE_WP_CRON ) {         if ( !empty($_POST) || defined('DOING_AJAX') )             return;      but i've tried defining `define('DOING_AJAX', true)` and it never stops the cron. Maybe i'm defining the constant too late. When should i define it?


Multilingual website suggestions

I want to create a multilingual website using wordpress. The site will completely change its direction when it is switched to the second language i.e. Aabic and will reverted back to its original language i.e. English. Suggest the good way to do this. I have the following ideas:   1. Use google translator (there are limitations).   2. Create another totally separate website in arabic using http://ar.wordpress.org/ and redirect the original site to this one when user changes the language.   3. use "Multilingual Press"   4. I have heard that this can be achieved by doing some changes in wp-config.php file as well. Please let me know the better way of doing this Thanks


Checking if a specific date archive is being displayed

The `is_month()`, `is_year()` or `is_week` functions don't accept arguments. Are there any other functions available that I'm able to use to determine if I'm viewing specific month/year/week archive ? Or do I have to go trough WP globals to find the current month/year/week?


How to get a list of taxonomy terms which are being used only within certain post types?

I have a custom taxonomy called 'locations' which is being shared across a bunch of post types. I want to make a select field dropdown list of my locations (terms) to let users go to the taxonomy term page for each specific location; however I want to exclude some terms which are used in one post type and perhaps not in the others. Is there a way to accomplish this?


Configure WordPress Multisite Pages with Custom Permalinks

I've just created a new WordPress multisite install and am having an issue with custom permalinks (the standard 'Day and Name' option) to the pages for the main site. I'm using the standard config presented when configuring a network (see SubFolder Example here) and have my .htaccess set to mod 666 (writable by all). I currently have one sub-site configured which creates a 'Sample Page' page. This link works fine, but the link to an 'About' page I've created for the main site just re-displays the main page. Here's the .htaccess file I'm using:               RewriteEngine On     RewriteBase /     RewriteRule ^index\.php$ - [L]          # uploaded files     RewriteRule ^([_0-9a-zA-Z-]+/)?files/(.+) wp-includes/ms-files.php?file=$2 [L]          # add a trailing slash to /wp-admin     RewriteRule ^([_0-9a-zA-Z-]+/)?wp-admin$ $1wp-admin/ [R=301,L]          RewriteCond %{REQUEST_FILENAME} -f [OR]     RewriteCond %{REQUEST_FILENAME} -d     RewriteRule ^ - [L]     RewriteRule ^[_0-9a-zA-Z-]+/(wp-(content|admin|includes).*) $1 [L]     RewriteRule ^[_0-9a-zA-Z-]+/(.*\.php)$ $1 [L]     RewriteRule . index.php [L]      What can I do to get this working?


Problem with <code> tag

Where you can see it: http://themeforward.com/demo2/functional-codes The first button is my code, as it should appear. The second button is within `<pre><code></pre></code>` tags to show users how I made the button appear. But instead of showing the code, the button is generated. **How can I get WordPress' code tag to work for ALL code? HTML, PHP, and CSS. Something I can paste in my functions would be preferred.** The actual code for the button (a shortcode)               [pdf href="http://www.constitution.org/usdeclar.pdf"]Declaration of Independence[/pdf]


Preferred Method of debugging a wordpress SQL calls?

What is your preferred method of debugging Wordpress Applications when writing custom behind-the-scenes SQL calls, etc. ? Coming from a Rails background, I usually tail a log file that displays not only all the processes and views that are being seperately loaded into a template, but if there is an error, it will pin point the **exact** location of the error, with a suggested idea of what went wrong. I noticed that in WordPress, you can set up a debug.log file but it only shows a _very_ barebones version of this, and rarely points to what actually is failing. Any recommends?


Admin interface problems - thickbox? jquery?

All of a sudden the thickbox functionality in the wordpress admin seems to have died and I'm having a hard time figuring out why that is and how to fix it. Clicking the featured image button loads the content into the window rather than a modal. Clicking the edit beside 'published' in the 'publish' box does nothing at all (which I recognize isn't thickbox, so I'm thinking it has to be something else). I'm assuming this is something to do with either jQuery or thickbox, but I'm not sure how to figure out where the problem is and I couldn't find another question with the same errors. Unfortunately it's on the live site (so I can't turn on wp-debug) and when I made a mirror to my local server the problem didn't show up. Any thoughts?


Add the last viewed post title to a contactform with shortcode

I'm using the **contactform 7** plugin and i want to add the title of the last viewed page (The page visited before the contact) to the dynamic field of the plugin with a shortcode. Is there a way to do that? I found this plugin Last Viewed Posts to display the last visited post. But I can't found a solution to add this to the dynamic field of my contactform. Would be very nice if someone could help me. Thanks, Oli


Wordpress wallpaper Plugin

hii I am making a site related to entertainment which also has Movies Wallpapers category where i want that i can add new Movie wallpapers in single post and People can View and download them easily ? So it will be very difficult to check all Available Plugins So i need suggestions which plugin is better for my Idea Site ?


Upload box media size not working

I recently downloaded wordpress 3.5.1 and installed it on my website. This should be the website that is launched in the air. On the demo site when i click on Add Media and want to change the image to thumbnail / medium / large / full screen it works. Now in the version i launched in the air i can only select full screen and not thumbnail / medium or large. I only changed my thumbnail at the options-media page for 150 x 150, large to 500 x 398. Any help ?


Custom post types as categories for another custom post type

I have a custom post type of companies that contains company details, I would like to setup another custom post type of news, with each news post being associated to one of the companies. Is it possible to populate the category for the news automatically with the posts generated in the companies custom post type. This cant be a manual process as this is being passed onto clients. Thanks


Custom page templates readmore tag is not working.   When I insert readmore before some word (in WP Editor) that's not working when I visit the page. I don't need `post_excerpt();`


Archives and category of authors

Description of the problem: I should make a blog with, let's say 4 authors (may be more).   The blog shoud have a page 'blog-page-1' (without sidebar) on which will be the last post of each author and a page 'blog-page-2' (with sidebar) on which will be diplayed only posts of a specific author, depends on which post user clicked on 'blog-page-1'.   Also blog sidebar should have recent-posts, archives and categories of that author, clicking on which will display 'blog-page-2' with the specific content. Any ideas how to make archives and category of specific author? Page 'blog-page-1' I will do as is written here (http://wordpress.org/support/topic/query-post-to-show-one-post-per-author). Also I found for author posts display this (http://wordpress.stackexchange.com/questions/71127/list-authors-posts-in- author-php)


Group posts by meta_key

I have a Problem with grouping meta_values. The Query looks for posts with the meta key "company". I want a unique listing of the colors like: blue red yellow array_unique was not successful and also custom mysql query.               <?php     $args = array(            'category_name' => $cat_name,            'posts_per_page' => '60',            'paged' => $current_page,            'meta_query' => array(                array(                    'key' => 'company',                    'value' => 'microsoft',                    'compare' => 'like'                )             )          );      $my_query = new WP_Query($args);     while ($my_query->have_posts()) : $my_query->the_post();     $do_not_duplicate = $post->ID;     ?>          <?php echo get('color'); ?>      // Outputs yellow yellow blue yellow red yellow          <?php endwhile; ?>      Current output is: yellow yellow blue yellow red yellow Edit: This is the final working code:               <?php      $current_page = (get_query_var('paged')) ? get_query_var('paged') : 1;      $cat_name = get_category(get_query_var('cat'))->name;               $args = array(        'category_name' => $cat_name,        'posts_per_page' => '60',        'paged' => $current_page,        'meta_query' => array(            array(                'key' => 'company',                'value' => 'microsoft',                'compare' => 'like'            )         )      );      $my_query = new WP_Query($args);     while ($my_query->have_posts()) : $my_query->the_post();     $do_not_duplicate = $post->ID;     $colors[] = get('color');          // Creates an array of all colors          endwhile;     $colors = array_unique($colors);     // Removes duplicates;     foreach($colors as $color){     echo $color.' ';     } ?>


Can I have two single.php files and have one display just the post and the other display comments for that specific post?

Obviously, I know I can't have two single.php files. The one with the comments would have to have a different name...maybe single-comments.php or something. I am working on a restaurant reviews site and because of lack of space on the page, I have decided to show some excerpts of the latest comments (customer reviews) on the side of the page and then create a link to all the other comments (customer reviews) and the comment form on another page. I have thought of lightboxes but I don't think it is ideal for what I want to achieve. Any suggestions on how to get this done? Thanks. **EDIT:** I created a page template for the comments and named it comments- side.php. Here is the code:               <?php     /*      * Template Name: Comments Page      */      global $data; //get theme options          ?>

                      <?php if ( have_comments() ) : ?>
<?php comments_number( __( 'No Comments', 'supreme' ), __( 'One Comment', 'supreme' ), __( '% Comments', 'supreme' ) ); ?>
                          <?php do_atomic( 'before_comment_list' );// supreme_before_comment_list ?>                          <?php if ( get_option( 'page_comments' ) ) : ?>
                             <?php printf( __( 'Page %1$s of %2$s', 'supreme' ), ( get_query_var( 'cpage' ) ? absint( get_query_var( 'cpage' ) ) : 1 ), get_comment_pages_count() ); ?>                             <?php paginate_comments_links(); ?>
                     <?php endif; ?>
                         <?php wp_list_comments( hybrid_list_comments_args() ); ?>
                          <?php do_atomic( 'after_comment_list' ); // supreme_after_comment_list ?>                      <?php endif; ?>                      <?php if ( pings_open() && !comments_open() ) : ?>
                         <?php printf( __( 'Comments are closed, but trackbacks and pingbacks are open.', 'supreme' ), get_trackback_url() ); ?>
                      <?php elseif ( !comments_open() ) : ?>
                         <?php _e( 'Comments are closed.', 'supreme' ); ?>
                      <?php endif; ?>
                  <?php $comment_args = array( 'fields' => apply_filters( 'comment_form_default_fields', array(                             'author' => '
' .                                         '<input id="author" name="author" type="text" value="' .                                         esc_attr( $commenter['comment_author'] ) . '" size="30"' . @$aria_req . ' PLACEHOLDER="'.__('Your name','supreme').'"/>' .                                         ( $req ? ' *' : '' ) .                                         '
',                             'email'  => '
' .                                         '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . @$aria_req . ' PLACEHOLDER="'.__('Email Address','supreme').'"/>' .                                         ( $req ? ' *' : '' ) .                                 '
',                             'url'    => '
' .                                         '<input id="url" name="url" type="text" value="' . esc_attr(  $commenter['comment_author_url'] ) . '" size="30"' . @$aria_url . ' PLACEHOLDER="'.__('Website','supreme').'"/>'.'
')),                             'comment_field' => '
' .                                         '<textarea id="comments" name="comment" cols="45" rows="8" aria-required="true" PLACEHOLDER="'.__('Comments','supreme').'"></textarea>' .                                         ( $req ? ' *' : '' ) .                                         '
',                             'comment_notes_after' => '',                             'title_reply' => __( 'Add a comment', 'supreme' ),                         );                         if(get_option('default_comment_status') =='open'){                             comment_form($comment_args); } // Loads the comment form.  ?>

      I created a page in Wordpress' admin and selected the comments page template for that page. This is what I have in functions.php to handle comments:               function mytheme_comment($comment, $args, $depth) {             $GLOBALS['comment'] = $comment;             extract($args, EXTR_SKIP);                  if ( 'div' == $args['style'] ) {                 $tag = 'div';                 $add_below = 'comment';             } else {                 $tag = 'li';                 $add_below = 'div-comment';             }     ?>             <<?php echo $tag ?> <?php comment_class(empty( $args['has_children'] ) ? '' : 'parent') ?> id="comment-<?php comment_ID() ?>">             <?php if ( 'div' != $args['style'] ) : ?>             <div id="div-comment-<?php comment_ID() ?>" class="comment-body">             <?php endif; ?>
             <?php if ($args['avatar_size'] != 0) echo get_avatar( $comment, $args['avatar_size'] ); ?>             <?php printf(__('%s says:'), get_comment_author_link()) ?>
     <?php if ($comment->comment_approved == '0') : ?>             <?php _e('Your comment is awaiting moderation.') ?>
     <?php endif; ?>
<a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>">                 <?php                     /* translators: 1: date, 2: time */                     printf( __('%1$s at %2$s'), get_comment_date(),  get_comment_time()) ?><?php edit_comment_link(__('(Edit)'),'  ','' );                 ?>
                  <?php comment_text($comment_ID); ?>                   <a href="comments-side/#comment-<?php comment_ID() ?>" class="comment-more">read more
             <?php comment_reply_link(array_merge( $args, array('add_below' => $add_below, 'depth' => $depth, 'max_depth' => $args['max_depth']))) ?>
             <?php if ( 'div' != $args['style'] ) : ?>
             <?php endif; ?>     <?php             }      And this is how I am calling the comments in the side of single-restaurant.php

Recent Reviews
       <?php comments_template( '/comments-side.php', true ); // Loads the comments-side.php template. ?>
      There is another comment file (comments.php) that handles comments on the blog. What should I change or get rid of? What am I doing wrong? Thanks.


Cannot access empty property error in Advanced Access Manager

As explained in the reply of this post by the Advanced Access Manager's author I've changed the current getCurrentUserRole function in the path `/wp- content/plugins/advanced_access_manager/module` with this new code:               function getCurrentUserRole() {         if (is_object($this->data) && isset($this->data->{$this->cap_key})) {            $result = $this->data->{$this->cap_key};         } else {            $result = array();         }             return $result;     }      But I get an error when trying to access through `www.foosite.com/wp-admin`. Here is the apache log error message: > PHP Fatal error: Cannot access empty property in /var/www/foosite/wp- > content/plugins/advanced-access-manager/module/class-module_user.php on line > 29 The line error corresponds with the if statement, so I've tried to fix it using `isset`:               function getCurrentUserRole() {         if (isset($this->data) && is_object($this->data) && is_array($this->data->{$this->cap_key})) {             $result = array_keys($this->data->{$this->cap_key});         } else {             $result = array();         }         return $result;     }      Unfortunately the error remains the same. Any suggestions?


How can I hide admin columns showing extra custom taxonomy fields?

I'm adding extra custom taxonomy fields to a custom taxonomy called, let's say, "Beer Style" (or "beer-style", in the screenshot, for now), with extra custom fields like "Alcohol by Weight (Volume)," "Alcohol by Weight," etc, on top of the "slug" and "description" fields that go with the custom taxonomy. There's a bunch of extra fields I'd like to add, but it's fast crowding out the rest of the table listing all the taxonomy terms. Trying to figure out, is there a way to hide all the columns for the custom fields? Thanks.


Shortcode Variations?

The function below creates a button when used like so [btn]Button Text[/btn]               function btn($atts, $content = null) {        extract(shortcode_atts(array('link' => '#'), $atts));        return '' . do_shortcode($content) . '';     }      I'd like to be able to add two variations to this, color and size which would allow the button to be called with variations, like this: `[button color="teal" size="large"]Button Text[/button]` But I can't figure out how to do this. Anybody have a code?


Automatically search and replace link in content (pages/posts)?

The users of my site mainly share documents by inserting links into content (pages/posts) using the built in editor. These files include everything from pdfs to word documents. The users currently get/copy these links from a php file manager like FileRun. My goal is to have the users instead use a path from mapped network drive such as \testdrive\Folder1\Folder2\test.txt. The following function has been written to handle replacing the mapped network drive files to an internet link such as "http://page.test.org/files/".               <?php     function test_test_url_parse($string)     {     // Called by test_test_url_parse_wrapper()     // The nature of preg_replace means this needs a seperate function         $bits=explode("\\",$string);         $bobs=array();         foreach ($bits as $bit)         {             $bobs[]=urlencode($bit);         }         return "\"http://page.test.org/files/".implode("/",$bobs)."\"";     }          function test_test_url_parse_wrapper($string)     {     //Finds/replaces UCNs with URLs in the provided string.          $pattern1="~\"[a-z]{1}:\\\([^\"]+)\"~ie";         return preg_replace($pattern1, "test_test_url_parse('$1')", $string);     }     ?>      Where could I put a function like this to automatically look through the content of a page or a post and replace the filepath accordingly? Would there theoretically be any way to put this just in the child theme? Currently when I upload media such as photos, it is already putting the files into the path "http://page.test.org/files/". I'm really looking for have function go through the post/page content and perform essentially a constant "search and replace"


output only if within a combination of two cats

What Im looking to do is look if on one page out put posts that have 2 cats selected (they must have both selected to be shown, not just one cat)               if (is_page(15) || $post->post_parent=="15") {       $option1 = '11, 4';       $option2 = '11, 7';}            <?php $my_query_args = array(            'posts_per_page' => 10,           'meta_key' => 'price',               'meta_value_num' => '',              'orderby'  => 'meta_value_num',            'order' => 'asc',            'tax_query' => array(               array(                  'taxonomy' => 'category',                   'field' => 'id',                  'terms' => array( $inventory_home ),                 'operator' => 'AND'               )            )       );     $my_query = new WP_Query( $my_query_args );?>


change content based on url per plugin

I have a wordpress page that uses a custom template I created. The url looks like this:               http://localhost/custom      What I want to do, is have the content for this page change, depending on the _action_ (is that what you call it?). e.g.               http://localhost/custom/people     http://localhost/custom/animals     http://localhost/custom/places      How would I accomplish this?


On single.php, fetch 2 posts created after and 2 posts created before in relation to the actual post (using menu_order)

Looking for a way to on single.php fetch and show the actual post, and then by looking on the menu_order value of that specific post (lets say the post have menu_order value 3 in this case) go and fetch the 2 posts before that one i.e. the posts with menu_order value 1 and 2. Also fetch 2 posts after, i.e. the posts with the value 4 and 5. And how you'd check to see if there even are as many as +/- 2 posts in relation the the current post. Anyone have an idea how to sort that out?


How to call a custom post with get_posts() instead of query_posts()?

I currently use `query_posts` to show these custom posts but I'm pretty sure that I should uses `get_posts()` to write it correctly.               <?php query_posts( array( 'type-mario' => 'games', 'showposts' => 10 ) ); ?>
Mario games
     <?php while ( have_posts() ) : the_post(); ?>      <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php the_title(); ?>

     <?php endwhile; ?>     <?php wp_reset_query(); ?>      Thanks for your advice.


Hide a theme on list of themes in wp-admin without editing core files

I'm running a multisite network with 200+ themes installed and activated. Is there a way to manipulate the list of available themes in wp-admin so that **certain theme does not appear in the list**? I want to do it without editing core files. I know WordPress gets the list of available themes from the function `get_themes()`. And that there is a function called `get_allowed_themes()` that might be the solution. But no idea about how to use it.


How to make a WP admin button/menu similar to Jetpack Notifications?

I would like to add a button to the WP admin toolbar, similar to the Notifications feature released in Jetpack 1.9.1 (I think it was). The notifications icon is displayed beside the account button, to the right. I am only looking to display a form in the dropdown, for clients to contact me if they have questions - using AJAX for sending. This question only concerns the toolbar and getting the button and submenu dropdown in place. **UPDATE** : Here is a screenshot (as requested): I just want to replace this with a form and no additional sublevel menus ![Jetpack notifications](http://i.stack.imgur.com/GvoQe.png)


Removing hierarchical pages in the permalink

I have several pages set up in a hierarchy on my site. Currently the site's pages and URLs look like this.               Page name        | Current URL           | Preferred URL      -----------------|----------------------------------------     Page AAA         | /pageAAA/             | /pageAAA/     |-- Page BBB     | /pageAAA/pageBBB/     | /pageBBB/     Page CCC         | /pageCCC/             | /pageCCC/     Page DDD         | /pageDDD/             | /pageDDD/     |-- Page EEE     | /pageDDD/pageEEE/     | /pageEEE/      I would like to strip the page hierarchy from the URL and just use the page name instead. Currently this is not a problem for the "POSTS" as I have set the "Permalink" to `/%postname%/` **Edit:** The reason that I want to do this is; I am importing a existing site into wordpress. The Existing site has a hierarchy for the pages (menu) but a flat url structure. I do not know if this has any added benefit for SEO but I want to keep the URL structure the same as the old site


Redirect page for a custom post type

I have the following custom post type                       register_post_type('cp_clients', array(                 'labels' => array(                     'name' => __('Clients'),                     'singular_name' => __('Client')                 ),                 'public' => true,                 'has_archive' => true,                 'supports' => array('thumbnail', 'title', 'editor')                     )             );      I want to output custom content when the user calls http://blogurl.com/companies. It's a plug-in and not a theme. Any ideas how I can redirect to a custom page/output for this URL?


force enqueue script to be first in order of prominence

I have a few scripts which are being enqueued, the problem is that I want to force the order of prominece to which these scripts are loaded. There is one in particular which is loaded from a plugin before the theme ones which requires jquery however the plugin does not require jquery (bad dev on the plugin but I'd rather not touch 3rd party code for futureproofing reasons) is there some way to mess with the enqueue order at runtime? Thanks very much


Can I load posts via Ajax?

I would like to make a portfolio page where each entry (a post) would be fetched using Ajax. This way I would have an image gallery, but in which I not only would have images but also the description of the work, if it's for sale, the url to the shop, and whatever other random fields. A gallery is not good enough because there is no clean way of displaying text belonging to each image's post.


how to get the categories for a single post in a hierarchical way

The question is simple.   Imagine that I have a post named 'Single Post' which is inside the category 'sub-cat' which is a child of 'parent-cat' which is a child of 'super-cat'. What I need to do is to display all the related categories within the post page in the following order:               super-cat > parent-cat > sub-cat > Single Post


Disable All In One SEO Pack for some custom post types

I have a Wordpress site using custom post types, and I have also got the All In One SEO pack installed. I wondered if anyone knows a hack or a modification I can make to the code which will allow me to stop the pictured area from showing up on certain custom post types? ![enter image description here](http://i.stack.imgur.com/QW0On.png) Any help much appreciated.


Restrict access and display for categories

Is it possible to choose specific categories that will only be displayed to logged in members? I tried to find a plugin or a PHP solution that does that but could not find anything that was still relevant.


Viewing category pages without the word 'category' in URL

1. When I view a static page its url is like: `http://example.com/mybooks/`   2. When I view a category page its url is like: `http://example.com/category/books-ebooks/` For SEO, I want some modification so that I do not have to use the word `category` to view category pages. e.g. it should be `http://example.com/books-ebooks/` instead of `http://example.com/category/books-ebooks/`   * How can this be done?    * I see a potential problem that WordPress engine may not be able to differentiate between pages and categories. Is it so?   * What are other pros and cons?


Enhancin 404 to contain a search from URL

I have migrated to WordPress from other (probably unknown to you) free blogging site (bloguje.cz if you are curious) The issue is, that previous system had sometimes URL ending with ".php" and sometimes not. So external links to my page can look both ways:                http://www.tasselhof.com/123456-example-page.php      http://www.tasselhof.com/654321-another-example      I decided that on Wordpress, **all** my pages will have custom URL containing ".php" at the end. And now I am facing the fact, that _some_ users can _sometimes_ receive "404" page when going to my site from the "another example" link. So i would like to "tweak" my 404 page to contain all the words from URL in search result and search for it. So it would contain "another example" as searched item. I am using WordPress installation downloaded from czech community page - (everything translated into Czech) and default theme - Twenty Eleven 1.2


Problem with wp_insert_post

i'm sorry for my english. I have a problem with the function wp_insert_post in a script. I'm trying to create a new post when i receive a notification from paypal. Everything works fine untill i try to create a new post in the database. This is my code:               <?php include_once($_SERVER['DOCUMENT_ROOT'].'/wp-load.php');                           // Send an email announcing "received IPN"                 $mail_From = "xxxxxx@gmail.com";                 $mail_To = "xxxxxx@gmail.com";                 $mail_Subject = "received IPN";                 $mail_Body = $req;                 mail($mail_To, $mail_Subject, $mail_Body, $mail_From);          ?>     <?php          // STEP 1: read POST data          // Reading POSTed data directly from $_POST causes serialization issues with array data in the POST.     // Instead, read raw POST data from the input stream.      $raw_post_data = file_get_contents('php://input');     $raw_post_array = explode('&', $raw_post_data);     $myPost = array();     foreach ($raw_post_array as $keyval) {       $keyval = explode ('=', $keyval);       if (count($keyval) == 2)          $myPost[$keyval[0]] = urldecode($keyval[1]);     }     // read the IPN message sent from PayPal and prepend 'cmd=_notify-validate'     $req = 'cmd=_notify-validate';     if(function_exists('get_magic_quotes_gpc')) {        $get_magic_quotes_exists = true;     }      foreach ($myPost as $key => $value) {                if($get_magic_quotes_exists == true && get_magic_quotes_gpc() == 1) {              $value = urlencode(stripslashes($value));         } else {             $value = urlencode($value);        }        $req .= "&$key=$value";     }               // STEP 2: POST IPN data back to PayPal to validate          $ch = curl_init('https://www.paypal.com/cgi-bin/webscr');     curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_1);     curl_setopt($ch, CURLOPT_POST, 1);     curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);     curl_setopt($ch, CURLOPT_POSTFIELDS, $req);     curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 1);     curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 2);     curl_setopt($ch, CURLOPT_FORBID_REUSE, 1);     curl_setopt($ch, CURLOPT_HTTPHEADER, array('Connection: Close'));          // In wamp-like environments that do not come bundled with root authority certificates,     // please download 'cacert.pem' from "http://curl.haxx.se/docs/caextract.html" and set      // the directory path of the certificate as shown below:     // curl_setopt($ch, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');     if( !($res = curl_exec($ch)) ) {         // error_log("Got " . curl_error($ch) . " when processing IPN data");         curl_close($ch);         exit;     }     curl_close($ch);          // STEP 3: Inspect IPN validation result and act accordingly          if (strcmp ($res, "VERIFIED") == 0) {                           // Send an email announcing "enter in verified IF"                 $mail_From = "xxxxxxx@gmail.com";                 $mail_To = "xxxxxxx@gmail.com";                 $mail_Subject = "enter in verified IF";                 $mail_Body = $req;                 mail($mail_To, $mail_Subject, $mail_Body, $mail_From);              // You should validate against these values.                 $donCause       = $_POST['item_number'];                 $txnID          = $_POST['txn_id'];                 $firstName      = $_POST['first_name'];                 $lastName       = $_POST['last_name'];                 $addressCountry = $_POST['address_country'];                 $addressCity    = $_POST['address_city'];                 $addressStreet  = $_POST['address_street'];                 $addressZip     = $_POST['address_zip'];                 $payerEmail     = $_POST['payer_email'];                 $payment_gross  = $_POST['mc_gross'];                 $payment_status = $_POST['payment_status'];                      if ($payment_status == 'Completed') {                          // Send an email announcing "enter in payment_status==completed"                     $mail_From = "xxxxxx@gmail.com";                     $mail_To = "xxxxxx@gmail.com";                     $mail_Subject = "enter in payment_status==completed";                     $mail_Body = $req;                     mail($mail_To, $mail_Subject, $mail_Body, $mail_From);                          // Create post object                     $my_post = array(                         'post_title'    => $txnID,                         'post_status'   => 'publish',                         'post_author'   => 1,                         'comment_status' => 'closed',                         'ping_status' => 'closed',                         'post_type'      => 'post_pledges',                     );                     $post_id = wp_insert_post( $my_post, true );                          // Send an email announcing "after post_pledges creation"                     $mail_From = "ragazzin@gmail.com";                     $mail_To = "ragazzin@gmail.com";                     $mail_Subject = "after post_pledges creation";                     $mail_Body = $post_id;                     mail($mail_To, $mail_Subject, $mail_Body, $mail_From);                          add_post_meta($post_id, "wpl_pledge_cause", $donCause);                     add_post_meta($post_id, "wpl_pledge_transaction_id", $txnID);                     add_post_meta($post_id, "wpl_pledge_first_name", $firstName);                     add_post_meta($post_id, "wpl_pledge_last_name", $lastName);                     add_post_meta($post_id, "wpl_pledge_country", $addressCountry);                     add_post_meta($post_id, "wpl_pledge_city", $addressCity);                     add_post_meta($post_id, "wpl_pledge_address", $addressStreet);                     add_post_meta($post_id, "wpl_pledge_postal_code", $addressZip);                     add_post_meta($post_id, "wpl_pledge_email", $payerEmail);                     add_post_meta($post_id, "wpl_pledge_donation_amount", $payment_gross);                     add_post_meta($post_id, "wpl_pledge_payment_source", 'paypal');                     add_post_meta($post_id, "wpl_pledge_payment_Status", $payment_status);                      }                      // Response is VERIFIED                 // Send an email announcing the IPN message is VERIFIED                 $mail_From = "xxxxxx@gmail.com";                 $mail_To = "xxxxxxx@gmail.com";                 $mail_Subject = "VERIFIED IPN";                 $mail_Body = $req;                 mail($mail_To, $mail_Subject, $mail_Body, $mail_From);          } else if (strcmp ($res, "INVALID") == 0) {         // IPN invalid, log for manual investigation                      // Notification protocol is NOT complete, begin error handling                      // Send an email announcing the IPN message is INVALID                  $mail_From = "xxxxxxx@gmail.com";                 $mail_To = "xxxxxxx@gmail.com";                 $mail_Subject = "INVALID IPN";                 $mail_Body = $req;                 mail($mail_To, $mail_Subject, $mail_Body, $mail_From);     }     ?>      I read about a problem with an infinite loop and maybe it's also for me because the script doesn't go on when try to execute the function. Have you any ideas?


Can you filter wp_dropdown_categories with terms meta?

Hi I have a custom taxonomy with a term meta flag called 'is_live' set up and I want to exclude all the terms where this flag is false when I call **wp_dropdown_categories**. I've checked the codex but cant see anything relating to terms meta. Anyone have any ideas or tried this before?


Do i need to keep all the default WP templates files in a theme?

I have a general question about the themes development. When I develop a theme for distribution (free or commercial) is it a better practice to keep all the default templates file in my theme even though i do not use all of them ? For exemple if i develop a theme without blog feature, is it a good practice to keep single.php, comments.php ... files in my theme ? I ask this question because when i test my themes with theme-check plugin, all the default templates files seems to be mandatory to pass the test. What do you think ? what is the best practice ? Thanks for your advices.


Problem with new Multisite Installation

I have installed and converted two wordpress installations to Multisite .It was not first time and I done it before for some of my websites. I was successfully able to use it too.But I could not find sub-site files/folders in **'Blogs.dir'** .Hence some plugins are showing errors as there are no files/folders for sub-sites(like subsite 1, 2, 3 etc) in **blogs.dir** The problem might be this...I firstly placed the **Multisite** conversion code at long place in **wp-config.php** .Later I realise my fault and corrected it.But the problem is still un-resolved.Still there are no files in blogs.dir Could anybody help me to resolve this issue? I don't understand if it is because of the new version **3.0.4** or my fault ? Thanks ! **Update** : I installed a new multisite on other fresh domain .And the same problem there. I think the new version don't need that or some thing wrong with my server configuration Update 2 : I am adding a screenshot of my empty blogs.dir folder ![](http://img534.imageshack.us/img534/768/blogsdir.jpg)http://img534.imageshack.us/img534/768/blogsdir.jpg ## Update 3: * * * ## Actually the problem is caused with a plugin named Zingiri The plugin is installed on Multisite installation and got these messages : Directory /home/..../public_html/wp-content/blogs.dir/2/files/ is not writable, please chmod to 777 Directory /home/......./public_html/wp- content/blogs.dir/2/files/zingiri-web-shop doesn't exist ......... ......... Directory /home/....../public_html/wp-content/blogs.dir/2/files/zingiri-web- shop/digital-a42fzcxaq5ykww4t doesn't exist Turn off magic quotes on your installation. Read more about why you should disable this setting ( ( 1 )This is the warning message on sub-sites.The Numeral ' 2 ' represents a subsite here ) _I am having another error message too (here :/wp- admin/admin.php?page=zingiri-web-shop)...when I click on **Install** button in plugin settings page (However it finishes installing the script)._ **Error** :Table 'wpuser_wpdb1.wp_2_users' doesn't exist * * * 'Magic Quotes ' are already turned off and tried changing the permissions for blogs.dir . Even after doing all these,that problem is unresolved . _After realizing the issue is caused with that particular plugin .I attempted to delete the question because some might thing this question is related to plugin and not with blogs.dir_ ## \-------------


Uploading Images to Media Library via wp_handle_sideload() fails

My basic scenario is the following: I have a directory on my server that gets filled with images via ftp every once in a while. I would want to move these images to the wp upload directory and then add them to the media library with `wp_insert_attachment()`. I thought `wp_handle_sideload()` to be the correct function for this but if fed with an absolute path to one of the images it returns an error. Heres my code so far:               function oo_attach_images($images, $id){              //$images is an array of anbsolute image paths, $id is the id of a post I want the images to be attached to.              require_once(ABSPATH . '/wp-admin/includes/file.php');         require_once(ABSPATH . '/wp-admin/includes/image.php');              foreach($images as $image){                  $override = array('test_form' => FALSE);                  $file = wp_handle_sideload($image, $override);                  print_r($file); //returns: Array ( [error] => )                  $attachment = array(                 'post_mime_type' => $file['type'],                 'post_title' => basename($image),                 'post_content' => ' ',                 'post_status' => 'inherit'             );                  $attach_id = wp_insert_attachment( $attachment, $file['file'], $id );                  $attach_data = wp_generate_attachment_metadata( $attach_id, $file['file'] );             wp_update_attachment_metadata( $attach_id,  $attach_data );                   }     }      I looked into similar questions, but none of the solutions outlined there seemed to have anything to do with the sideload itself failing. Frankly, I believe that I do not pass the right kind of file path to `wp_handle_sideload()`, but since its undocumented in codex I have no idea what kind of input it might expect. Does anyone know what I need to change to make this work?


Efficient way to fetch all archived WPMS blogs

is there a good and efficient way to fetch all WPMS blogs with archived set to true? Because there doesn't seem to be a function to get all blogs I have added the admin user to all blogs. Then I do a `get_blogs_of_user(1, false)`. This fetch all blogs that are active, but I'm looking for an efficient way to fetch all blogs that is archived. I guess I can do something complicated e.g. call `get_blogs_of_user(1, true)` then `get_blogs_of_user(1, false)`, then find the difference and check if they have the archived bit set one by one, but is there some better way to do this? Thanks.


Need to block user role from accessing bbPress all together

I've been looking at some options and I haven't seen a full solution to what I need. I need to block certain `user_roles` from accessing bbPress all together and from seeing the link to the page. Any pointers?


Is there any plan for WordPress to handle retina support for the site content?

I see from browsing Themeforest that there are many retina ( HD ready ) themes available; and WordPress itself has retina standard icons for the backend too; but what about the content, both future content and archived content? There are a couple of plugins available which will sort it out for us, but does this mean that a typical WordPress site will need to carry a retina plugin going forward to work out the serving of the 2x images; or is there a plan for this to be included in the core ... or is it already included ... or is this in the realm of themes to server 2x images?


Custom Post Type Feed displaying all posts

I'm having some problems with an RSS feed for a custom post type. If you view this URL http://intentional.wpengine.com/feed/?post_type=30daychallenge you'll see a raw feed. Everything looks to be fine there. The problem is when I burn the feed or try to use it in an RSS feed to post plugin (like wpematico or similar) the post type query disappears or something as all of the posts from the site show up in the burnt feed and the plugin data. Any idea what could be the problem?


Page specific values in widgets

I have a travel guide website which I have created with WordPress which contains destination guides. On the destination guides pages I have a sidebar which displays destination statistics (currency, time zone etc).   Currently I have to create a new sidebar for each page each time changing these values. Is it possible to create a MySQL database with these values and then insert some PHP code that will identify what country page is loaded and insert the corresponding values so that I can use a single sidebar for all pages. I am fairly proficient with HTML/CSS, but my understanding of PHP is limited. How can I do that?


Allow author to choose his featured image size

Request from a client. He wants his authors to be able to upload their image and then set it as featured, just like normal. The difference is that when setting it as featured, he wants the author to be able to choose 'small' or 'large' which will then be output appropriately on the front-end. How would you go about this? I'm well aware of how to create new image sizes in the theme, but how can I allow the author to select his image size when making his post?


How to integrate get_post_time with date_i18n function?

I have date format and would like to translate to another language with `date_i18n` function how can I integrate with get_post_time here is my code :               $time = get_post_time('F j, Y', true,$newspost['ID']);


Force Users to Login - loop problem

I'm using this code below as a plugin. It seems to work but sometimes it seems to be stuck in a loop. When I have this plugin running my facebook social sharing doesn't grab the correct page and content for a share post. I turn off the plugin and facebook share works great. What am I doing wrong?               add_action ('template_redirect', 'protect_whole_site');          function protect_whole_site() {     if ( !is_user_logged_in() &&  !in_array( $GLOBALS['pagenow'], array( 'wp-    login.php', 'wp-register.php' ) ) ) {             auth_redirect();         exit;         }     }      thanks!!


Should I use relative or absolute urls when pointing to internal pages

This is a simple question, that's probably been asked before. For internal links between pages, is it better to use a relative link or full permalink? Thank you.


Prevent Advanced Excerpt from Being Called

I have excerpts enabled for pages. In one of my page templates I want to prevent `<?php the_excerpt(); ?>` from initiating the Advanced Excerpt Function. Basically, I have one page template where I want excerpts to function as they normally would. How do I go about accomplishing this while still being able to take advantage of the Plugin's functionality everywhere else? Or - perhaps there is another plugin similar to Advanced Excerpt that is better suited to what I am trying to do... thx! http://wordpress.org/extend/plugins/advanced-excerpt/


Uses for function: wp_update_user

my theme currently uses the wp_update_user function to update a set of user metas. I created to some new user meta fields that I would like to include in the existing wp_update_user. The function updates the meta fields based on form elements, like this...               $_POST['form']['ID'] = $userdata->ID;     $_POST['form']['jabber']  = $_POST['address']['country']."**";     $_POST['form']['jabber'] .= $_POST['address']['state']."**";     $_POST['form']['jabber'] .= $_POST['address']['address']."**";     $_POST['form']['jabber'] .= $_POST['address']['city']."**";     $_POST['form']['jabber'] .= $_POST['address']['zip']."**";     $_POST['form']['jabber'] .= $_POST['address']['phone'];          if( ( $_POST['password'] == $_POST['password_r'] ) && $_POST['password'] !=""){                 $_POST['form']['user_pass'] = $_POST['password'] ;             }              wp_update_user( $_POST['form'] );          $ADD = explode("**",$userdata->jabber);      The wp_update_user function is using `$_POST['form']` as the parameter to update the user. Along with this function there is a form with the different form inputs with names, such as this, `address[phone]` which is the `$_POST['form']['jabber'] .= $_POST['address']['phone'];` portion of the above code. The sample form input element is this...               <input type="text" name="address[phone]" value="<?php echo $ADD[5]; ?>" />      I was thinking that to create a new user field and include it into the existing wp_update_user function being used, all I would have to do is create the input element like this...               <input type="text" name="form[new_user_field]" value="<?php echo $_POST['form']['new_user_field']; ?>" />      and then add a line of code to the function values like this...               $_POST['form']['new_user_field'] .= $_POST['form']['new_user_field'];      But...after submitting the form that the function belongs to, my newly inputted value isn't saved in the new user meta field. Is there a way to include my new user meta field into the existing wp_update_user? Can someone tell me what Im doing wrong? Thanks a lot


HTML Redirect to WP pages

I have some predefined links that I need to redirect to real URLs within my WP install. I have NO CHOICE but to use these URLs provided to me, unfortunately. The format is: http://mysite.com/redirect.html?p=pagename WP is installed at the root of mysite.com. I need to take the pagename query var, which will not be a direct match to a page URL and redirect it (301) to a WP permalink. I have attempted a few things in .htaccess with rewrites but not having luck mostly due to the fact that there are also WP permalinks redirecting. Anyone done this before or know the best approach? UPDATE - Here is the working code that I used based on the accepted answer below:               RewriteCond %{REQUEST_URI} ^/redirect.html(.*)$       RewriteCond %{QUERY_STRING} ^(.*?)&?p=page&?(.*?)$       RewriteRule (.*) /page/?%1&%2 [L,R=301]      I also added these before the base WP rewrites.


Get full page HTML for a non-public Wordpress page

How can I write a function that will return the full rendered HTML of a non- public URL on my Wordpress site—a URL that you must be logged in to see, such as a draft? Not just the post content, but the full rendered HTML that a browser would receive, from `<!doctype` to `</html>`? I would normally accomplish something like this with cURL, but in this case, a plain cURL would result in a 404—because the desired page is only accessible if you are a logged-in Wordpress user. I have seen examples of WordPress authentication with cURL, but they all seem to require you to hard-code a username and password, which I would like to avoid because a) it seems insecure, and b) Wordpress users can change their password at any time. This is what I want to achieve:               function getFullPageHtml( $url ) { // pass in a url (post ID would be fine too)             // Do something here that does not involve hard-coding a WP username password             return $html; // a string of the full page's HTML--'<!doctype...etc...</html>'     }      Is there a different approach that would get me this result without relying on including username and password in the code? For example, using output buffers instead of making a cURL/HTTP request?


Having some trouble properly displaying Custom Post Types in templates

I have a child theme of Twenty Thirteen and I've setup Custom Post Types for several items. They are showing up in the Dashboard, I can create the Custom Posts and they show up in various categories because I called the `$query->set()` with the Custom Post Types. I've saved and re-saved Permalinks many times to flush the rewrites. Here is how I registered one in `functions.php`...               $labels_successstories = array(         // my various labels are in here     );       $args_successstories = array(         'labels' => $labels_successstories,         'public' => true,         'menu_position' => 29,         'supports' => array( 'title', 'editor', 'thumbnail' ),         'taxonomies' => array( 'category' ),         'has_archive' => 'success-stories',         'rewrite' => array( 'slug' => 'success-stories' )     );       register_post_type( 'successstories', $args_successstories );      In Settings > Permalinks > Custom Structure >               /%category%/%postname%/      Here is how I call `$query->set()` in `functions.php`               function get_custom_posts( $query ) {         if ( ! is_admin() && empty($query->query_vars['suppress_filters']) ) { // is not in Dashboard (is_admin => Dashboard)                    if ( is_home() ) {  // home page - show only animal posts                 return $query->set( 'post_type', array( 'post', 'successstories', 'another-post-type' ) );             } else if ( is_search() ) {  // search page - show only posts, pages and custom post types                 return $query->set( 'post_type', array( 'post', 'page', 'successstories', 'another-post-type' ) );             } else if ( ! is_single() ) { // everything else, EXCEPT for Singles, show everything                 return $query->set( 'post_type', array( 'post', 'page', 'attachment', 'successstories', 'another-post-type' ) );             }         }      }     add_filter( 'pre_get_posts', 'get_custom_posts' );      My goal is to remove as many Categories as I can since the Custom Post Types will effectively replace most of these Categories. However, one of my Custom Post Types will still need a few Categories. Here are the questions/issues: 1) When I go to `mysite.com/success-stories/`, it's using the default `archive.php` template. However, I have created a template called `archive- successstories.php` and it's being totally ignored. (if it matters, the `single-successstories.php` template is working perfectly fine) 2) When I go to `mysite.com/success-stories/`, I see posts but they're coming from all posts, custom post types, and categories. I just want to see posts from the `successstories` Custom Post Type when I go there. I think I know how to fix this but if the archive template is being ignored, then my fix will not be seen. 3) Right now, Success Stories (Custom Post Types) are also in a Category named `success-stories` which can be accessed at `mysite.com/category/success- stories` and that shows the correct posts. However, my goal is to remove this Category since it's not needed. Once I get these Custom Post Types to show on their proper archive pages, the respective Categories will be superfluous.


Deploying Updated or New Plugins That Modify the wp_options Table

I have a WordPress site under local version control with Git. I deploy it to the production server using Capistrano. For the initial deployment, I manually import the SQL database to the production server, and change all the local references by hand. Any content changes are made on the production server from then on. This is for the most part okay, but I'm having a problem when it comes to testing/configuring new or updated plugins, since many plugins make changes to the wp_options table. I need a way to add/remove/update/configure plugins locally, do all my testing and then seamlessly deploy the updated site to the production server without breaking anything. How are others dealing with this?


Mass remove a number of tags from a number of posts

i am having a wallpapers site. I was having lots of posts with no tags and i tried some plugins to auto add tags like simple tags where you need to set some tags and it will auto use those tags for posts, then i used auto tag posts option and it added all the 50-60 tags to a number of individual posts,Means it added 50-60 tags to each of the posts in 500 posts. Its very time consuming now for me to edit each post and removing unwanted tags. Is there any way so that i can remove those 50-60 tags via a MySQL query? Any way either a plugin or a mysql query can do this. Please help.


How to display posts list on my plugin page?

Currently, I makes a plugin, and I want to display some post in admin submenu, my url looks like wp-admin/admin.php?page=mypluginpage how to display posts list on my plugin page? it's possible or not? Thanks. * * * Please delete this post, I just found solution:               <?php     $query = new WP_Query(         array(             'post_type' => 'post',             'post_status' => 'publish'         )     );          $list = array();     foreach ($query->posts as $post) {         .......     }     ?>


Wordpress Limit Title Characters

I'm using this code for limit title characters                   (strlen($post->post_title) > 40) {     echo substr(the_title($before = '', $after = '', FALSE), 0, 40) . '...'; } else {     the_title();      http://wordpress.org/support/topic/how-to-limit-character-on-title However when in titles have special character as: ' then the code will be wrong. For example: I have the title: "Infinite Scrolling in Web Design and Mobile Apps : Let’s Get To The Bottom". After I added the code above it will show: > Infinite Scrolling in Web Design and Mobile Apps : Let�...


I made new theme directory, why won't it show up in admin GUI?

I did this:               cd wp-content/themes     cp -R someTheme newTheme      then:               cd newTheme     vim style.css #changed name of theme in the css comment header      and then logged into `example.com/wp-admin`. But when I looked at the list of themes (under the appearance header in left menu), I did not see it there. What else must I do for wordpress to notice my theme? wp version = 3.0.4


How to add class on Widget Title

This is an example of register sidebar function from codex. My focus is on the `before_title` argument. What i want is to add a class to the title(`<h3>`). From my widget code or may be pass the class name from user input on widget area.               <?php $args = array(         'name'          => sprintf(__('Sidebar %d'), $i ),         'id'            => 'sidebar-$i',         'description'   => '',         'before_widget' => '
',         'after_widget'  => '
',         'before_title'  => '
',         'after_title'   => '
' );           register_sidebar( $args );          ?>      So, **How do i add classes dynamically on widget header?**


Custom fields to taxonomy

Can I add some custom fields to specific taxonomy so when ever I call that taxonomy, custom fields attached to that taxonomy should also appear.