title: Hardening wordpress: blocking /includes with htaccess

text: This page http://codex.wordpress.org/Hardening_WordPress says this should be included in the .htaccess file to block requests for files inside the includes dir.               # Block the include-only files.     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /     RewriteRule ^wp-admin/includes/ - [F,L]     RewriteRule !^wp-includes/ - [S=3]     RewriteRule ^wp-includes/[^/]+\.php$ - [F,L]     RewriteRule ^wp-includes/js/tinymce/langs/.+\.php - [F,L]     RewriteRule ^wp-includes/theme-compat/ - [F,L]     </IfModule>               # BEGIN WordPress     ...      How does that work ? As far as I can read it, it only specifies _not_ to rewrite certain urls (using -), and then fails to actually rewrite all other requests. Is there something missing ?


title: Orderby menu_order doesn't work

text: My code is:               $sliders = new WP_Query(array('post_type' => 'sliders', 'showposts' => '10', 'orderby' => 'menu_order', 'order' => 'ASC', 'countries'=> 'Default', 'supress_filters' => true, 'meta_query' => array(      But wordpress orderby post_date :(                [query] => Array         (             [post_type] => sliders             [showposts] => 10             [orderby] => menu_order             [order] => ASC             [countries] => ES             [supress_filters] => 1             [meta_query] => Array                 (                     [0] => Array                         (                             [key] => _sectors                             [value] => 540                             [compare] => IN                         )                      )              )          [request] =>  SELECT SQL_CALC_FOUND_ROWS  wp_posts.* FROM wp_posts  INNER JOIN wp_term_relationships ON (wp_posts.ID = wp_term_relationships.object_id) INNER JOIN wp_postmeta ON (wp_posts.ID = wp_postmeta.post_id)  JOIN wp_icl_translations t ON wp_posts.ID = t.element_id                         AND t.element_type = 'post_sliders' JOIN wp_icl_languages l ON t.language_code=l.code AND l.active=1 WHERE 1=1  AND ( wp_term_relationships.term_taxonomy_id IN (16) ) AND wp_posts.post_type = 'sliders' AND (wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private') AND ( (wp_postmeta.meta_key = '_sectors' AND CAST(wp_postmeta.meta_value AS CHAR) IN ('540')) ) AND t.language_code='es' GROUP BY wp_posts.ID ORDER BY wp_posts.post_date DESC LIMIT 0, 10


title: Filtering by Post Meta Custom Fields - Performance

text: I could use some advise on how to structure my data for performance. I have a custom post type with a lot of custom meta data stored in the `wp_postmeta` table as a serialized array under one meta key for each post. Now, I need to get some posts from that post type, and filter them by the meta data I have stored. Right now, the only way I can think to do that is to get ALL the meta data for ALL of the posts of this type, then unserialize them into a massive PHP array, and then use `foreach` loops to check them all one-by-one. This strikes me as a really bad/slow way to do things. At this point, I'm thinking I should scrap my whole plan, and start from scratch using my own custom table. That's just so un-wordpress though, and it would be a LOT of work. My other idea is to do what was suggested on this other question (meta_query with meta values as serialize arrays) and separate all the meta values into separate meta keys and then query them as shown on that question. The problem I see there is that that query doesn't look like it will be particularly fast either, and my `wp_postmeta` table would get HUGE. Any ideas would be **greatly** appreciated.


title: Show one of the taxonomies always as default

text: I have custom post type called **staff** that has custom taxonomy called **departments**. I wanted the frontpage of the staff (archive-staff.php) to not show ALL the staff members, but actually the first department (lets say there are 3 departments.) My archive page starts like this:               global $wp_query;     $args = array_merge( $wp_query->query, array(         'post_type' => 'staff',     ) );     query_posts( $args );          while (have_posts()): the_post(); // ...      I have no clue how to go from here. I also need to display the current departments title.


title: Can Wordpress plugins "Talk to each other"?

text: Sorry if this is a really silly question, but I am very new to Word Press. My question is, can one plugin update the settings of another Wordpress plugin? I suppose this might depend on the plugin and where it stores its settings. I don't know if plugins store their settings in static files or in the database.


title: Wordpress - cant login on login page

text: I have wordpress and woocommerce on this website: http://goo.gl/PHIWIo I did this template, but the my-account page, can not login. If you try: Login: teste Password: teste123 He says "You are logged in Teste", but he actually does not log in. When you try register, register successfully, he send email and everything, but if you try login after register he does not login.... on top bar have "Seja Bem Vindo! Registrar / entrar" Thats means "Welcome! Register / Log in" And when you are already logged in he says "Welcome YourName". But this does not happened. I tried delete wp-content/themes/era420/woocommerce/myaccount/form-login.php but keep not log in. I tried clean all my functions.php but the error stay. This happened maybe when i change the host, i think have some cache issues i dont know. Anyone? UPDATE: When you try log in first time, he log in successfully, but if you log out, you cant log in again.... I contact Bluehost Livechat,no começo nós achavamos que o problema era de vanishing, ele fez as mudanças no vanishing, mas depois dele fazer as mudanças no vanishing começamos achar que era cookies. His message: "Yeah, that seems a bit weird, I haven't had to fully clear my cookies like this before to get it to work, but seems like its saving cookies and thinks you are still logged in, so doesn't try to login again or something like that."


title: How to get meta value in wp_attachment_metadata

text: I want to get `wp_attachment_metadata` in my own way. I want to separate the sizes (Thumbnail, Large, Medium, Small). The meta value on database looks like this:               a:5:{s:5:"width";i:660;s:6:"height";i:320;s:4:"file";s:39:"2013/07/debut      -busana-muslim-new-yor.jpg";s:5:"sizes";a:2:{s:9:"thumbnail";a:4:{s:4:"f      ile";s:39:"debut-busana-muslim-new-yor-150x150.jpg";s:5:"width";i:150;s:      6:"height";i:150;s:9:"mime-type";s:10:"image/jpeg";}s:6:"medium";a:4:{s:      4:"file";s:39:"debut-busana-muslim-new-yor-300x145.jpg";s:5:"width";i:30      0;s:6:"height";i:145;s:9:"mime-type";s:10:"image/jpeg";}}s:10:"image_met      a";a:10:{s:8:"aperture";i:0;s:6:"credit";s:0:"";s:6:"camera";s:0:"";s:7:      "caption";s:0:"";s:17:"created_timestamp";i:0;s:9:"copyright";s:0:"";s:1      2:"focal_length";i:0;s:3:"iso";i:0;s:13:"shutter_speed";i:0;s:5:"title";      s:0:"";}}       Well, I am stuck. I don’t know how to separate that array. Anyone knows how to separate that array in order I can get the sizes and the URL of the images.


title: How do I change the web site summary in search results?

text: I have a web site that I am working on, hendersonvillecameraclub.org. When I use Google to search for the site using 'hendersonville camera club' as the search terms my site is the 6th result. Below the page title, it gives a snippet of the most recent post on the site. My question is, how do I change what information is displayed in the summary? I would prefer to put some static text there that provides a better description of the site. This site is hosted by GoDaddy, not sure if that's relevant information. Thanks!


title: link variable to user

text: is there an easy way for me to save a variable and link it to a user? specifically I want to use meta box to output a variable on the front page, then have it be a link so if a user clicks it, it will store it in a div. I can do all the meta box stuff, just need the variable to be stored when link is clicked. kind of like a favorite system, but more custom. assuming I will have to access database somehow? not even sure where to start.


title: Update User Role Across Network when Main Site User is Updated

text: I'm using a slightly modified copy of the Multi Site User Management plugin to keeps users synced across a multisite network, but have one problem with it. When a user's role is updated on the main site, the role is NOT updated on the sub site. In order for everything to work correctly, user roles must stay in sync. I've been looking without success, so is there an action that runs when a user is updated? I know about the profile_update and wp_update_user functions / hooks, but neither of these work because the user role is updated via an external function. So I need a new way of always syncing user roles. Any ideas?


title: Custom Taxonomy not being saved on custom posttype

text: This is very unusual, and I can't seem to figure out why this is happening. I have registered a custom posttype and a taxonomy (for that posttype). The taxonomy widget gets displayed on the "edit post" page although when I try to save a taxonomy   * The suggestions show up   * I am able to select them   * But when I hit "update" action, the page reloads but does not show the taxonomy.  Any idea why this might be happening ?


title: Add .htm extention to a custom taxonomy

text: I need to add '.htm' to all my urls on a new site - client requires that, as I am converting a old static site into WP. (I use Remove Taxonomy Base Slug to hide the slug of my custom taxonomy "topic" url.) Now, I have a '.htm' extension on all pages, post etc. Now, I only need to add this '.htm' extension to my custom taxonomy archives. Does anyone have an idea of how this can be done? I tried this:               /* Add Tax extension .htm */          add_action('init', 'add_html_ext_to_custom_post_type_taxonomies');     function add_html_ext_to_custom_post_type_taxonomies() {         add_rewrite_rule('^topic/([^/]+)\.htm', 'index.php?topic=$matches[1]', 'top');     }       which I found here  Add .html extension to custom post type taxonomies That gave me no change at all, and I did remember to flush permalinks. Thanks :)


title: Define locale WordPress uses with gettext functions?

text: I'm trying to localize my plugin. I have two `.mo` files:               /lang/myplugin-es_ES.mo     /lang/myplugin-en_US.mo      The translation works but I don't understand how to change the language to use the `en_US` file instead of the `es_ES`. This is what I'm trying:               function define_locale($locale) {         $subdomain = array_shift(explode(".",$_SERVER['HTTP_HOST']));         if($subdomain == "en")             return 'en_US';         else              return $locale;     }          // Define Locale     add_filter('locale','define_locale',10);       While `get_locale()` shows the locale is `en_US` my plugin still uses the `es_ES` file. What am I doing wrong?


title: Force wp_enqueue_scripts to the HEADER?

text: A plugin I'm working on requires jquery to be loaded before the content is processed. Some stock themes, like 2010, 2011 and 2012 (I believe) put the JS in the footer. How can I force the scripts to be loaded in the header (I will notify users of the plugin that the plugin requires this)?


title: How to tell a theme to use different .mo and .po files?

text: I have a theme which loads .po and .mo files to display strings in English. I want to have only one language (Polish), but those two files are en_US. I tried replacing content in the en_US.po file but nothing changed on the website, I do not know why. Where does it store strings if changing .po files changes nothing?


title: Secondary loop cuts off at 10 posts?

text:
I have a loop to get a tag name from the URL slug, and then show all the posts, grouped by category, that matched that tag. It works, but I recently noticed it only shows 10 posts despite my setting (I thought) posts_per_page to -1. I want to show **all** the posts that match the tag, grouped by category. Here's the code:               <?php     // get all the categories from the database     $cats = get_categories();          $slug = the_slug();          // loop through the categories     foreach ($cats as $cat) {         // setup the category ID         $cat_id= $cat->term_id;              // create a custom wordpress query         query_posts("cat=$cat_id&tag=$slug&post_per_page=-1&orderby=title&order=ASC");              // start the wordpress loop!         if (have_posts()) :              // Make a header for the category         echo '
'.$cat->name.'
';              while (have_posts()) : the_post(); ?>                  <?php // create our link now that the post is setup ?>

<?php the_title(); ?>
             <?php the_content(); ?>             <?php //include('custom-fields.php'); ?>
                  <?php //echo '
'; ?>              <?php endwhile; endif; // done our wordpress loop. Will start again for each category     ?>     <?php } // done the foreach statement ?>


title: Worse thumbnail quality after GD library install

text: Last week I had to install the GD library on my server to enable thumbnail resizing for a premium theme. After installing the GD library on the server the image quality of newly added thumbnails for another theme got worse in terms of quality. Thumbnails are generated in the correct sized and are not 'resized' in any way with CSS. All thumbnails are only resized keeping the aspect ratio as it is and they are not cropped. I've already increased the image quality to 100% like this:               function volley_thumbnail_quality( $quality ) {     return 100;     }          add_filter( 'jpeg_quality', 'volley_thumbnail_quality' );     add_filter( 'wp_editor_set_quality', 'volley_thumbnail_quality' );      But with no visible increase in quality. I've already found a similar question at StackOverflow but I don't want to discuss the Adobe RGB-profiles that are maybe added to the uploaded with the client yet as most editors of the website are not very tech savvy. Is there any other way to increase the thumbnail quality?


title: WordPress function get_the_terms() returns 'Invalid taxonomy' error

text: It seems that the function get_the_terms( $id, $taxonomy ) always returns an error if used outside of WordPress (i.e. integrated in PHP using this method). I believe some library might be required and should be included explicitly for this to work. For example, the following code, where 284 is a valid post id and 'keyword' is a valid custom taxonomy...               $terms = get_the_terms( 284, 'keyword' );     var_dump($terms);      ... works perfect when used in the admin UI (via plugin), but the same does give an 'Invalid taxonomy' error when used outside admin UI using this method Any suggestions? **Additional info:** The taxonomy 'keyword' is registered at the hook 'init' Taxonomy registration code:               add_action( 'init', array( $this, 'create_taxonomy' ) );     public function create_taxonomy() {         $keyword_args = array(         'labels' => array(             'name'              => 'Keywords',             'singular_name'     => 'Keyword',             'search_items'      => 'Search Keywords',             'all_items'         => 'All Keywords',             'edit_item'         => 'Edit Keyword',             'update_item'       => 'Update Keyword',             'add_new_item'      => 'Add New Keyword',             'new_item_name'     => 'New Keyword Name',             'popular_items' => 'Popular Acresses',             'not_found'     => 'No Keywords found',             'menu_name'         => 'Keywords',         ),         'hierarchical'  => false,         'public'  => true         );            register_taxonomy('keyword', array('post'), $keyword_args);     }      Code outside WordPress that uses get_the_terms():               define('WP_USE_THEMES', false);     require('../../../../wp-blog-header.php' );          $terms = get_the_terms( 284, 'keyword' );     var_dump($terms);


title: Sidebar not appearing

text: The sidebar isn't appearing on my site: http://richardclunan.com/ I have a Text widget in the sidebar, with some test text in it… In 'Edit Page', there's no 'no sidebar' option… What things might I need to do to get the sidebar to appear? (I might have it so nothing appears in the sidebar area at all – just have it activated to shunt the text of the main area on the page across, so the line length is shorter – I'm mentioning this just in case it's not possible to have it activated and have nothing appear...) Edit: I'm adding a couple of questions in response to an answer:   1. The word 'register_sidebar' appears in functions.php – does this mean dynamic sidebar support is enabled?   2. do i add the code SimonDowdles gave only to one file? Or to both page.php and single.php?   3. Where within the code on, say page.php, do i add the code SimonDowles gave?   4. Should i create a child theme for this change I want to make? If yes, what process do i follow to do this?   5. Do I replace the phrase 'id-of-desired-sidebar' from SimonDowdles code with the name of my sidebar? Where do I get the name from? In the Widgets section, there's a sidebar thing called 'Home Widgets' – is that the name I use? Hyphenated?


title: t5-fresh-editor-stylesheets.php breaks image placement in WP Beta 3 editor

text: I am running a development site with the WordPress beta plugin, currently running 3.9 beta 3 I am using Bill Erickson's Core functionality plugin which calls Toscho's t5-fresh-editor-stylesheets.php code "Enforces fresh editor stylesheets per version parameter" Updating to the beta I notice that when inserting an image in the post editor, the edit screen does not show the edit/delete icons, nor is it positioned correctly when choosing an alignment. The image however is displayed correctly on the preview page. I am not much of a coder, however I guessed this is a TinyMCE CSS problem, I disabled all plugins however and the image placement in the editor was corrected and the image icons reappeared. I traced the problem to the t5-fresh-editor-stylesheets.php code - commenting out the call to this page fixed the problem. Any chance of a fix Toscho? Please forgive me if this is the wrong place to post this request.


title: Batcache messages no longer in page source

text:
I have placed `advanced-cache.php` and `object-cache.php` in `wp-contents` and updated `wp-config.php` with `define('WP_CACHE', true);`, but I do not see the messages in the page source telling me that the page is served from cache. I have WordPress 3.8.1, APC Object Cache Backend 2.0.6, and Batcache 1.2. Once upon a time I would see the messages in the page source, but no longer. And this is across several WordPress installations. I do see the plugins showing up as installed in the Drop-ins display option under Plugins in the WordPress dashboard. Contents of `object-cache.php`:               <?php     /*     Plugin Name: APC Object Cache     Description: APC backend for the WP Object Cache.     Version: 2.0.6     URI: http://txfx.net/wordpress-plugins/apc/     Author: Mark Jaquith     Author URI: http://coveredwebservices.com/          Install this file to wp-content/object-cache.php          Based on Ryan Boren's Memcached object cache backend     http://wordpress.org/extend/plugins/memcached/          */          if ( function_exists( 'apc_fetch' ) ) :          if ( version_compare( '5.2.4', phpversion(), '>=' ) ) {         wp_die( 'The APC object cache backend requires PHP 5.2 or higher. You are running ' . phpversion() . '. Please remove the object-cache.php file from your content directory.' );     }          if ( function_exists( 'wp_cache_add' ) ) {         // Regular die, not wp_die(), because it gets sandboxed and shown in a small iframe         die( 'ERROR: This is not a plugin, and it should not be activated as one.

Instead, ' . str_replace( $_SERVER['DOCUMENT_ROOT'], '', __FILE__ ) . ' must be moved to ' . str_replace( $_SERVER['DOCUMENT_ROOT'], '', trailingslashit( WP_CONTENT_DIR ) ) . 'object-cache.php' );     } else {          // Users with setups where multiple installs share a common wp-config.php can use this     // to guarantee uniqueness for the keys generated by this object cache     if ( !defined( 'WP_APC_KEY_SALT' ) )         define( 'WP_APC_KEY_SALT', 'wp' );          function wp_cache_add( $key, $data, $group = '', $expire = 0 ) {         global $wp_object_cache;              return $wp_object_cache->add( $key, $data, $group, $expire );     }          function wp_cache_incr( $key, $n = 1, $group = '' ) {         global $wp_object_cache;              return $wp_object_cache->incr2( $key, $n, $group );     }          function wp_cache_decr( $key, $n = 1, $group = '' ) {         global $wp_object_cache;              return $wp_object_cache->decr( $key, $n, $group );     }          function wp_cache_close() {         return true;     }          function wp_cache_delete( $key, $group = '' ) {         global $wp_object_cache;              return $wp_object_cache->delete( $key, $group );     }          function wp_cache_flush() {         global $wp_object_cache;              return $wp_object_cache->flush();     }          function wp_cache_get( $key, $group = '', $force = false ) {         global $wp_object_cache;              return $wp_object_cache->get( $key, $group, $force );     }          function wp_cache_init() {         global $wp_object_cache;              $wp_object_cache = new APC_Object_Cache();     }          function wp_cache_replace( $key, $data, $group = '', $expire = 0 ) {         global $wp_object_cache;              return $wp_object_cache->replace( $key, $data, $group, $expire );     }          function wp_cache_set( $key, $data, $group = '', $expire = 0 ) {         global $wp_object_cache;              if ( defined('WP_INSTALLING') == false )             return $wp_object_cache->set( $key, $data, $group, $expire );         else             return $wp_object_cache->delete( $key, $group );     }          function wp_cache_switch_to_blog( $blog_id ) {         global $wp_object_cache;              return $wp_object_cache->switch_to_blog( $blog_id );     }          function wp_cache_add_global_groups( $groups ) {         global $wp_object_cache;              $wp_object_cache->add_global_groups( $groups );     }          function wp_cache_add_non_persistent_groups( $groups ) {         global $wp_object_cache;              $wp_object_cache->add_non_persistent_groups( $groups );     }          class WP_Object_Cache {         var $global_groups = array();              var $no_mc_groups = array();              var $cache = array();         var $stats = array( 'get' => 0, 'delete' => 0, 'add' => 0 );         var $group_ops = array();              var $cache_enabled = true;         var $default_expiration = 0;         var $abspath = '';         var $debug = false;              function add( $id, $data, $group = 'default', $expire = 0 ) {             $key = $this->key( $id, $group );                  if ( is_object( $data ) )                 $data = clone $data;                  $store_data = $data;                  if ( is_array( $data ) )                 $store_data = new ArrayObject( $data );                  if ( in_array( $group, $this->no_mc_groups ) ) {                 $this->cache[$key] = $data;                 return true;             } elseif ( isset( $this->cache[$key] ) && $this->cache[$key] !== false ) {                 return false;             }                  $expire = ( $expire == 0 ) ? $this->default_expiration : $expire;                  $result = apc_add( $key, $store_data, $expire );             if ( false !== $result ) {                 @ ++$this->stats['add'];                 $this->group_ops[$group][] = "add $id";                 $this->cache[$key] = $data;             }                  return $result;         }              function add_global_groups( $groups ) {             if ( !is_array( $groups ) )                 $groups = (array) $groups;                  $this->global_groups = array_merge( $this->global_groups, $groups );             $this->global_groups = array_unique( $this->global_groups );         }              function add_non_persistent_groups( $groups ) {             if ( !is_array( $groups ) )                 $groups = (array) $groups;                  $this->no_mc_groups = array_merge( $this->no_mc_groups, $groups );             $this->no_mc_groups = array_unique( $this->no_mc_groups );         }              // This is named incr2 because Batcache looks for incr         // We will define that in a class extension if it is available (APC 3.1.1 or higher)         function incr2( $id, $n = 1, $group = 'default' ) {             $key = $this->key( $id, $group );             if ( function_exists( 'apc_inc' ) )                 return apc_inc( $key, $n );             else                 return false;         }              function decr( $id, $n = 1, $group = 'default' ) {             $key = $this->key( $id, $group );             if ( function_exists( 'apc_dec' ) )                 return apc_dec( $id, $n );             else                 return false;         }              function close() {             return true;         }              function delete( $id, $group = 'default' ) {             $key = $this->key( $id, $group );                  if ( in_array( $group, $this->no_mc_groups ) ) {                 unset( $this->cache[$key] );                 return true;             }                  $result = apc_delete( $key );                  @ ++$this->stats['delete'];             $this->group_ops[$group][] = "delete $id";                  if ( false !== $result )                 unset( $this->cache[$key] );                  return $result;         }              function flush() {             // Don't flush if multi-blog.             if ( function_exists( 'is_site_admin' ) || defined( 'CUSTOM_USER_TABLE' ) && defined( 'CUSTOM_USER_META_TABLE' ) )                 return true;                  $this->cache = array();             return apc_clear_cache( 'user' );         }              function get($id, $group = 'default', $force = false) {             $key = $this->key($id, $group);                  if ( isset($this->cache[$key]) && ( !$force || in_array($group, $this->no_mc_groups) ) ) {                 if ( is_object( $this->cache[$key] ) )                     $value = clone $this->cache[$key];                 else                     $value = $this->cache[$key];             } else if ( in_array($group, $this->no_mc_groups) ) {                 $this->cache[$key] = $value = false;             } else {                 $value = apc_fetch( $key );                 if ( is_object( $value ) && 'ArrayObject' == get_class( $value ) )                     $value = $value->getArrayCopy();                 if ( NULL === $value )                     $value = false;                 $this->cache[$key] = ( is_object( $value ) ) ? clone $value : $value;             }                  @ ++$this->stats['get'];             $this->group_ops[$group][] = "get $id";                  if ( 'checkthedatabaseplease' === $value ) {                 unset( $this->cache[$key] );                 $value = false;             }                  return $value;         }              function key( $key, $group ) {             if ( empty( $group ) )                 $group = 'default';                  if ( false !== array_search( $group, $this->global_groups ) )                 $prefix = $this->global_prefix;             else                 $prefix = $this->blog_prefix;                  return WP_APC_KEY_SALT . ':' . $this->abspath . ":$prefix$group:$key";         }              function replace( $id, $data, $group = 'default', $expire = 0 ) {             return $this->set( $id, $data, $group, $expire );         }              function set( $id, $data, $group = 'default', $expire = 0 ) {             $key = $this->key( $id, $group );             if ( isset( $this->cache[$key] ) && ('checkthedatabaseplease' === $this->cache[$key] ) )                 return false;                  if ( is_object( $data ) )                 $data = clone $data;                  $store_data = $data;                  if ( is_array( $data ) )                 $store_data = new ArrayObject( $data );                  $this->cache[$key] = $data;                  if ( in_array( $group, $this->no_mc_groups ) )                 return true;                  $expire = ( $expire == 0 ) ? $this->default_expiration : $expire;             $result = apc_store( $key, $store_data, $expire );                  return $result;         }              function switch_to_blog( $blog_id ) {             global $table_prefix;                  $blog_id = (int) $blog_id;             $this->blog_prefix = ( is_multisite() ? $blog_id : $table_prefix ) . ':';         }              function colorize_debug_line( $line ) {             $colors = array(                 'get' => 'green',                 'set' => 'purple',                 'add' => 'blue',                 'delete' => 'red');                  $cmd = substr( $line, 0, strpos( $line, ' ' ) );                  $cmd2 = "$cmd";                  return $cmd2 . substr( $line, strlen( $cmd ) ) . "\n";         }              function stats() {             echo "
\n";             foreach ( $this->stats as $stat => $n ) {                 echo "$stat $n";                 echo "
\n";             }             echo "
\n";             echo "
APC:
";             foreach ( $this->group_ops as $group => $ops ) {                 if ( !isset( $_GET['debug_queries'] ) && 500 < count( $ops ) ) {                     $ops = array_slice( $ops, 0, 500 );                     echo "<big>Too many to show! Show them anyway.</big>\n";                 }                 echo "
$group commands
";                 echo "
\n";                 $lines = array();                 foreach ( $ops as $op ) {                     $lines[] = $this->colorize_debug_line($op);                 }                 print_r($lines);                 echo "
\n";             }             if ( $this->debug ) {                 $apc_info = apc_cache_info();                 echo "
";                 echo "Cache Hits: {$apc_info['num_hits']}
\n";                 echo "Cache Misses: {$apc_info['num_misses']}\n";                 echo "
\n";             }         }              function WP_Object_Cache() {             $this->abspath = md5( ABSPATH );                  global $blog_id, $table_prefix;             $this->global_prefix = '';             $this->blog_prefix = '';             if ( function_exists( 'is_multisite' ) ) {                 $this->global_prefix = ( is_multisite() || defined('CUSTOM_USER_TABLE') && defined('CUSTOM_USER_META_TABLE') ) ? '' : $table_prefix;                 $this->blog_prefix = ( is_multisite() ? $blog_id : $table_prefix ) . ':';             }                  $this->cache_hits =& $this->stats['get'];             $this->cache_misses =& $this->stats['add'];         }     }          if ( function_exists( 'apc_inc' ) ) {         class APC_Object_Cache extends WP_Object_Cache {             function incr( $id, $n = 1, $group = 'default' ) {                 return parent::incr2( $id, $n, $group );             }         }     } else {         class APC_Object_Cache extends WP_Object_Cache {             // Blank         }     }          } // !function_exists( 'wp_cache_add' )          else : // No APC         function apc_not_actually_running() {             $GLOBALS['_wp_using_ext_object_cache'] = false;             unset( $GLOBALS['wp_filter']['all'][-100]['apc_not_actually_running'] );         }         $GLOBALS['_wp_using_ext_object_cache'] = false; // This will get overridden as of WP 3.5, so we have to hook in to 'all':         $GLOBALS['wp_filter']['all'][-100]['apc_not_actually_running'] = array( 'function' => 'apc_not_actually_running', 'accepted_args' => 0 );         require_once ( ABSPATH . WPINC . '/cache.php' );     endif;      Contents of `advanced-cache.php`:               <?php          // nananananananananananananananana BATCACHE!!!          function batcache_cancel() {         global $batcache;              if ( is_object($batcache) )             $batcache->cancel = true;     }          class batcache {         // This is the base configuration. You can edit these variables or move them into your wp-config.php file.         var $max_age =  300; // Expire batcache items aged this many seconds (zero to disable batcache)              var $remote  =    0; // Zero disables sending buffers to remote datacenters (req/sec is never sent)              var $times   =    2; // Only batcache a page after it is accessed this many times... (two or more)         var $seconds =  120; // ...in this many seconds (zero to ignore this and use batcache immediately)              var $group   = 'batcache'; // Name of memcached group. You can simulate a cache flush by changing this.              var $unique  = array(); // If you conditionally serve different content, put the variable values here.              var $headers = array(); // Add headers here. These will be sent with every response from the cache.              var $cache_redirects = false; // Set true to enable redirect caching.         var $redirect_status = false; // This is set to the response code during a redirect.         var $redirect_location = false; // This is set to the redirect location.              var $uncached_headers = array('transfer-encoding'); // These headers will never be cached. Apply strtolower.              var $debug   = true; // Set false to hide the batcache info               var $cache_control = true; // Set false to disable Last-Modified and Cache-Control headers              var $cancel = false; // Change this to cancel the output buffer. Use batcache_cancel();              var $genlock; // Used internally         var $do; // Used internally              function batcache( $settings ) {             if ( is_array( $settings ) ) foreach ( $settings as $k => $v )                 $this->$k = $v;         }              function is_ssl() {             if ( isset($_SERVER['HTTPS']) ) {                 if ( 'on' == strtolower($_SERVER['HTTPS']) )                     return true;                 if ( '1' == $_SERVER['HTTPS'] )                     return true;             } elseif ( isset($_SERVER['SERVER_PORT']) && ( '443' == $_SERVER['SERVER_PORT'] ) ) {                 return true;             }             return false;         }              function status_header( $status_header ) {             $this->status_header = $status_header;                  return $status_header;         }              function redirect_status( $status, $location ) {             if ( $this->cache_redirects ) {                 $this->redirect_status = $status;                 $this->redirect_location = $location;             }                  return $status;         }              function configure_groups() {             // Configure the memcached client             if ( ! $this->remote )                 if ( function_exists('wp_cache_add_no_remote_groups') )                     wp_cache_add_no_remote_groups(array($this->group));             if ( function_exists('wp_cache_add_global_groups') )                 wp_cache_add_global_groups(array($this->group));         }              // Defined here because timer_stop() calls number_format_i18n()         function timer_stop($display = 0, $precision = 3) {             global $timestart, $timeend;             $mtime = microtime();             $mtime = explode(' ',$mtime);             $mtime = $mtime[1] + $mtime[0];             $timeend = $mtime;             $timetotal = $timeend-$timestart;             $r = number_format($timetotal, $precision);             if ( $display )                 echo $r;             return $r;         }              function ob($output) {             if ( $this->cancel !== false )                 return $output;                  // PHP5 and objects disappearing before output buffers?             wp_cache_init();                  // Remember, $wp_object_cache was clobbered in wp-settings.php so we have to repeat this.             $this->configure_groups();                  // Do not batcache blank pages unless they are HTTP redirects             $output = trim($output);             if ( $output === '' && (!$this->redirect_status || !$this->redirect_location) )                 return;                  // Construct and save the batcache             $cache = array(                 'output' => $output,                 'time' => time(),                 'timer' => $this->timer_stop(false, 3),                 'status_header' => $this->status_header,                 'redirect_status' => $this->redirect_status,                 'redirect_location' => $this->redirect_location,                 'version' => $this->url_version             );                  if ( function_exists( 'headers_list' ) ) {                 foreach ( headers_list() as $header ) {                     list($k, $v) = array_map('trim', explode(':', $header, 2));                     $cache['headers'][$k] = $v;                 }             } elseif ( function_exists( 'apache_response_headers' ) ) {                 $cache['headers'] = apache_response_headers();             }                  if ( $cache['headers'] && !empty( $this->uncached_headers ) ) {                 foreach ( $cache['headers'] as $header => $value ) {                     if ( in_array( strtolower( $header ), $this->uncached_headers ) )                         unset( $cache['headers'][$header] );                 }             }                  wp_cache_set($this->key, $cache, $this->group, $this->max_age + $this->seconds + 30);                  // Unlock regeneration             wp_cache_delete("{$this->url_key}_genlock", $this->group);                  if ( $this->cache_control ) {                 header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $cache['time'] ) . ' GMT', true );                 header("Cache-Control: max-age=$this->max_age, must-revalidate", false);             }                  if ( !empty($this->headers) ) foreach ( $this->headers as $k => $v ) {                 if ( is_array( $v ) )                     header("{$v[0]}: {$v[1]}", false);                 else                     header("$k: $v", true);             }                  // Add some debug info just before              if ( $this->debug ) {                 $tag = "\n";                 if ( false !== $tag_position = strpos($output, '') ) {                     $tag = "\n";                     $output = substr($output, 0, $tag_position) . $tag . substr($output, $tag_position);                 }             }                  // Pass output to next ob handler             return $output;         }     }     global $batcache;     // Pass in the global variable which may be an array of settings to override defaults.     $batcache = new batcache($batcache);          if ( ! defined( 'WP_CONTENT_DIR' ) )         return;          // Never batcache interactive scripts or API endpoints.     if ( in_array(             basename( $_SERVER['SCRIPT_FILENAME'] ),             array(                 'wp-app.php',                 'xmlrpc.php',                 'ms-files.php',             ) ) )         return;          // Never batcache WP javascript generators     if ( strstr( $_SERVER['SCRIPT_FILENAME'], 'wp-includes/js' ) )         return;          // Never batcache when POST data is present.     if ( ! empty( $GLOBALS['HTTP_RAW_POST_DATA'] ) || ! empty( $_POST ) )         return;          // Never batcache when cookies indicate a cache-exempt visitor.     if ( is_array( $_COOKIE) && ! empty( $_COOKIE ) )         foreach ( array_keys( $_COOKIE ) as $batcache->cookie )             if ( $batcache->cookie != 'wordpress_test_cookie' && ( substr( $batcache->cookie, 0, 2 ) == 'wp' || substr( $batcache->cookie, 0, 9 ) == 'wordpress' || substr( $batcache->cookie, 0, 14 ) == 'comment_author' ) )                 return;          if ( ! include_once( WP_CONTENT_DIR . '/object-cache.php' ) )         return;          wp_cache_init(); // Note: wp-settings.php calls wp_cache_init() which clobbers the object made here.          if ( ! is_object( $wp_object_cache ) )         return;          // Now that the defaults are set, you might want to use different settings under certain conditions.          /* Example: if your documents have a mobile variant (a different document served by the same URL) you must tell batcache about the variance. Otherwise you might accidentally cache the mobile version and serve it to desktop users, or vice versa.     $batcache->unique['mobile'] = is_mobile_user_agent();     */          /* Example: never batcache for this host     if ( $_SERVER['HTTP_HOST'] == 'do-not-batcache-me.com' )         return;     */          /* Example: batcache everything on this host regardless of traffic level     if ( $_SERVER['HTTP_HOST'] == 'always-batcache-me.com' ) {         $batcache->max_age = 600; // Cache for 10 minutes         $batcache->seconds = $batcache->times = 0; // No need to wait till n number of people have accessed the page, cache instantly     }     */          /* Example: If you sometimes serve variants dynamically (e.g. referrer search term highlighting) you probably don't want to batcache those variants. Remember this code is run very early in wp-settings.php so plugins are not yet loaded. You will get a fatal error if you try to call an undefined function. Either include your plugin now or define a test function in this file.     if ( include_once( 'plugins/searchterm-highlighter.php') && referrer_has_search_terms() )         return;     */          // Disabled     if ( $batcache->max_age < 1 )         return;          // Make sure we can increment. If not, turn off the traffic sensor.     if ( ! method_exists( $GLOBALS['wp_object_cache'], 'incr' ) )         $batcache->times = 0;          // Necessary to prevent clients using cached version after login cookies set. If this is a problem, comment it out and remove all Last-Modified headers.     header('Vary: Cookie', false);          // Things that define a unique page.     if ( isset( $_SERVER['QUERY_STRING'] ) )         parse_str($_SERVER['QUERY_STRING'], $batcache->query);     $batcache->keys = array(         'host' => $_SERVER['HTTP_HOST'],         'method' => $_SERVER['REQUEST_METHOD'],         'path' => ( $batcache->pos = strpos($_SERVER['REQUEST_URI'], '?') ) ? substr($_SERVER['REQUEST_URI'], 0, $batcache->pos) : $_SERVER['REQUEST_URI'],         'query' => $batcache->query,         'extra' => $batcache->unique     );          if ( $batcache->is_ssl() )         $batcache->keys['ssl'] = true;          $batcache->configure_groups();          // Generate the batcache key     $batcache->key = md5(serialize($batcache->keys));          // Generate the traffic threshold measurement key     $batcache->req_key = $batcache->key . '_req';          // Get the batcache     $batcache->cache = wp_cache_get($batcache->key, $batcache->group);          // Are we only caching frequently-requested pages?     if ( $batcache->seconds < 1 || $batcache->times < 2 ) {         $batcache->do = true;     } else {         // No batcache item found, or ready to sample traffic again at the end of the batcache life?         if ( !is_array($batcache->cache) || time() >= $batcache->cache['time'] + $batcache->max_age - $batcache->seconds ) {             wp_cache_add($batcache->req_key, 0, $batcache->group);             $batcache->requests = wp_cache_incr($batcache->req_key, 1, $batcache->group);                  if ( $batcache->requests >= $batcache->times )                 $batcache->do = true;             else                 $batcache->do = false;         }     }          // Recreate the permalink from the URL     $batcache->permalink = 'http://' . $batcache->keys['host'] . $batcache->keys['path'] . ( isset($batcache->keys['query']['p']) ? "?p=" . $batcache->keys['query']['p'] : '' );     $batcache->url_key = md5($batcache->permalink);     $batcache->url_version = (int) wp_cache_get("{$batcache->url_key}_version", $batcache->group);          // If the document has been updated and we are the first to notice, regenerate it.     if ( $batcache->do !== false && isset($batcache->cache['version']) && $batcache->cache['version'] < $batcache->url_version )         $batcache->genlock = wp_cache_add("{$batcache->url_key}_genlock", 1, $batcache->group);          // Did we find a batcached page that hasn't expired?     if ( isset($batcache->cache['time']) && ! $batcache->genlock && time() < $batcache->cache['time'] + $batcache->max_age ) {         // Issue redirect if cached and enabled         if ( $batcache->cache['redirect_status'] && $batcache->cache['redirect_location'] && $batcache->cache_redirects ) {             $status = $batcache->cache['redirect_status'];             $location = $batcache->cache['redirect_location'];             // From vars.php             $is_IIS = (strpos($_SERVER['SERVER_SOFTWARE'], 'Microsoft-IIS') !== false || strpos($_SERVER['SERVER_SOFTWARE'], 'ExpressionDevServer') !== false);             if ( $is_IIS ) {                 header("Refresh: 0;url=$location");             } else {                 if ( php_sapi_name() != 'cgi-fcgi' ) {                     $texts = array(                         300 => 'Multiple Choices',                         301 => 'Moved Permanently',                         302 => 'Found',                         303 => 'See Other',                         304 => 'Not Modified',                         305 => 'Use Proxy',                         306 => 'Reserved',                         307 => 'Temporary Redirect',                     );                     $protocol = $_SERVER["SERVER_PROTOCOL"];                     if ( 'HTTP/1.1' != $protocol && 'HTTP/1.0' != $protocol )                         $protocol = 'HTTP/1.0';                     if ( isset($texts[$status]) )                         header("$protocol $status " . $texts[$status]);                     else                         header("$protocol 302 Found");                 }                 header("Location: $location");             }             exit;         }              // Issue "304 Not Modified" only if the dates match exactly.         if ( $batcache->cache_control && isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) ) {             $since = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);             if ( isset($batcache->cache['headers']['Last-Modified']) )                 $batcache->cache['time'] = strtotime( $batcache->cache['headers']['Last-Modified'] );             if ( $batcache->cache['time'] == $since ) {                 header('Last-Modified: ' . $_SERVER['HTTP_IF_MODIFIED_SINCE'], true, 304);                 exit;             }         }              // Use the batcache save time for Last-Modified so we can issue "304 Not Modified"         if ( $batcache->cache_control ) {             header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s', $batcache->cache['time'] ) . ' GMT', true );             header('Cache-Control: max-age=' . ($batcache->max_age - time() + $batcache->cache['time']) . ', must-revalidate', true);         }              // Add some debug info just before          if ( $batcache->debug ) {             if ( false !== $tag_position = strpos($batcache->cache['output'], '') ) {                 $tag = "\n";                 $batcache->cache['output'] = substr($batcache->cache['output'], 0, $tag_position) . $tag . substr($batcache->cache['output'], $tag_position);             }         }              if ( !empty($batcache->cache['headers']) ) foreach ( $batcache->cache['headers'] as $k => $v )             header("$k: $v", true);              if ( !empty($batcache->headers) ) foreach ( $batcache->headers as $k => $v ) {             if ( is_array( $v ) )                 header("{$v[0]}: {$v[1]}", false);             else                 header("$k: $v", true);         }              if ( !empty($batcache->cache['status_header']) )             header($batcache->cache['status_header'], true);              // Have you ever heard a death rattle before?         die($batcache->cache['output']);     }          // Didn't meet the minimum condition?     if ( !$batcache->do && !$batcache->genlock )         return;          $wp_filter['status_header'][10]['batcache'] = array( 'function' => array(&$batcache, 'status_header'), 'accepted_args' => 1 );     $wp_filter['wp_redirect_status'][10]['batcache'] = array( 'function' => array(&$batcache, 'redirect_status'), 'accepted_args' => 2 );          ob_start(array(&$batcache, 'ob'));          // It is safer to omit the final PHP closing tag.


title: rt media plugin count not working in shortcode

text: I used rtMedia plugin in my buddypress site. I used the short code `<?php echo do_shortcode('[rtmedia_gallery global="true" media_type="all" count="4" loadmore="false"]'); ?>` to dispaly media gallery items. But the count and load more not working. It shows more than 4 items now. How to fix this?


title: Wordpress functions.php - Execute plugin specific user online

text: One Trick Pony posted a great script that I'm trying to adapt to my needs. Registration in my website is restricted. There is only one user, a editor. The idea is to have a Chat Plugin, and it would be enabled and disabled based on if the editor is online or not, since he will be answering the chat, and if the chat is enabled and editor offline, it only consumes space. The code:               define('EDITOR_USER_ID', 2); // your editor user ID here          add_action('wp', 'update_online_users_status');           function update_online_users_status(){       if(is_user_logged_in()){              // get the online users list              if(($logged_in_users = get_transient('users_online')) === false) $logged_in_users = array();              $current_user = wp_get_current_user();         $current_user = $current_user->ID;           $current_time = current_time('timestamp');              if(!isset($logged_in_users[$current_user]) || ($logged_in_users[$current_user] < ($current_time - ($time_limit * 60)))){                $logged_in_users[$current_user] = $current_time;                set_transient('users_online', $logged_in_users, 1 * 60);              }       }     }          add_action('admin_init', 'handle_chat');          function handle_chat(){            if(is_user_online(EDITOR_USER_ID)){               if(!is_plugin_active('online-chat/online-chat.php'))            activate_plugins('online-chat/online-chat.php');               } else {              if(is_plugin_active('online-chat/online-chat.php'))            deactivate_plugins('online-chat/online-chat.php');                }          }               function is_user_online($user_id) {            // get the online users list       $logged_in_users = get_transient('users_online');            // online, if (s)he is in the list and last activity was less than 15 minutes ago       return isset($logged_in_users[$user_id]) && $logged_in_users[$user_id] > (current_time('timestamp') - (1 * 60));     }      **Issues still left** : Chat enabling/disabling should be instant, without having to wait 15 minutes after editor logout/login, so I've decreased this value to 1 Should be init instead of admin_init, so it could be enabled in the front end. But when I change it a errors shows up: * **Fatal error: Call to undefined function is_plugin_active() in /home/mgdownhill/www/wp-content/themes/criatweb/functions.php on line 412*** 412-> if(!is_plugin_active('online-chat/online-chat.php')) activate_plugins('online-chat/online-chat.php'); **My question** : Is there a way to make it instant, without overloading the server? I will have a lot of websites running this chat script in the same server.


title: Virtual Page with Registration form

text: Working on a plugin, which is intended to provide a registration on front-end, to let users register. I am trying to create a Virtual page, which would display the form. Trying to create URL like the following http://example.com/plugin_register/register Have been referring to, How do you create a 'virtual' page in WordPress But have been unable to make it work with changed query_var, for e.g. if I replace `wpse9870_api` with `plugin_register`, it redirects to home-page or 404 page. Also referring to Rewrite API/add rewrite rule But have been unable to get this work too. My plugin looks like the following:               add_action( 'init', 'wpse9870_init_internal' );     function wpse9870_init_internal() {         add_rewrite_rule( '^my-api.php$', 'index.php?wpse9870_api=1', 'top' );         //add_rewrite_rule('^nutrition/?','index.php?wpse9870_api=1','top');     }          add_filter( 'query_vars', 'wpse9870_query_vars' );     function wpse9870_query_vars( $query_vars ) {     $query_vars[] = 'wpse9870_api';     return $query_vars;     }          add_action( 'parse_request', 'wpse9870_parse_request' );     function wpse9870_parse_request( &$wp ) {         if ( array_key_exists( 'wpse9870_api', $wp->query_vars ) ) {              include(realpath(plugin_dir_path( __FILE__ ).'index.php'));          //echo plugin_dir_path( __FILE__ );          exit();         }         return;     }


title: multiple categories and breadcrumbs problem

text: Let me explain my problem. I have this post that uses multiple categories... and categories are being shown as breadcrumbs I there a way where I can display 1 specific tree? example I have `game > basketball > teams > team A > players > player1` and `announcement > new players > player1` Now, when I browse game going deep to player1 I will have that first example as my breadcrumb for that page. But, navigating through announcement going deep to player1 will also give that kind of breadcrumb. Is there a way to achieve getting the second breadcrumb? even using `/%category%/%postname%/` as permalink, the url will only use one specific... like `game/basketball/teams/team A/players/player1/` well it's like this, 1st: `announcement/` clicking new players: `announcement/new players/` after clicking player1: `game/basketball/teams/team A/players/player1/`    why can't I continue as `announcement/new players/player1/` ? and `announcement > new players > player1` ?


title: Create subpage - filter parent pages list

text: I have a website here with a lot of content and with the content where is necessary to create pages in hierarchy. But it is uncomfortable to go through the dropdown in the administration with a lot of pages. So my point is - in the admin at the moment i create/edit page and need to select the parent page from the list, I want to somehow filter or limit or search the list of possible parent pages. Thank you!


title: Editor access to menu: custom post type missing

text: I have used this code;               $roleObject = get_role( 'editor' );     if (!$roleObject->has_cap( 'edit_theme_options' ) ) {         $roleObject->add_cap( 'edit_theme_options' );     }      to add menu access for editors. I have a custom post type 'Masterclasses". That appears correctly in the Administrator's Menu editing page but doesn't appear in the Editor's Menu editing page. How do I add this?


title: Post Type => Any conundrum

text: I have a number of regular posts and pages in a regular category called "Featured". I have also installed a plugin called "Event Organizer" that creates its own custom post type called "Event" and has its own interface for creating plugin-specific categories. Anyways, what I've created is a basic highlight slider using a query to pull in the featured category posts and pages (I enabled categories in my pages) as well as the event posts. This is the query:               $args=array(       'post_type' => 'any',       'showposts' => $featured_num,       'order' => 'DESC',       'tax_query' => array(         'relation' => 'OR',         array(             'taxonomy' => 'category',             'field' => 'slug',             'terms' => 'featured'         ),         array(             'taxonomy' => 'event-category',             'field' => 'slug',             'terms' => 'featured-event',         )         )       );     $my_query = new WP_Query($args);      The problem is that everything works fine on my local testing environment but absolutely refuses to work on my web host. In my local testing environment both the "featured" posts and pages are pulled up _AS WELL AS_ the event custom posts. On my web host only the event posts show. If I switch "post type" to `array('post','page')` I get the **featured** posts and pages but lose the event posts.


title: Create site programmatically for WPMU

text: My customer has a site, which has WP blog + vBulletin forum. Now he wants to allow vb users to have their own blog, by modifying current WP blog to WPMU network. So I want to create a button, which could be clicked by vb user and new site will be created in network for him. How can I create new site programmatically for WPMU network?


title: How to get latest page (not post) of User and display the content

text: I've been trying to get the latest Page, not post, by author ID and display it on a page. The reason it has to be a page and not a post is that the user will only be posting one page and a whole bunch of posts. This also needs to be done dynamically and be based on the current logged in user. I've got the following code:               <?php     $user_id = get_current_user_id();     echo $user_id;     $args = array(         'post_type' => 'page',         'post_status' => 'published',         'posts_per_page' => 1,         'author' => $user_id     );     $my_posts = get_posts( $args );          foreach ( $my_posts as $post ) : setup_postdata( $post ); ?>                 <?php the_title(); ?>     <?php endforeach; ?>      All this does is return the title of the current page (testing with the_title(); will replace with the_content(); once it starts working). I've looked around for solutions but can't find any. Would love some help with this.


title: wp_deregister_script and wp_dequeue_script not working on chrome

text: I am working on a child theme and facing an weird issue. I deregister and dequeue scripts on child theme functions.php it is working fine on Mozilla Firefox and on other browsers but not working on Chrome. Scripts files are still visible in chrome even i have cleared my browser cache. but the custom.js script i have enqueued it is working fine in Chrome.               add_action( 'wp_enqueue_scripts', 'as_scripts_basic', 100);      function as_scripts_basic() {           wp_deregister_script('waypoints');         wp_deregister_script('waypoints-sticky');         wp_dequeue_script('waypoints');         wp_dequeue_script('waypoints-sticky');         wp_enqueue_script('child-custom', get_stylesheet_directory_uri() . '/js/custom.js', '', '', TRUE);     }


title: Using TinyMCE fiddle for node filter to add id attribute to anchors

text: I'd like to edit the code of the anchor-maker in TineMCE so it will paste into the code the following line: `<a name="#ANCHOR" id="#ANCHOR">` instead of: `<a name="#ANCHOR">` Where do I find a proper file with settings for this stuff? This is my code:               <script type="text/javascript">     tinyMCE.init({             // General options             mode : "textareas",             theme : "advanced",             plugins : "autolink,lists,spellchecker,pagebreak,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,imagemanager,filemanager",                  // Theme options             theme_advanced_buttons1 : "save,newdocument,|,bold,italic,underline,strikethrough,|,justifyleft,justifycenter,justifyright,justifyfull,|,styleselect,formatselect,fontselect,fontsizeselect",             theme_advanced_buttons2 : "cut,copy,paste,pastetext,pasteword,|,search,replace,|,bullist,numlist,|,outdent,indent,blockquote,|,undo,redo,|,link,unlink,anchor,image,cleanup,help,code,|,insertdate,inserttime,preview,|,forecolor,backcolor",             theme_advanced_buttons3 : "tablecontrols,|,hr,removeformat,visualaid,|,sub,sup,|,charmap,emotions,iespell,media,advhr,|,print,|,ltr,rtl,|,fullscreen",             theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,spellchecker,|,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",             theme_advanced_toolbar_location : "top",             theme_advanced_toolbar_align : "left",             theme_advanced_statusbar_location : "bottom",             theme_advanced_resizing : true,         width: "100%",         height: "400",         init_instance_callback: function(ed) {           ed.serializer.addNodeFilter('a', function(nodes) {             tinymce.each(nodes, function(node) {                 node.attr('id', node.attr('name'));             });           });         }     });     </script>          <form method="post" action="dump.php">             <textarea name="content"></textarea>     </form>      I think I'm using TincyMCE Advanced version 3.5.8. All I see in the entire source code of the "Edit Post" page on the latest version of WordPress, is tinyMCEPreInit stuff... and I tried appending what's in the fiddle to the array:                   init_instance_callback: function(ed) {          ed.serializer.addNodeFilter('a', function(nodes) {            tinymce.each(nodes, function(node) {                node.attr('id', node.attr('name'));             });           });         }


title: Move jQuery to the bottom of the page whilst keeping the WordPress jQuery

text: I wish to move jQuery to the bottom of the page on my theme, to speed up loading times. Previously I was doing this by replacing it with Google's CDN version but I have been told that is a bad thing to do. How can I deregister and re-register the WordPress jQuery script and move it to the bottom without causing any problems?


title: Why do my offline development site and online live site behave differently?

text: I have two versions of my site - one live, the other a development site using DeskTopServer. I work on the development site - adding / editing posts etc. and making changes to the WP database, and playing around with templates, which are in a child theme. Periodically, I delete the live WP database and replace it with the development one. At the same time I ensure that the themes are in sync, adding any new templates and replacing amended ones. The only difference between the two sites (that I'm aware of) is that some plugins are installed and activated on the development site that are not present on the live site. These plugins only do things 'back-end' - i.e. to do with admin stuff to make my life easier when working from the dashboard. Although they're enabled when I export the WP database to the live site, once it's there they're automatically deactivated because they don't exist. This therefore shouldn't (and as far as I know to date doen't) affect how the live site works. I've just added a new custom taxonomy and a new template to display custom posts with that taxonomy. This works perfectly on the live site, but on the development site generates a 404 error. I've tried deactivating plugins on the development site that are not on the live so that the two should be completely identical, but that doesn't solve the problem. I have one plugin - active on both sites - which does occasionally lead to weird things happening, but it has a 'clear cache' facility which once cleared has always also cleared any problems in the past. The plugin is such an integral part of the site that I can't deactivate it without breaking most of the templates etc. (It creates custom post types, custom fields, etc.) If I switch to the standard theme, the development site still leads to a 404 error, the live site still works. The live page is here though as I can't also show the offline development page, the link probably doesn't help much! This isn't a catastrophe, at least it's the right way round. I can, if I have to, live with a slight hiccup on the development site, but it's bugging the hell out of me to not be able to work out why it should happen. Does anyone have any ideas?


title: wordpress qtranslate editor text is not working

text: I have installed qtranslate on my wordpress site, it all works fine, but sometimes the content editor does not show the text, When I force refresh the page a few times (Ctrl + r) **_eventually the text shows up_**. I was going to put images here to explain it but, this post already has the images I would put on, ( **however the questions differ** ) qtranslate is not working properly I have deactivated all of the plugins, and this problem it's still there, I have tried alot of other things to **Error** :               Uncaught TypeError: Cannot set property 'setup' of undefined     Line: 303, qtranslate_javascript.php          $q_config['js']['qtrans_hook_on_tinyMCE'] = "     qtrans_hook_on_tinyMCE = function(id) {          tinyMCEPreInit.mceInit[id].setup = function(ed) {         ed.onSaveContent.add(function(ed, o) {             if (!ed.isHidden())  {                 qtrans_save(switchEditors.pre_wpautop(o.content));             }         });     };     ed = new tinymce.Editor(id, tinyMCEPreInit.mceInit[id]);         ed.render();     }     ";      **Console Logging ID:**               qtrans_textarea_content post.php:467     qtrans_textarea_acf_settings       **Other notes** I have also tried to add the `try{} catch(e){}` to avoid the script from breaking down, it does not seem to help at all, I have run out of options and I really need some help with this Cheers


title: Does Wordpress generate an automatic page for post formats?

text: I want a page to view only a specific post format (e.g. aside). Do I have to create my own page and run a custom query, or does Wordpress have an automatic page generated for me (like the categories)?


title: Custom meta box includes

text: I am having some problems including files for my custom meta boxes. I have a structure like so: post-meta.php   * cmb   *     * teaser_meta_box   *     *       * load.php   *     *       * initiate.php   *     *       * display.php   *     *       * save.php So within my post-meta.php I have the following includes:               // Load Meta Boxes     function add_custom_meta_box()     {         require_once dirname( __FILE__ ) . '/cmb/teaser_meta_box/load.php';     }     add_action('add_meta_boxes', 'add_custom_meta_box');          // Initiate Meta Box Fields     require_once dirname( __FILE__ ) . '/cmb/epteaser_meta_box/initiate.php';          // Display Meta Box Fields     require_once dirname( __FILE__ ) . '/cmb/epteaser_meta_box/display.php';          // Save Meta Box Fields     function save_custom_meta($post_id)     {     global $meta_fields_epteaser, $post; // Need to put name of each meta field here          // verify nonce       if (!wp_verify_nonce($_POST['custom_meta_box_nonce'], basename(__FILE__)))         return $post_id;     // check autosave       if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)         return $post_id;     // check permissions       if ('page' == $_POST['post_type']) {         if (!current_user_can('edit_page', $post_id))         return $post_id;     } elseif (!current_user_can('edit_post', $post_id)) {         return $post_id;     }              require_once dirname( __FILE__ ) . '/cmb/epteaser_meta_box/save.php';          }     add_action('save_post', 'save_custom_meta');      When I try this the meta boxes do not work how they should, however I do not get any errors saying includes are wrong etc. If I try to put the code directly into the file for initiating and displaying the meta box it then works. Any ideas as to why these two includes dont seem to work when included? Thanks Robert


title: How do I get the right permissions for WordPress running Apache on Debian

text: I'm trying to set up a WordPress site on a LAMP stack on Debian 6.0. From the WordPress documentation (and my experience on shared hosts) the correct permissions should be as follows > All files should be owned by your user account, and should be writable by > you. Any file that needs write access from WordPress should be group-owned > by the user account used by the webserver. I've managed to setup my server to have 755 permissions on all directories and 644 on all files. However, WordPress is still not able to create folders for uploads and upgrades. I'm guessing that this is because WordPress is not running as my user account, but as www-data and therefore it needs group write permissions. How do I make WordPress run as my account? Or am I on the wrong track? I'm new to this, having outgrown shared hosting and setting up my first VPS. I would really appreciate it if you could answer in as much detail as possible.


title: How to determine if a plugin affects your file-system

text: Anyone have a tried method of testing plugins to determine whether or not they make changes to your file-system, database, or both? I think this would be useful for larger websites where files may be handled in version control and changes to files on the server from a plugin need to be accounted for. Maybe plugin authors should be encouraged to be more explicit in how their plugin affects your site in the plugin descriptions, FAQs, etc...


title: Dynamic css file Server Error

text: my theme uses a dynamic css file 'custom-style.php' which is included through wp_enqueue_style(); This file includes some styles depending on the theme options (colors,fonts,...) On some installation there is no access to this file. Trying to access the file via the source code gets a "500 Internal Server Error". Changing file permissions to 777 does not solve it. **How can I solve this? Is there any other possibility to create dynamic css files?** Alternatively I could write a function to include this css in the head of the html but this is not the way I want go. There are some lines of css and I don't like css in html output.


title: Add <span> within the <li> output of <? wp_nav_menu() ?>

text:
Im currently printing out:               <?php wp_nav_menu( array( 'theme_location' => 'primary' ) ); ?>      Which outputs:

Frontpage

etc

      In my original HTML setup ive got an `<span>` within the `<li>` which looks like this:

                        Menu1
      Any ideas on how to adjust this?


title: Creating a menu that lists your custom post types with wp_list_pages()

text:
I'm stumped on this, it is something I've gotten to work on other sites, but I must be overlooking something here. I'm trying to create a secondary menu for my custom post types ('staff') with wp_list_pages(). The function works fine if I'm tell it to return regular pages in the array parameter, but for some reason it doesn't return anything for my custom post type. Here is where I create the custom post type:                   $staff_args = array(         'public' => true,         'supports' => array(             'title', 'editor', 'thumbnail', 'custom_fields'         ),         'labels' => array(             'name' => 'Staff Pages',             'singular_name' => 'Staff Page',             'add_new' => 'Add new Staff Page',             'add_new_item' => 'Add new Staff Page',             'edit_item' => 'Edit Staff Page',             'new_item' => 'New Staff Page',             'view_item' => 'View Staff Page',             'search_item' => 'Search Staff Pages',             'not_found' => 'No Staff Pages found',             'not_found_in_trash' => 'No Staff Pages found in trash'         ),         'capability_type' => 'post',         'hiearchial' => true,         'rewrite' => array(             'slug' => 'team',         ),         'has_archive' => false,         'show_in_nav_menus' => true,         'query_var' => 'staff',         'menu_position' => 6,         'menu_icon' =>  $url . '/custom-plugin/standalone_page.png'     );          register_post_type('staff', $staff_args);      Here is where I run wp_list_pages():                   $secondary_menu_args = array(         'depth'        => 0,         'show_date'    => '',         'date_format'  => '',         'child_of'     => 0,         'exclude'      => '',         'include'      => '',         'title_li'     => _('Staff'),         'echo'         => 1,         'authors'      => '',         'sort_column'  => 'post_title',         'link_before'  => '',         'link_after'   => '',         'walker'       => '',         'post_type'    => 'staff',         'post_status'  => 'publish'     );      and
         <li <?php if($postID == $post->ID) echo 'class="current_page_item"'; ?>><a href="/<?php echo $menu_url; ?>"><?php echo $menu_title; ?>
         <?php wp_list_pages($secondary_menu_args); ?>
      Thanks in advance.


title: Integrating Tumblr with Wordpress

text: I have a project where I have to integrate my clients Tumblr into a Wordpress page. The idea is on the category page, the posts should show up in a Masonry format. Once you click a post it goes to the Tumblr format (Users like this, Users reblogged this). How will I go about doing this preferably without a plugin. Thanks!


title: Programatically add options to "add new" custom field dropdown

text: How can I add pre-defined options to the "add new" custom field dropdown? ![enter image description here](http://i.stack.imgur.com/WhvMS.png) Here's two examples of automatically adding and showing new custom fields:   1. WordPress: Adding Default Custom Fields on New Posts   2. Auto create custom field That's close to what I want to do; my goal is to add pre-defined options to the "add new" custom filed dropdown, but not have them show as fields until the blogger adds them. I'd like to know how to do this without using a plugin.


title: Are Drop-ins harmful for wordpress website?

text: In my wordpress plugins there is a new section, named Drop-ins. I am confused, these drop-ins can harm my website. Actually I am not sure. Can you help me, please. Are the Drop-ins are harmful? If harmful, how can I solve?


title: How to get Facebook comment plugin in blog?

text: I am trying to use Facebook social plugin to my blog. I tried few Wordpress plugins but getting error in it. Lastly, I tried using Flexo Facebook Manager(http://www.flexostudio.com/flexo- facebook-manager.html). But the problem still persists. The Facebook commenting tool is not coming in my blog. When clicked to Open graph it shows this error. Errors That Must Be Fixed Object Invalid Value: Object at URL 'http://buggingweb.com/2012/01/operating- system-in-your-browser-linux/' of type 'website' is invalid because the given value 'User ID' for property 'fb:admins' could not be parsed as type 'fbid'. Missing Required Property: The og:url property is required, but not present. Missing Required Property: The og:type property is required, but not present. Missing Required Property: The og:title property is required, but not present. Am not able to fix it. Thanks!


title: Add class to Categories Widget

text:
I have a few default widgets which I am using in a custom sidebar and I'd like to edit its output in my functions.php file. Currently the categories widget and blogrolls are generating an unordered list of links as such:

     Uncategorized

      I would like to somehow pass a class name into the unordered list itself to something along the lines of:
...
      I am just learning about using filters within the functions.php file and figured this was how I need to go about it but don't really know how.. Is this possible? How could I find out how to do something like this? -- Bruno


title: Sending all emails using SMTP

text: I tried using both Configure SMTP and WP Mail SMTP to send all domain emails through my donotreply Google Apps email address, but neither plugin worked. Attempting to send test emails through either results in the error `SMTP -> ERROR: Failed to connect to server: Network is unreachable (101)`. I entered the information correctly (smtp.gmail.com, port 465 OR 587 [tried both], SSL [also tried TLS]), but it cannot connect. Is there something I may need to configure with my host or on the Apps dashboard to make it work properly? I had it working with this Google Apps account on a different domain with my same host, but that WordPress installation has been deleted.


title: Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?

text: I have on many occasions used `wp_enqueue_script` to pass some 'query variables' to scripts like this:               function my_enqueue_scripts(){         $tempurl = urlencode( get_bloginfo( 'template_url' ) );         wp_register_script( 'somescript', get_bloginfo( 'template_url' ) . '/js/somescript.php?url=' . $tempurl );         wp_enqueue_script( 'somescript' );     }     add_action( 'wp_enqueue_scripts', 'my_enqueue_scripts' );      And I am just wondering if this is a 'best practice' or 'safe' to do, I don't see why it wouldn't be but I guess you never know until you ask. I'm just wondering what are the downsides of doing this, or even if there is an alternative/better way to do this. I also notice if I pass more than 1 variable, only the first one will actually be retrievable in the script. Is there something I need to do to make that work? Some advice would be great, thanks.


title: edit comments capability for authors

text: I am using wp site where registered users have authors roles. I want authors to have permissions to **edit their own comments**. Now only admin user have capability to edit comments and even editors do not have this capability. I tried plugins like Role Scoper or Members but they don't have this capabilities


title: How to use Greek characters/letters in a query?

text: I have a problem with Greek characters in a query. Here is the code Using the Greek characters in the 'meta_value' => 'Ναι' the query can't work, because of the language. How can i make it work?


title: Use shortlink as permalink

text: I'm using Url shortener plugin with bit.ly API. When I use the bit.ly url, it's redirecting to my Wordpress permalink. How Can I use the bit.ly all the time ? I want the bit.ly url become the permalink or my posts. Thank you so much.


title: How to order posts of a custom post type by date DESC in dashboard Admin?

text: I created a new post type named "Video". When I create post for the post type, posts is ordered by `title ASC`. **Is it possible to order posts by date DESC please ?**               register_post_type('Videos', array(         'labels' => array(             'name' => _x('Videos', 'post type general name'),             'singular_name' => _x('Video', 'post type singular name'),             'add_new' => _x('Ajouter', 'Video'),             'add_new_item' => __('Ajouter une video'),             'edit_item' => __('Éditer une video'),             'new_item' => __('Nouvelle video'),             'view_item' => __('Voir le lien de la video'),             //'search_items' => __(' Video'),             'menu_name' => 'Video'         ),         'public' => true,         'show_ui' => true,         'capability_type' => 'post',         'hierarchical' => true,         'rewrite' => array('slug' => 'video'),         'query_var' => true,         'supports' => array(             'title',             'editor' => false,             'excerpt' => false,             'trackbacks' => false,             'custom-fields',             'comments' => false,             'revisions' => false,             'thumbnail' => false,             'author' => false,             'page-attributes' => false,         ),         'taxonomies' => array('post_tag')        )      );


title: Enqueue script inside IE conditional comments

text: I'm trying to include selectivizr.js inside conditional comments. What am I doing wrong here?               <!DOCTYPE html>     <html class="no-js" <?php language_attributes(); ?>>     <head>       <meta charset="utf-8">       <meta http-equiv="X-UA-Compatible" content="IE=edge">       <title><?php wp_title('|', true, 'right'); ?></title>       <meta name="viewport" content="width=device-width, initial-scale=1">              <?php wp_head(); ?>            <!--[if (gte IE 6)&(lte IE 8)]>       <?php         function blarg(){           wp_enqueue_script('selectivizr', get_template_directory_uri() . 'assets/js/vendor/selectivizr.js');         }         add_action('wp_enqueue_scripts', 'blarg', 101);       ?>       <![endif]-->            <link rel="alternate" type="application/rss+xml" title="<?php echo get_bloginfo('name'); ?> Feed" href="<?php echo esc_url(get_feed_link()); ?>">     </head>      Nothing appears between the comments. I'm using the Roots theme. They have a scripts.php where other scripts are queued. If I put the `wp_enqueue_script()` in that file it works, but then I can't do the conditional comments. UPDATE: OK, the real challenge seems to be getting a script inside conditional comments (or any other particular HTML) will still using the queuing system. What is the best way to do that? Or is there a way?


title: Remove all RSS from wordpress site

text: I have a site with copyright content and do not want any RSS on it! I cannot have the content distributed legally. Specifially all categories have a default /feed that can be added to the end of the URL. I just found google was indexing this feed, but more importantly anyone who knows wordpress structures can figure it out anyway. Is there a way to remove RSS functionality across all categories (/feed)? I looked around the internet and there are older solutions for removing one category found here: http://wordpress.org/support/topic/remove-certain- categories-from-site-rss-feed A more indepth question is how to completely remove all RSS. This solution How to remove feeds from WordPress totally? is not very sound from a maintenance perspective as quoted "It's also super hackish and will probably break at some point in the future". Also I'm not sure how this would impact SEO to have an active link go to your homepage. I would prefer that the links not exist versus doing a 302. Is this possible? Is editing the .htaccess to redirect the best solution? This is what I had in mind but it seems messy.


title: WordPress plugin changelog RSS

text: Is there a way to access a WordPress plugin's changelog RSS feed?


title: Differnt page template for page 2 of blog feed

text: Is there a way I can use one page template (A custom page template for example) for the first page of my blog and then another template (Index.php for example) for page 2, 3, 4, etc.?


title: List users with the most posts in the last 30 days

text: I'm trying to create a MySQL query to display a descending list of users with the most number of posts over the last 30 days. This is not working with me:               $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";     $top_users = $wpdb->get_results("SELECT COUNT(ID) AS post_count, post_author, post_date, user_id FROM $wpdb->posts, $wpdb->usermeta WHERE $wpdb->posts.post_author = $wpdb->usermeta.user_id AND post_type = 'post' AND post_status = 'publish' $where");


title: Query for all themes?

text: I am running Wordpress 3.1.3 Multisite and would like to find out all of the currently-activated themes. I know there is a feature in the admin to see plugins per-blog, but I have not been able to see a similar feature for themes.


title: Add extra menu to theme

text: What's the best way to add an extra menu location to a theme that already has one? I want to add an extra menu in a child theme of a theme that currently has a single custom menu (what is the correct terminology here?!). Do I just use `register_nav_menu()` to create an additional menu?


title: Featured Image VS Post_thumbnail -- has_post_thumbnail lies?

text: OK, I got a custom post type with thumbnail enabled which adds the "featured images" panel to that post-type just fine, but in my template when I do               if ( has_post_thumbnail() ) {         the_post_thumbnail();     } else {         echo 'none';     }      it just shows 'none' on each one even though I have a featured image set... I have `add_theme_support('post-thumbnails',array('post','custom_post_type'));` so it's supported by the theme but `has_post_thumbnail` always returns false what's going on here??? My template is : archive-custom_post_type.php :               <?php     $loop = new WP_Query(array( 'post_type' => 'clients', 'posts_per_page' => -1 ));     if($loop){     ?>     <ul>     <?php     while ( $loop->have_posts() ) : $loop->the_post();     ?>             <li>                 <a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>" >                 <?php                      if ( has_post_thumbnail($post->ID) ) {                         the_post_thumbnail('thumbnail');                         echo get_post($post->ID)->post_excerpt;                     } else {                         echo 'broken ::' . $post->ID;                         echo get_post($post->ID)->post_excerpt;                     }                      ?>                 </a>             </li>     <?php      endwhile;     //wp_reset_postdata();     ?>     </ul>     <?php     }     ?>


title: problem with ajax and the path to the php page

text: i would like to call a php page from an Ajax method : the alert works fine, the code as well has been tested outside of wordpress, but here it seems that the php page is never called. I found some articles, among them : How to manage ajax calls and JSON in wordpress but i get more confused. Can you please tell me what should i do here? (with "diapo.php" it doesn't work, and like that neither) here is the call with jquery :                       $('.sous-cat').find('img').click(function(){                     var alt_p = $(this).attr('alt');                     //alert(alt_p);                          $.ajax({                         type: "POST",                         url: "<?php bloginfo( 'template_directory' ) ?>/diapo.php",                         data: {p:alt_p},                         success: function(data) {                             alert(data);                         }                     });                     return false;             });      and the php page for now :                       <?php             /*             $p = $_POST['p'];             query_posts( 'cat=3&p=$p' );             while (have_posts()) : the_post();                 $result = the_post_thumbnail('normal');             endwhile;             wp_reset_query();*/                  echo '$result';                  ?>      Thanks for your help


title: Theme Options page with tabs

text: I have a theme that I'm developing from an HTML template I have. I'm also designing an options page along with a plethora of plugins built-into the theme itself. I've chosen a tabbed interface and I'm trying to learn how to use WordPress' Settings API. I'm using a class structure for the theme's functions. The following is the declaration of registering settings and whatnot.               public function __admin_init()     {         register_setting( 'cncfps_twitter', 'cncfps_twitter_options', array( &$this, 'wp_cncfps_twitter' ) );         add_settings_section( 'cncfps_twitter', 'Twitter', array( &$this, 'wp_cncfps_twitter' ), 'cncfps' );         add_settings_field( 'cncfps_twitter_consumer_key', 'Consumer Key', array( &$this, 'twitter_consumer_key' ), 'cncfps', 'cncfps_twitter' );         add_settings_field( 'cncfps_twitter_consumer_secret', 'Consumer Secret', array( &$this, 'twitter_consumer_secret' ), 'cncfps', 'cncfps_twitter' );         add_settings_field( 'cncfps_twitter_apikey', 'API Key', array( &$this, 'twitter_apikey' ), 'cncfps', 'cncfps_twitter' );     }          public function wp_cncfps_twitter()     {         // TODO: wut. ?!?!         echo "what is this?";     }          public function twitter_consumer_key()     {         echo "Hello";     }          public function twitter_consumer_secret()     {         echo "World";     }      **When I want to display the fields as shownhere, I don't see a thing. The following is how I attempt to display them. I did follow a few tutorials but it's just not clicking in my brain for some reason.**               settings_fields('cncfps_twitter');     do_settings_sections('cncfps_twitter');      ![enter image description here](http://i.stack.imgur.com/2zZFW.png)


title: Custom post type archive 404's with paginate_links

text:
im using **paginate_links function** to create pagination on my custom post type archives, no matter what i do im hitting 404 errors when going to view page 2 (ie clicking to go on one page in the pagination trail). I've checked and researched and dont seem to be getting anywhere with it all. heres my before the loop query inside archive-MY_CUSTOM_POST_TYPE.php:               <?php          global $wp_query;          $args = array_merge( $wp_query->query, array( 'post_type' => 'sales', 'posts_per_page'  => 1, ) );          query_posts( $args );               if (have_posts()) :     while (have_posts()) : the_post();        and lower down after the loops endif and above wp_reset_query i have               <?php endif; ?>

          <?php      global $wp_query, $wp_rewrite;     $wp_query->query_vars['paged'] > 1 ? $current = $wp_query->query_vars['paged'] :    $current = 1;          $pagination = array(     'base' => @add_query_arg('page','%#%'),     'format' => '',     'total' => $wp_query->max_num_pages,     'current' => $current,     'show_all' => true,     'type' => 'plain'     );          if( $wp_rewrite->using_permalinks() )     $pagination['base'] = user_trailingslashit( trailingslashit( remove_query_arg( 's', get_pagenum_link( 1 ) ) ) . 'page/%#%/', 'paged' );          if( !empty($wp_query->query_vars['s']) )     $pagination['add_args'] = array( 's' => get_query_var( 's' ) );          echo paginate_links( $pagination );     ?>
        On my loop-index.php this works with no problem, but on a loop inside Custom Post Type its a no go, i have no clashes with duplicated slugs as i have read that this can be an issue, so im taking it that it is something to do with how im querying the posts before the loop, any pointers? regards   Martin


how to add multiple menu in custom menu widget? i am using this theme. I am new to wordpress and i am unable to sort it out.


title: Woocommerce get cart total price in a number format

text: Is it possible to get the cart total price without any markup. So without the € symbol? Right now I'm getting the amount with:               $totalamount = $woocommerce->cart->get_cart_total();        this will give €16.50 I tried this also:               $totalamount = number_format($woocommerce->cart->get_cart_total(), 2, '.', '');      But this always gives 0.00 Is there a woocommerce get function that will give a number format of the total cart price? Thanks!


title: TwentyTwelve child theme style.css?ver=3.8.1

text: I've created a child theme of TwentyTwelve. On the front end, the `<head>` section contains the line: > http://example.com/wp-content/themes/childtheme/style.css **?ver=3.8.1** Any changes I make to `childtheme/style.css` are not reflected in http://example.com/wp-content/themes/childtheme/style.css?ver=3.8.1 I've performed a search in TwentyTwelve and childtheme, and can't find any instance of enqueue_style which contains a version of 3.8.1, or any hard coding of style.css?ver=3.8.1 How do I either:   * Update style.css?ver=3.8.1   * or force the site to use http://example.com/wp-content/themes/childtheme/style.css instead of .../style.css?ver=3.8.1 Thanks **Update** : I added the following to .../childtheme/functions.php               function add_require_scripts_files() {      wp_enqueue_style('layout', get_stylesheet_directory_uri().'/style.css', array(), '1.0.0', "all");             }          add_action( 'wp_enqueue_scripts', 'add_require_scripts_files' );      But the front end contains code:               <link rel='stylesheet' id='layout-css'  href='http://example.com/wp-content/themes/childtheme/style.css?ver=1.0.0' type='text/css' media='all' />     <link rel='stylesheet' id='twentytwelve-style-css'  href='http://example.com/wp-content/themes/childtheme/style.css?ver=3.8.1' type='text/css' media='all' />      style.css?ver=3.8.1 is overriding style.css?ver=1.0.0 **Update 2:** In /childtheme/functions.php, I replaced               function add_require_scripts_files() {      wp_enqueue_style('layout', get_stylesheet_directory_uri().'/style.css', array(), '1.0.0', "all");             }      with               function add_require_scripts_files() {      wp_enqueue_style('twentytwelve-style', get_stylesheet_directory_uri().'/style.css', array(), '1.0.0', "all");             }      which meant the style.css?ver=3.8.1 was not loaded.


title: using hyperlink in wordpress plugin

text: Im developing wordpress plugin . I added a plugin to the admin menu . After clicking on the plugin is displayed user login. (I used parameter-magic func from the wrapper function `add_management_page()` to loading page- where is located user login). I dont know if its good solution but this isnt my problem . Under user login I have hyperlink- **_register new account_**. After clicking on this hyperlink I want to see only registration form in main window. I wrote my problem on stackoverflow http://stackoverflow.com/questions/22416804/redirect-to-wp-admin-after-using- hyperlinks-in-wordpress/22418377?noredirect=1#22418377. but this solution didnt help me . Im still redirect to wp-admin `php_project/wp- admin/tools.php?page=my_submenu_handle` Thanks for answer its for me very important. * ** _EDIT:_** *Im using this code. but this code wrong. I need only load page(content of file.php) into same page after clicking on this link. This code change url to plugin url .                <a class="hyper" href="<?php plugins_url('my_plugin/file.php') ?>">Register new account      RE:EDIT I use this code `<a class="hyper" href="<?php bloginfo('url') ?>/wp- content/plugins/nameplugin/file.php" target="_self">new register account </a>` but how can i open this file.php in wordpress because its opened in new window


title: add javascript files only when plugin is called?

text: I'm writing a WP plugin that might be called on any page using a simple function call:`getDeck(Deck_id)` - and i'd like to add my javascript files on pages where this function is called ONLY, as opposed to having it on every page... What do I do?


title: Non-threaded comment replies with link to original comment

text: I'll explain what I am trying to accomplish. I would like to have regular non-threaded (flat/classic) comments with a reply link to each comment. When someone replies to a comment the reply comment will end up at the top (or bottom) as the latest comment just as it would in the default non-threaded comments, but unlike the default non-threaded comment the reply should display a link to the original comment/author. There is a proposed solution over at the wordpress forum: http://wordpress.org/support/topic/reply-to-link-for-chronological-non- threaded-comments I just don't get it to work. I am not sure in what files the poster is placing the different pieces of code. I tried to use the code and hook a function to comment_post:               add_action('comment_post', 'print_reply_link', 10, 2);          function print_reply_link( $comment_id, $approved ){       if( $approved ){         $comment = get_comment( $comment_id );         if ( $comment->comment_parent ) {         $parent = get_comment( $comment->comment_parent );         $parent_link = esc_url( get_comment_link( $comment->comment_parent ) );         printf( ' in reply to %2$s', $parent_link, $parent->comment_author );         }        }     }      This returned a blank page with "in reply to authorname". After reloading the post a reply comment shows up correctly but without any link to the original comment My coding skills are really very basic so I have no good idea how I should proceed. Would be very grateful for any help.


title: Max length of meta_value

text: I was wondering if anyone could tell me the max length of the meta_value field for posts and user meta. Thanks!


title: Would there be anything stopping me from removing both wp_head and wp_footer?

text: Some plugins rely on either wp_head or wp_footer or both to introduce their own stylesheets and JavaScript. Those scripts take time to load and slow down my website. Therefore, I would like manually control all the scripts on my site. I'm thinking of removing wp_head() and wp_footer() entirely. Would the sky falls down if I do so? I've read this.


title: menu hierarchy not working

text: I have created a theme from scratch and was using a custom menu with no problem. Somehow, I lost the ability to create a hierarchy in the menu -- all menu items show up at the same level. I have tried editing the order on the pages menu and I also have the correct Parent there. When I try to manipulate the order in the Appearance Menus page, I move the item to the second level. It looks fine but once I save it, the item goes back to the top level. Do you have any idea what is causing it? The other thing is that I have been using this code on several sites with no problem. It is only one implementation that is tripping me up. The code I use to call the menu is the following:               <ul> <?php wp_nav_menu( array( 'menu' => 'Main Nav') ); ?> </ul>


title: Trying to WP_Query a category

text:
I am trying to output all the posts of a certain category but all that is happening is The page content is being outputted no posts? template page               <?php     /*     Template Name: Blog     */     ?>          <?php get_header(); ?>

                                       <?php $query = new WP_Query( 'category_name=blog' ); ?>                                        <?php if (have_posts()) : while (have_posts()) : the_post(); ?>                                  <article id="post-<?php the_ID(); ?>" <?php post_class('clearfix'); ?> role="article">
<?php the_title(); ?>

<?php                         printf(__('Posted <time class="updated" datetime="%1$s" pubdate>%2$s</time> by %3$s.', 'bonestheme'), get_the_time('Y-m-j'), get_the_time(__('F jS, Y', 'bonestheme')), bones_get_the_author_posts_link());                       ?>

                                     <?php the_content(); ?>

<?php the_tags('' . __('Tags:', 'bonestheme') . ' ', ', ', ''); ?>
                                                                             <?php comments_template(); ?>
                                   <?php endwhile; ?>                                    <?php else : ?>

<?php _e("Oops, Post Not Found!", "bonestheme"); ?>

<?php _e("Uh Oh. Something is missing. Try double checking things.", "bonestheme"); ?>

<?php _e("This is the error message in the page-custom.php template.", "bonestheme"); ?>

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

           <?php get_footer(); ?>