Display Custom Posts

I have created custom posts with the name "review". From WP admin i can create these custom posts. But to display them at user side i am facing a problem. As i am developing plugin i don't want create a template in theme. This is code i used to display the custom posts. But it is showing 404 template.               function review_template_function($template_path){     global $post;     if(get_query_var('post_type') == 'review'){         if(is_single()){             if(file_exists(plugin_dir_path(__FILE__).'review-preview.php')){                 $template_path = plugin_dir_path(__FILE__).'review-preview.php';             }else{                 $template_path = plugin_dir_path(__FILE__).'review-preview.php';             }         }     }     return $template_path;     }       add_filter('template_include','review_template_function');


Recent Posts Listed by Author, Can I exclude authors?

I'm working on a multi-author blog, and I'm trying to produce an authors list with recent posts like this page (site is drupal): http://www.internationalrivers.org/blogs I'm working on a draft here: http://nape.kevinmgibbons.com/authors I want to exclude admin, ira, and ivan (users 1,3,4). Here is the code I've pieced together:                   <?php         $authors = $wpdb->get_results('SELECT DISTINCT post_author FROM '.$wpdb->posts);         if($authors):         foreach($authors as $author):        ?>

         <?php if(get_the_author_meta('description', $author->post_author)): ?>
                 <?php echo get_avatar(get_the_author_meta('user_email', $author->post_author), 80); ?>
         <?php endif; ?>

         <div class='author' id='author-<?php the_author_meta('user_login', $author->post_author); ?>'>
<?php the_author_meta('display_name', $author->post_author); ?>
                   <?php if(get_the_author_meta('description', $author->post_author)): ?>

<?php the_author_meta('description', $author->post_author); ?>

          <?php endif; ?>          <?php         $recentPost = new WP_Query('author='.$author->post_author.'&showposts=4');         while($recentPost->have_posts()): $recentPost->the_post();     ?>

         <li class="blogbyauthor" id="post-<?php the_ID(); ?>">             <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?>
              <?php the_time('F jS, Y') ?>

          <?php endwhile; ?>          <?php if(get_the_author_meta('twitter', $author->post_author) || get_the_author_meta('facebook', $author->post_author) || get_the_author_meta('linkedin', $author->post_author) || get_the_author_meta('digg', $author->post_author) || get_the_author_meta('flickr', $author->post_author)): ?>     <?php endif; ?>

          <?php endforeach; endif; ?>      Two questions:   1. How can I exclude users 1,3,4? I've tried a lot of methods from other posts.   2. Is there a better/cleaner way to do what I'm trying to do? I'm a bit of a newb when it comes to Wordpress PHP, so I appreciate any help you can give.


I'm getting this error in a log file created by WooCommerce "The SSL certificate for the host could not be verified." The error is being generated by WordPress' file `/wp-includes/class-http.php` http://hookr.io/3.8.2/classes/wp_http_streams/ I've tried setting the below in my functions file to disable SSL verification, but i'm still getting the error               add_filter( 'https_ssl_verify', '__return_false' );     add_filter( 'https_local_ssl_verify', '__return_false' );      On line 834 of `class-http.php` I tested changing this line `$connect_host = $secure_transport ? 'ssl://' . $connect_host : 'tcp://' . $connect_host;` To `$connect_host = $secure_transport ? 'sslv3://' . $connect_host : 'tcp://' . $connect_host;` The change is **sslv3** I need this for connecting to authorize.net. Is there a filter I can use, to override the method in the class, if so which? I know enough to not modify core code, this was only for testing. Thanks


Custom post type navigation on static page

I'm using the following code on a WP3.9 site to show a bunch of custom post types with pagination on a static page set as the frontpage:               $args = array(         'post_type' => 'movie'     );     $paged = (get_query_var('page')) ? get_query_var('page') : 1;     $wp_query = new WP_Query( array_merge( $args, array('paged' => $paged) ) );      The first page is showing the correct info, but when I go to **domain.com/page/n/** I get redirected to **domain.com**. If I add the following code to the functions.php file:               function disable_redirect_canonical( $redirect_url ) {         $redirect_url = false;         return $redirect_url;     }     add_filter('redirect_canonical','disable_redirect_canonical');      Then I can go to **/page/3/ and greater** , but **/page/2/** still redirects to the main page. I'm really lost about this and I'm not really sure where to look to fix this problem. Any help would be appreciated


How do I build a settings panel under the plugin

I'm trying to build a settings panel for my plugin that is located under the plugin on the plugin page and slides down when the user clicks the settings link like other plugins (WP Maintenance Mode) do. They look like this: ![Screen top](http://i.stack.imgur.com/U0Zsg.png) ![Screen bot](http://i.stack.imgur.com/bSl8s.png)   I tried to read the plugin code but didn't really understand it because its a bit to complex for me as a beginner. Is this a normal wordpress function or is it extra implemented?


Inserting current user ID into Post for Author

I am trying to insert the `user id` of the current user when creating a `custom post type`. This is my code:               $my_post = array(                 'post_title' => $orderRequestCode.' - ' . $customerName,                 'post_content' => $orderContent,                 'post_status' => 'draft',                 'post_author' => $user_ID,                 'post_type' => 'orders'             );          wp_insert_post( $my_post);      I get a reference to the user as well: `$user_ID = $user->ID;` However, it is not inserting anything into the Author field when I Check on the `back-end`. Does anyone know where I am going wrong?


Allow only new sub-pages to be created

Here is an amazing solution to restrict the creation of new parent pages, and I would want to use it, but the newly created sub-pages are saved only as drafts and this was not solved (see last comments at mentioned link). The problem is that this code always saves the page as `Draft` and I have no idea how to solve this:               add_action( 'admin_head-post-new.php', 'wpse_59770_publish_admin_hook' );     add_action( 'admin_head-post.php', 'wpse_59770_publish_admin_hook' );     add_action( 'wp_ajax_wpse_59770_pre_submit_validation', 'wpse_59770_ajax_pre_submit_validation' );          function wpse_59770_publish_admin_hook()     {         global $current_screen;         if( 'page' != $current_screen->post_type )             return;              ?>         <script language="javascript" type="text/javascript">             jQuery(document).ready(function() {                 jQuery('#publish').click(function()                  {                     var form_data = jQuery('#parent_id').val();                     form_data = ( '' != form_data ) ? '1' : '0';                     var data = {                         action: 'wpse_59770_pre_submit_validation',                         security: '<?php echo wp_create_nonce( 'pre_publish_validation' ); ?>',                         form_data: form_data                     };                     jQuery.post(ajaxurl, data, function(response)                      {                         // OK, save page                         if (response=='true') {                             jQuery('#ajax-loading').hide();                             jQuery('#publish').removeClass('button-primary-disabled');                             jQuery('#post').submit();                         }                         // Not OK, display alert message                         else                         {                             alert(response);                             jQuery('#ajax-loading').hide();                             jQuery('#publish').removeClass('button-primary-disabled');                             return false;                         }                     });                     return false;                 });             });         </script>         <?php     }               function wpse_59770_ajax_pre_submit_validation()     {         //simple Security check         check_ajax_referer( 'pre_publish_validation', 'security' );              // Parent is set, no further action         if( '1' == $_POST['form_data'] )         {             echo 'true';              die();         }              $args = array( 'post_type' => 'page', 'post_parent'=> 0, 'numberposts' => -1 );         $parents_total = get_posts( $args );              // Total parents is less than 9, no further action         if( count($parents_total) < 9 )         {             echo 'true';              die();         }         // No more parents allowed         else         {             $error = "No more Parent Pages allowed";                echo $error;              die();         }     }


wp_insert_post() inside save_post(): force WP to not update global post object?

I wrote a custom plugin which inserts another metabox on the edit post screens. Once the user saves or publishes an article, I want to create another post with a custom post_type, which works great. However, data from other metaboxes are saved with the post_id of my newly created custom-typed-post instead of the original post. I suspect this is due to wp_insert_post() updating the global $post object with the post_id the function just generated. But how can I make sure this does not happen? How to make sure, e.g. all other plugins also using the save_post hook save their data correctly to the right post instead of my custom-type-post created by wp_insert_post()?               add_action('save_post', array(&$this, 'save_post'), 1, 1);          public function save_post($post_id) {                      // verify if this is an auto save routine.                  // If it is our form has not been submitted, so we dont want to do anything                 if(defined('DOING_AUTOSAVE') && DOING_AUTOSAVE){                     return;                 }                           if($_POST['post_type'] == self::POST_TYPE && current_user_can('edit_post', $post_id))                 {                          $newContestAdded = false;                          $_STBKT_assignedContestHopper = get_post_meta($post_id, '_STBKT_assignedContestHopper', true);                     if (($_STBKT_assignedContestHopper=='' || $_POST['STBKT_quickcontest_contestID']=='')                              && get_post_type($post_id) == 'post') {                          // Create contesthopper post object                         $CH_post = array(                           'post_title'    => '',                           'post_content'  => '',                           'post_status'   => 'publish',                           'post_author'   => 1,                           'post_type'     => 'contesthopper'                         );                              $_STBKT_assignedContestHopper = wp_insert_post( $CH_post, $wp_error );                     }                 }     }


How to insert multiple postmeta values with one query?

I have a custom script/plugin I am using for myself that creates a post along with some postmeta information. Right now, I have multiple `$wpdb->insert`, but I would like to condense this down into one query. How would I do this? Here is my current code:               $meta_table = $wpdb->prefix . 'postmeta';              $wpdb->insert(          $meta_table,          array(              'post_id' => $post_id, // Already defined             'meta_key' => 'client-pwd',             'meta_value' => $post_pwd // Already defined             )             );            $wpdb->insert(          $meta_table,          array(              'post_id' => $post_id,              'meta_key' => 'gallery-status',             'meta_value' => 'private'             )             );            $wpdb->insert(          $meta_table,          array(              'post_id' => $post_id,              'meta_key' => 'meta-description',             'meta_value' => 'Description...'             )             );            $wpdb->insert(          $meta_table,          array(              'post_id' => $post_id,              'meta_key' => 'can-purchase',             'meta_value' => 'yes'             )             );            $wpdb->insert(          $meta_table,          array(              'post_id' => $post_id,              'meta_key' => 'can-email',             'meta_value' => 'yes'             )             );            $wpdb->insert(          $meta_table,          array(              'post_id' => $post_id,              'meta_key' => 'can-download',             'meta_value' => 'yes'             )             );


Checking if an attribute exists in a shortcode

I've written a small plugin that spits out html for a button. It works great, except for one thing: If the user doesn't specify an image, the image appears broken. Is there a way for me to check and see if the user has specified an image, and only print the image code if that's the case? Here's my plugin code:               function button_shortcode($args) {         return "" . $args["smalltext"] . "" . $args["bigtext"] . "";     }     add_shortcode("button", "button_shortcode");      Here's the shortcode: `[button url="http://www.example.com/" img="/path/to/image.png" smalltext="Smaller Text" bigtext="Bigger Text"]`


Use WordPress' URL rewrite engine

I'm developing a web application with user submissions, i'm not too hot on mod-rewrite and was hoping there is a way to utilise WordPress' amazing rewrite engine and incorporate this somehow into my PHP/AJAX web application?


Search Using Post ID

I'd like to be able to enter a post ID into the search box in order for the exact post to be returned in the search results. I'd also like to retain the ability to search the posts/page titles and content. eg, user enters '#123' in the search box, and the search results return just post 123. However, if I were to enter '123' into the search box, it would return any post/page that contains '123' in the content or title. This article explains how to achieve what i'm after within the Admin - I just need the equivalent for the front-end! Any help is greatly appreciated, thank you.


query custom post type and order by most comments within one week

Hi I'm having a lot of trouble with my custom query... I had it working just fine, displaying all posts of a custom post type and ordering them by most comments within a single week. But since I installed the plugin "Newsletter", it is no longer working, it doesn't display ANY posts... Here is the code that was working before:               /* QUERY */              $week = date('W');         $year = date('Y');              query_posts('post_type=articles&posts_per_page=$number_posts&orderby=comment_count&ignore_sticky_posts=1&meta_key=_thumbnail_id&order=DESC&year=' . $year . '&w=' . $week);          /* LOOP */ ...      I think one of the variables may be interfering with the Newsletter plugin somehow, because when I change the query back to this it works just fine (though only shows the most commented posts of all time):               /* QUERY */              query_posts(array('post_type' => 'articles', 'posts_per_page' => $number_posts, 'orderby' => 'comment_count', 'ignore_sticky_posts'=>1, 'meta_key'=>'_thumbnail_id'));          /* LOOP */ ...      What should I try next? Is there a better way to do this, a way that won't conflict with anything else? I have seen a few other methods for displaying posts by most comments within a single week, but I don't understand how to implement them. Please help! This is the last thing I need to finish and then I'm done with my site. Thanks in advance...


Localize tinymce in WordPress 3.9?

Still stucked with this localization of tinymce. Find this resource here : codex. Does not seem to work anymore. How do you do this? Any help would be much appreciated.


not empty categories don't show in menu

I'm trying to resolve a problem i have showing category posts. I have added a category to my main menu, eventhough it has posts - in the basic theme it doesn't show, in my theme - it shows as a link but when i click on it, shows just a blank page. I tried resetting the permalinks, clearing the cache... nothing. Does anyone have an idea what the problem might be. I'm getting a bit desperate. Any help will be greatly appreciated. Thanks a lot in advance


Remove category from query (show all posts in archive.php) pre_get_posts()

I am using `pre_get_posts()` to allow all posts to be displayed on any category archive. This is because I will provide a javascript sorting and filtering method using isotope.js. Any category page will output all posts, but any that aren't a part of that category will initially be hidden.               function show_all_cats( $query ) {         if ( !$query->is_main_query() ){             return;         }         if ( is_admin() ){             return;         }         if ( $query->is_archive ) {             $query->set('cat', ''); //here is the problem             var_dump($query);             return;         }         return;     }     add_action( 'pre_get_posts', 'show_all_cats' );      I have tried setting `'cat'` to `0`, `null`, `''` and `'-' . $currentcategoryid`. They all either display only posts that would be displayed otherwise (all in category) or none. I tried using `query_posts()` which also didn't work. I was also told: > manipulating taxonomies might require re-running meta queries processing.


Query Posts oder by Date

my query does not work as it should. This is my Code:               wp_reset_query();     $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;     $args  = array(                     'post_type'     => 'post',                     'paged'         => $paged,                     'orderby'       => 'date',                     'order'         => 'ASC',                     'posts_per_page'    => 5                     );     $the_query = new WP_Query( $args );     if ( $the_query -> have_posts() ):         while ( $the_query -> have_posts()) :              $the_query-> the_post();             the_title();         endwhile;     endif;      The posts are not ordered by date. What could be the issue?


Translate wordpress plugin

Below is a small tutorial of translation from English To German. (You can change the it as your needs). in any plugin file, it has unique name in its header.               /*     Plugin Name: SampleTut     .......     */      in that plugin folder, make a folder (named "languages"); into your plugin .php file (somewhere in top), insert this initialisation code:               class load_my_language      {         public function __construct()         {         add_action('init', array($this, 'load_translat'));         }               public function load_translal()         {             load_plugin_textdomain('SampleTut', FALSE, dirname(plugin_basename(__FILE__)).'/languages/');         }     }          $ggg = new load_my_language ;      then open new text file and insert this code: (Now, we only make two messages, "helo" and "bye". You can insert as much as you need).               # English translations for PACKAGE package.     # Copyright (C) 2012 THE PACKAGE'S COPYRIGHT HOLDER     # This file is distributed under the same license as the PACKAGE package.     # Automatically generated, 2012.     #     msgid ""     msgstr ""     "Project-Id-Version: SampleTut 1.1\n"     "Report-Msgid-Bugs-To: \n"     "POT-Creation-Date: 2012-11-11 21:33-0400\n"     "PO-Revision-Date: 2013-11-21 12:33+0400\n"     "Last-Translator: Automatically generated\n"     "Language-Team: none\n"     "MIME-Version: 1.0\n"     "Content-Type: text/plain; charset=utf-8\n"     "X-Poedit-SourceCharset: iso-8859-1\n"     "Content-Transfer-Encoding: 8bit\n"     "Plural-Forms: nplurals=2; plural=(n != 1);\n"     "X-Generator: Poedit 1.5.4\n"               #: myplugininfile.php:47 (this is a note line)     msgid "mymessage1"     msgstr "Hello"          #: myplugininfile.php:48     msgid "mymessage2"     msgstr "Bye"      save this file and name it "SampleTut-en_US.po" (note, that .po should be an extension of the file, and not .po.txt) download the software: POEDIT, and open that file and Press CTRL+S and thus, the program automatically generates the second functional .mo file ( If it doesnt generate the .mo file automatically, then edit preferences.); Then shutdown the program, and reopen the file again. Make your translations in "translation" fields, and after you finish, click SAVE AS and save the file as "SampleTut-de_DE" Now, the two German files will be generated. then put those two English and two German files into "languages" folder. Then, open wp-config.php and from default(English):               define ('WPLANG, '');      change to               define ('WPLANG, 'de_DE');      (This means, that we changed our wordpress main language. then worpdress will read our language file, with prefix -de_DE) so, now open your plugin's .php file, and where you have any echo-ed word:               echo "Something";      change to :               echo __("mymessage1", 'SampleTut');      or the same as echo:               __e("mymessage1", 'SampleTut');      And thus, the wordpress shows you the appropriate translation for that id (mymessage1). references:   codex.wordpress.org/I18n_for_WordPress_Developers   codex.wordpress.org/Translating_WordPress   codex.wordpress.org/Writing_a_Plugin   codex.wordpress.org/Installing_WordPress_in_Your_Language


Why 'Authorization Required' is coming on wordpress login

When i try to login to my WordPress blog admin why this pop up error come ..               "Authorization Required"      http://stpatrickscollege.edu.pk/wp-login.php


How do you modify Page Template?

Do I just go to Appearance->Editor and then pick the template and modify the PHP code directly, or is there a more "non-coding" way of doing it? I'm using a theme with a contact form, and the whole contact form code is in the template, and the edit page window just shows up blank. All the code is in the template.


Invalid argument supplied in register_taxonomy $args->taxonomies

I have capabilities assigned in my `register_post_type()`. Then, I implemented taxonomies on my plugin. Where the $args in taxonomy are as follows:               $args = array(       'label'=>'Partner Type',       'labels' => array(         'name' => __('Partners'),         'singular_name' => __('Partner Type'),         'menu_name' => __('Partner Types'),         'all_items' => __('All Partner Types'),         'edit_item' => __('Edit Partner Type'),         'view_item' => __('View Partner Type'),         'update_item' => __('Update Partner Type'),         'add_new_item' => __('Add New Partner Type'),         'new_item_name' => __('NEw Item Type'),         'parent_item' => __('Parent Type'),         'parent_item_colon' => __('Parent Partner Colon'),         'search_items' => __('Search Partner'),         'popular_items' => __('Popular Partner Type'),         'separate_items_with_commas' => __('Separate partner types with commas'),         'add_or_remove_items' => __('Add or Remove Partner Types'),         'choose_from_most_used' => __('Choose from Most Used Partner Type'),         'not_found' => __('Partner Type Not Found'),       ),       'hierarchical' => true,     );      register_taxonomy('partner_taxonomies', 'partners',$args); $args in `post_type` contains:               'taxonomies' => 'partner_taxonomies',      Then, I get the error > Invalid argument supplied for foreach() in /var/www/html/stecLive/wp- > includes/post.php on line 1346 Where the code says:               foreach ( $args->taxonomies as $taxonomy ) {       register_taxonomy_for_object_type( $taxonomy, $post_type );     }      I don't see 'taxonomies' as one of the arguments in `register_taxonomy()`. How would you use or supply an array for 'taxonomies'? Or in other words, what am I doing wrong?


Show all terms in a custom taxonomy with all child terms wrapped in a ul

Is there a way that I can list all the terms within a custom taxonomy in an unordered list and wrap all child terms in another unordered list? For example;

Parent 1

             Parent 2

Child of Parent 2

Child of Parent 2

Child of Parent 2

Parent 3


3.5.x Theme Customize: Handling Custom Control Requests

I am extending the WP_Customize_Image_Control as a means to include an upload- able word mark for a site. The control works just fine, but I need to do some post process handling on the image (i.e. check image dimensions, file type, etc...). In other words I need to validate the upload. Is there an event listener in the javascript of the API, that I can override, in order to do this?


How to add 'Insert HTML Table' button to TinyMCE in admin?

I am trying to figure out how to change the default buttons on the TinyMCE editor in the Wordpress admin. Specifically, I would like to provide an 'insert table' button. How do I do that?


Is there a way of storing posts and pages under the same hierarchy?

I'm working on a site which needs to have pages and posts sorted into the same categories. The pages have their own individual hierarchy structure. Is there a way to do this using a custom taxonomy?


Logout redirects to /forums/

A while back I installed a plugin which, upon logout, re-directed users to `/forums/`. Unfortunately, I have no idea which plugin that was and whether or not it's still active/installed. What code/db settings can I look for to remove the offending code? Thanks in advance,


Saving multiple fields as array

I'm adding a settings section to a theme that will allow the user to enter testimonials which will be randomly displayed on the site. Each testimonial has 2 fields, `author` and `testimonial`, I've registered my settings as below:               register_setting( 'settings-website', 'option_testimonials', 'save_testimonials' );      And I want to store an array within that option like this:               array(3) {       [0]=>       array(2) {         ["author"]=>         string(8) "Person A"         ["testimonial"]=>         string(14) "Great website!"       }       [1]=>       array(2) {         ["author"]=>         string(8) "Person B"         ["testimonial"]=>         string(15) "Excellent work!"       }       [2]=>       array(2) {         ["author"]=>         string(8) "Person C"         ["testimonial"]=>         string(10) "Brilliant!"       }     }      My options form looks like this:               <?php     $testimonials = get_option('option_testimonials');     if( !is_array($testimonials) )         $testimonials = array();     ?>

Testimonials
     <form method="post" action="options.php">         <?php settings_fields( 'ddtheme-settings-testimonials' ); ?>
             <?php foreach( $testimonials as $testimonial ) { ?>
             Testimonial
             <?php } ?>
             New testimonial	                              Author:
                 <input type="text" name="author" style="width: 400px;" />
                 Testimonial:
                 <textarea name="testimonial" style="width: 400px;"></textarea>

         <input type="submit" class="button-primary" value="<?php _e('Save Changes') ?>" />
     </form>
      So I thought I could grab the input from the `author` and `testimonial` fields inside `save_testimonials`, combine them into an array and append that to the existing array and save but the `$_POST` and `$_REQUEST` are both empty inside that callback. How can I do this?


Getting 404 on taxonomy page

i've created a custom taxonomy template for my taxonomy and custom post type, custom post type name is "ecommerce" custom taxonomy is "ecommerce_categories", the problem is with the pagination it shows correctly that there are 2 pages with posts inside it but when i click on page 2 i get 404 page, this happens only when i'm on the taxonomy page, i've also created a custom page template that does the same as the taxonomy file and the pagination works here (on the custom page template) the problem is only when i'm on the taxonomy category page. This is the code of the file taxonomy- ecommerce_categories.php               <?php              $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;             $term = $wp_query->queried_object;                  $shop_loop = new WP_Query( array( 'post_type' => 'ecommerce', 'ecommerce_categories' => $term->name, 'posts_per_page' => 2, 'orderby' => 'menu_order', 'paged'=>$paged ) ); ?>                  <?php while ( $shop_loop->have_posts()  ) : $shop_loop->the_post(); ?>                          // here is my loop code with divs links etc.. etc...                  <?php endwhile;?>

             <?php if(function_exists('wp_pagenavi')) { wp_pagenavi( array( 'query' => $shop_loop ) ); } ?>      I see the pagination but when i click on page 2 or page 3 i get 404 error page this happen with any permalink setting and also if i change the pagination from the wp pagenavi plugin to the wordpress default one using this code               <?php wp_link_pages(); ?> or previous_post_link and next_post_link       i can't see it nothing is displayed below posts. How can i fix this ? what i'm doing wrong ?


Custom menu styling

I'm trying to style a custom menu here so that I can let other people manage this site alongside myself. What I'm trying to do is remove the text for the top level links while leaving the `a` as a block so the links are clickable, however when I try and remove the text using `text-indent: -999em;` (which I know isn't the neatest way of doing it) it recurses down the menu and hides all the the other links. Can anyone suggest any neat ways of hiding the text?


Bar separated navigation by extending Walker_Nav_Menu

I have the following menu in my header:               <?php     $args = array(         'menu'            => 'Main Menu',         'container'       => false,         'depth'           => 1,         'items_wrap'      => '%3$s',         'walker'          => new Bar_List_Walker_Nav_Menu     );     wp_nav_menu($args);     ?>      and I want to make the output look like this:               link1 | link2 | link3 | link4 | link5      So I set out to make a walker function here is where I got to:               class Bar_List_Walker_Nav_Menu extends Walker_Nav_Menu {         public $count;         function start_lvl(&$output, $depth) {}         function end_lvl(&$output, $depth) {}         function start_el(&$output, $item, $depth, $args) {             $attributes = ! empty( $item->target )     ? ' target="' . esc_attr( $item->target     ) .'"' : '';             $attributes .= ! empty( $item->url )        ? ' href="'   . esc_attr( $item->url        ) .'"' : '';                  $item_output .= '<a'. $attributes .'>';             $item_output .= apply_filters( 'the_title', $item->title, $item->ID );             $item_output .= '</a>';                  $output .= apply_filters( 'walker_nav_menu_start_el', $item_output, $item, $depth, $args );         }         function end_el(&$output, $item, $depth) {             static $count;             $count++;             if(!$this->count >= $count) {                 $output .= " | ";             }         }         function walk( $elements, $max_depth ) {             $this->count = count($elements);             parent::walk( $elements, $max_depth );         }     }      This outputs the following error:               Warning: Missing argument 4 for Bar_List_Walker_Nav_Menu::start_el() in C:\xampp\DEV\Stace\trunk\wp-content\themes\philosophy\functions.php on line 100      If I remove the function `walk()` from my walker class it works fine except the count is no longer grabbed and as a result one `|` too many is added to the end of my navigation. Can anyone work the code to get to my desired output?


Hide active themes on multisite subdomains

Is it possible to hide the active themes in a network so that the subdomain users won't see them as being available? The problem is that i have 10 themes installed on the network and the subdomain users see the ones not assigned to them under Appearance -> Themes, and activate other themes. I am trying to remove this capability for the subdomain administrators. Thanks.


Need Category RSS Feed that shows all posts

How do I go about making this? I've been trying to get add_feed and such but have had no luck.


Advanced Custom Fields WYSIWYG More tag

Before describing the problem, let me first tell that I have already searched on google, also read the ACF documentation, support, even asked on their support forum but it's hard to get any kind of answer there. So the thing is I have this wysiwyg on a custom post type I made where I have an item description, I really don't want to use the wp default editor because I designed a structure on the post to be more user friendly. The problem comes when I add the tag to the field, it will not work as the_content('Read More') for example, I have tried to find out but failed. I'm using the               <?php     global $more      $more = 0;     ?>      but then if I want to use like for example:               <?php the_field('the_field_name','Read More')?>      it will not show the More tag. What can I do to display it?


Lessphp auto-compiling issue in WordPress

I'm using Lessphp to auto compile my style. After reading the document ( http://leafo.net/lessphp/docs/#compiling_automatically ) and some research, I got this code:               function autoCompileLess() {          // include lessc.inc     require_once( get_template_directory().'/library/lessc.inc.php' );          // input and output location     $inputFile = get_template_directory().'/library/less/style.less';     $outputFile = get_template_directory().'/library/css/style.css';          // load the cache     $cacheFile = $inputFile.".cache";          if (file_exists($cacheFile)) {         $cache = unserialize(file_get_contents($cacheFile));     } else {         $cache = $inputFile;     }          $less = new lessc;     // create a new cache object, and compile     $newCache = $less->cachedCompile($cache);          // output a LESS file, and cache file only if it has been modified since last compile     if (!is_array($cache) || $newCache["updated"] > $cache["updated"]) {         file_put_contents($cacheFile, serialize($newCache));         file_put_contents($outputFile, $newCache['compiled']);       }     }          if(is_admin()) {         add_action('init', 'autoCompileLess');     }      It works at the beginning. But the next day, when I open my website. the style was gone. The output file(CSS) was empty and the cache file has only one character inside(N;). It seems like even if there is nothing change in the LESS file (input file), the program still saves the cache which is empty and compiles it to CSS. I tried to re-compile the LESS file to CSS, and it worked. But when I re-open my website, this happens again. How can I fix it?


Best practice to include custom user styles in widgets

What's the best way to include custom user styles in widgets? For example adjust colors for buttons, borders etc. without having the user to develop a complete new stylesheet.


Function to list all post slugs for every post in my WP database?

Function to list all post slugs for every post in wp_posts table? I assume there's an official function to generate a post slug, but maybe someone here already has the answer.


Hook to See if Comment got a Reply?

Okay I know the title is pretty vague but I didn't know how to articulate it. Basically, I want a plugin that sends email notifications to users who opted- in **only if** they specifically got replied to. WordPress has its built-in functionality for comment threading/replying, so instead of bombarding the user with emails each time a new comment is posted on a post they've subscribed to, I'd like to give them the option to only be notified when they specifically get replied to. I can develop this myself if need be, in fact, a preliminary search yielding no results seems to point at this. My question is, what hooks would I take a look at? Looking at other notifier plugins, I see they make use of `comment_post` and others which I can come up with myself. More specifically, how would I go about knowing if user x got a direct reply? I understand how the subscription system and all of that would work, my only concern is how to tell if a subscribed user received a direct reply through the built-in commenting system.


How do I remove dashboard access from specific user roles?

I'd like to prevent certain user roles from accessing the dashboard http://www.openeye.net/wp-admin/ at all. I've moved and restyled user profiles to a new page that's viewable on the site. How would I go about doing this?


The Events Calendar - Datepicker not working

The dropdown datepicker is throwing a not found error. I am not sure if this is a 3.2 issue or not, because I did not install this plugin until after the 3.2 release, but I know the datepicker is a jQuery function, so it might be. You can view the error here: Sample error for datepicker choice of August, 2011: http://hammondmarina.com/wp/category/events&eventDisplay=month&eventDate=2011-08 (Select the "Events Calendar" from the main menu to get to the grid. New here so I can't post more than 2 links in this post.) The forward and backward links are working fine. I discovered that when you substitute the "&" with a "?" after category/events, the link will work: http://hammondmarina.com/wp/category/events?eventDisplay=month&eventDate=2011-08 How do I fix this in the the-events-calendar/views/datapicker.php file or the template-tags.php file (where references to the datepicker both occur)? Thanks in advance for any help.


Advanced custom fields: Customise date picker's start date (need to choose year 1500 onwards)

In Advanced custom fields, I would like to customise the date picker so that, ideally, I can only select a year in the 1500s/1600s but at the very least allow the datepicker to go back to the 1500s. At present it only goes to 19 something. Would anyone know how I'd implement this?


Adding a cover image to video shortcode

I'm looking for a way to allow the user to add a cover image (a.k.a. thumbnail) to an internal video, uploaded to WordPress and embedded with the shortcode [video]. So far everything I came up to is adding or changing thumbnails to external videos. Any ideas of appropriate hooks, plugins doing something similar or just advice on how to approach the problem are welcome!


Adding another word in front of post url

I have a wordpress website with bunch of posts. My problem is that I need to change the URLs from               website.com/post-name      to               website.com/specialword/post-name      The "specialword" is what I need to add in front of those post names, but ONLY for the post type - posts. Can someone help me? I need this badly, mostly because of the SEO purposes so I can keep the URLs from the previous website that wasn't done in wordpress. Thank you! Slavisa


Problem with guids and absolute links

Post and page guids include the full absolute URL of my site (e.g. http://www.example.com/wordpress/?p=1). This causes a problem if the domain, or wordpress path changes, or if I'm viewing the site via its IP address rather its domain, etc. Problem 1: there are some internal links on my site that are using the guid. I'm guessing this is _wrong_ and I should rewrite the template code to remove references to the guid - correct? Problem 2: images are inserted into a post using their absolute URL, rather than a relative one. This seems short-sighted, but I'm wondering if there's a reasonable reason for that. Is there a way to change that behaviour?


Fast worpress backup/clone

i have a problem with 2 websites. I have for example `site1.com` `site2.com` How can i make a perfect clone of site1.com for site2.com? i mean i want a method that i can do this in minutes, not changing the database, delete it, create it once more, copy ... etc The clone must be exacly the same, except the domain,mysql, files including folders, images, comments, everything.


Showing the user's username in registration email or activation page with BuddyPress

a) I would like the person's username to be included in their activation email once they have registered. e.g. Activation email would look like: Thanks for registering! To complete the activation of your account please click the following link and log in using _USERNAME_ and password you chose: _activation link url_ Or if that is not possible. b) If it is easier to display it on the page once the activation link has been clicked in the email, I would like to show the person's username there. e.g. Activation page: Your account was activated successfully! You can now log in with the username _USERNAME_ and password you provided when you signed up.


Adding wp_link_pages to a theme that seems to lack?

I'm using wp-bootstrap as basis to build out a custom site. The wp_link_pages function doesn't seem to work and I'm thinking maybe it's just missing from the theme. I've got a code in a page and the template it's using has in it but it's not working. I'm thinking maybe this functionality was stripped out of the theme. Wondering how to put it back if this was the case. I did a search through all the theme files for wp_link_pages thinking I might find where it was declared but don't see it anywhere.


Getting WordPress to work inside a rails 3 application

I am migrating an existing WordPress blog into a subdirectory of a new rails 3 app (deployed on Apache2 / Ubuntu 10). I have PHP/MySQL installed, and I have a standard rails app folder structure in the production env:               /var/www/railsapp/public/      Inside `/public/`, I want to copy the Wordpress files into `/home/blog/`, so:               ../public/home/blog/-wp stuff-      I've already migrated all the files as well as the database, and updated wp- config.php per the directons given in the Wordpress codex. However, when I try to access the blog: (`www.example.com/home/blog`), I get a 403-forbidden message. I've already ensured my vhost config is setup correctly (I can access the rails app without issue) and the http.d directive is as follows:               <Directory /var/www/railsapp/public/>         Options +FollowSymLinks         AllowOverride all         Order allow,deny         Allow from all     </Directory>      Is there something I'm missing? My `../home/blog/.htaccess` file is also correct (I believe):               # BEGIN WordPress     <IfModule mod_rewrite.c>     RewriteEngine On     RewriteBase /home/blog/     RewriteRule ^index\.php$ - [L]     RewriteCond %{REQUEST_FILENAME} !-f     RewriteCond %{REQUEST_FILENAME} !-d     RewriteRule . /home/blog/index.php [L]     </IfModule>          # END WordPress      What could be the problem?


How do I remove a rewrite rule?

I've added a rewrite rule with the following code, and now I need to remove it.               add_rewrite_rule('^events$', 'index.php?post_type=events', 'top');      My issue is not that the rule is not working. It is that the rule is already added, and I want to get rid of it. Does deleting the add_rewrite_rule() line of code and flushing the rules get rid of it?


How to Load Scripts and CSS for Admins Only When Editing or Adding Posts

I have a plugin that will allow administrators to perform certain actions when adding or editing a post. I use a stylesheet and a javascript for this plugin that I want to include _only_ when a post is being added or edited. Am I right to use the following action hooks?               add_action('load-post.php', 'call_my_function');     add_action('load-post-new.php', 'call_my_function');      Inside of the function call_my_function I have:               function call_my_function() {       $plugin_directory = "/wp-content/plugins/".dirname(plugin_basename(__FILE__));       $jssrc = $plugin_directory.'/js/my_plugin.js';       wp_enqueue_script("my_plugin_js", $jssrc);       $csssrc = $plugin_directory.'/css/my_plugin.css';       wp_enqueue_style("my_plugin_css", $csssrc);     }      The code above successfully loads the CSS and Javascript files when not called from the add_action hook. It does not work successfully when called from these hooks.


How to allow user to perform search by more than one tag

I have a few dropdown select option in my wordpress sidebar: ![enter image description here](http://i.stack.imgur.com/GfvIO.png) Whenever a user selects an option from any of the dropdown, they are directed to the search result page:               http://mywebsite/wp/?post_type=post&taxonomy=category&terms=29&search_type=or&order=title      The `29` is the Tag that is searches for which is what the user selected. I am doing that functionality with JQuery:               $('select').on('change', function () {         var url = $(this).val(); // get selected value         if (url) { // require a URL             window.location = "http://mywebsite/wp/?post_type=post&taxonomy=category&terms=" + url + "&search_type=or&order=title"; // redirect         }         return false;     });      I was trying to, instead of the above JQuery to have this:               $("#search").click(function(){         var k = $("#mtsw-form-children-term-ids-10 option:selected").val();         var m = $("#mtsw-form-children-term-ids-13 option:selected").val();         var o = $("#mtsw-form-children-term-ids-11 option:selected").val();         alert("Location: " + k + "\nSpecialty: " + m + "\nPhysician: " + o);                 //window.location = ; //SEARCH BASED ON LOCATION, and/or SPECIALTY, and/or PHYSICIAN tags     });      I am using the Multi-Term-Selection widget for the dropdown. How would I know if I am able to accomplish that search? I am new to Wordpress so I am trying to understand the starting point.


Insert images to post without Insert Media Window

Is it possible to insert images to a Wordpress site with having to use the Insert Media window. I have a forum type site where I would like people to be able to add images to post they can create but I don't want them to be able to create Galleries of images etc. I would just like the ability to add images from there system to the post like you can do on forums. Is this at all possible.


How can I clear memcached WordPress site options by hand?

Ater rebooting a memcache node, I am getting an error on root blog only, with a telling error log message from wp-includes/ms-settings.php.               [Thu Jul 07 18:55:27 2011] [error] [client 12.34.56.78] PHP Warning:  Attempt to assign property of non-object in /var/www/domain.php/wp-includes/ms-settings.php on line 114      Dumping the $current_blog var from that file shows there's no site data loaded into the object, just a couple plugin references, which is why lines like these are failing:                   $blog_id = $current_blog->blog_id;         $public  = $current_blog->public;      How can I clear site options in memcache by hand? What are the keys?


How do I redirect upon login a specific user based on role?

I'd like to force a user to a specific page upon login based on their role using               if ( current_user_can('contributor') )      and the main login function               function wp_loginout($redirect = '', $echo = true) {         if ( ! is_user_logged_in() )             $link = '' . __('Log in') . '';         else             $link = '' . __('Log out of account') . '';              if ( $echo )             echo apply_filters('loginout', $link);         else             return apply_filters('loginout', $link);     }      I've tried a number of combinations and seem to be failing. Any help would be appreciated.


Custom form that store input in database

I have never used WordPress before, but have done a lot of programming. But what is the normal way of making customs forms? I need to create a form where a user fill some input fields and on submit will the data be stored in the database. No need for any email. I also need to query the data and get the output in a HTML table. Thanks


IP address character limit

my client in his template is using `<?php comment_author_IP(); ?>` to display IP's of comment authors. Recently he came to me with idea of limiting whole number to several characters. Final result should be something simillar to: > 192.168... How can i achieve it? I've tried with jquery but without success. It looked like it was not responding to the jquery code.. thank you!


Limit the number of results from wpsc_start_category_query

Observe the following code:
     <?php wpsc_start_category_query(array('category_group'=>get_option('wpsc_default_category'),'show_thumbnails'=>get_option('show_category_thumbnails'))); ?>

<?php wpsc_print_category_image(); ?>

                 <?php wpsc_print_category_name();?>

                 <a href="<?php wpsc_print_category_url();?>" class="wpsc_category_link"><?php wpsc_print_category_name();?>                 <?php if(get_option('wpsc_category_description')) :?>                 <?php wpsc_print_category_description("
", "
"); ?>                 <?php endif;?>

              <?php wpsc_end_category_query(); ?>
      The above code displays all my product categories in a list. The problem with this approach is that I am not able to limit the number of categories that results. For example if I want to display 4 random categories, but have 6 in my WP database, then I won't get what I want. Is there any alternate way to get the an `x` number of categories from all possiblities? Maybe with `WP_Query`?


Is it possible to bold certain words in a post title?

I guess I would like to be able to include HTML tags within the title so that when the title is listed certain words are bolded. Is this possible? When I try to put HTML into the title, the tag itself is output (escaped) in the final page list.


Call two different function.js depending on page

I'm trying to find how I can call 2 different function.js depending of the page. When on "home", I want to load "function_2.js", and on the other pages of my website the original "function.js". I need to change something in my function.php but I can't figure out what. Can anybody make a suggestion to what I'm doing wrong? **EDIT** Here is my code               if(is_front_page()) {          add_action('wp_footer', 'handle_script', 200);         function handle_script(){             $templatedir = get_stylesheet_directory_uri();                 $scripts .= '<script type="text/javascript" src="'.$templatedir.'/_/js/functions_2.js"></script>'."\n";              echo $scripts;         }     }else{          add_action('wp_footer', 'handle_script', 200);         function handle_script(){             $templatedir = get_stylesheet_directory_uri();                 $scripts .= '<script type="text/javascript" src="'.$templatedir.'/_/js/functions.js"></script>'."\n";             echo $scripts;         }     }


Setting a default thumbnail url if no thumbnail

I have created a code to get an existing post's thumbnail and echo the url, but I would like to be able to have it get a default url is the post doesn't have a set thumbnail. Any help would be appreciated! Here's my code so far                   <?php     $thumb_id = get_post_thumbnail_id();     $thumb_url = wp_get_attachment_image_src($thumb_id,'thumbnail', false);     ?>          <div class="content" style="background-image:url(<?php echo $thumb_url[0]; ?>);">          Default Thumbnail url : http://www.website.com/img/default.jpg


WP_User_Query with more than two custom meta values

I am trying to create a custom user query based on users' metadata. I have the following query created.               $users = new WP_User_Query(        array(           'search' => '*' . $search_name . '*',         'meta_query' => array(           'relation' => 'AND',           array(             'key' => 'Status',             'value' => $search_status,             'compare' => 'LIKE'           ),           array(             'key' => 'Operation',             'value' => $search_operation,             'compare' => 'LIKE'           ),           array(             'key' => 'visible_to_directory',             'value' => '1',             'compare' => '='           )         )       )     );      When I have two custom meta values, it works great. Once I add more than that, it doesn't seem to work. Is this not supported with the WP_User_Query class?


Microformats in a single post - layout conflict

WordPress uses microformats, for example, when we use the function `post_class()` in the `DIV` containing the article. It automatically includes the class called `hentry`, which is used in microformats. This is the structure:   1. hentry      1. entry-title     2. updated     3. published     4. author     5. ... So the use of the microformats is really easy, it's only needed to use it as classes in the code. BUT the problem is when we have to use the `entry-title` class out of the `hentry` class, specifically above the content. A lot of WordPress themes use this structure:

<?php the_title(); ?>
         <?php if (function_exists('mybread')) mybread(); ?>

     <div class="<?php content_layout(); ?>">         <?php if (have_posts()) while (have_posts()) : the_post(); ?>         <div id="post-<?php the_ID(); ?>" <?php post_class(); //The HENTRY class is here ?>  >

      With this layout it's impossible to use `entry-title` into `hentry`. So Google Webmaster Tools returns the error of "entry-title missing". I'm planning two solutions: to remove the `hentry` class using a filter, or to remove it and then insert it manually above the title. How can I fix it?


Wordpress and Magento: let Wordpress manage user registration and logins?

I need to integrate Magento and Wordpress for a corporate website. There will be other functionalities in the website that will require a login (ie forum, helpdesk and maybe others...) which I would like to develop with Wordpress since I'm totally ignorant at the moment on Magento and looks a very complicated system for theming and extending. The problem is user registration and logins: which system should handle those? Wordpress or Magento? What would be the best route to follow? Thank you so much for any help or advice


Is there a Wordpress version that is incompatible with PHP 5.3?

Is there some decent information available which WordPress versions do _not_ support PHP 5.3? I mean the more recent ones like 2.9 / 3.0 / 3.1? I'm only concerned about the Wordpress core codebase, not plugins. I've run WP for most of the time on PHP 5.3 now. But some servers are still on PHP 5.2 and some hosters are concerned if an upgrade might break something, so I try to gather some feedback from a larger community. The graphical wp.org stats do not differ between WP and PHP versions to each other, this would be some good source as well. Thanks for your help!


Wordpress removes spaces in URL on pagination

I'm having a problem with wordpress rewriting my URLs, basically I have a regular search form with method set as `GET`, when I submit it the URL looks like this at first: `http://mysite.com/news/?type=My+Variable` Wordpress adds the `+` symbol to separate the string and the results show fine, but when I click on the previous posts link the URL changes to: `http://mysite.com/news/page/2/?type=MyVariable` Since the `type` parameter is now `MyVariable` it shows me no results, it doesn't matter if I type the `+` sign directly in the URL, when I press ENTER it just gets removed. It seems to be related to how wordpress handles canonical URLs but I'm not sure about it, can anyone help me? Thanks in advance.


Re-ordering Admin Submenu Sections

I was looking at **the method below** to reorder the **Admin Menu Sections** : http://wordpress.stackexchange.com/a/1220/1044 ...and was wondering if it's possible to reorder the **submenu sections** using similar method.


Check out Attribute on WooCommerce

I am using WooCommerce on one of the site. I need to add one more field at the time of checkout to ask buyer wheteher to issue Invoice on his name or the name of his business? Any advise how to do that? Or something like this is already there in Woo Commerce? Or what could be the simplest way to do that?


Comments screen in backend, how to disable email address of commenter for non admins

I'm trying to configure the comments screen in the backend to fit my project. I've already been able to take a first step by resolving this question: Comments screen in backend, how to disable Quick Edit | Edit | History | Spam | for non admins Now I'd like the post author viewing all the comments received to be unable to see the email account of the commenter. I'm a bit afraid that some of the authors could create some posts just to receive tons of comments and be able to see all the email accounts in his backend to use them for spamming purposes. Is it possible to keep the email account of the commenter only to be viewable by the admin? Thanks! I've been looking for hours online but the only kind of plugin I found is 6 years old and is not working                /*      Plugin Name: Erase Commenter Details      Plugin URI: http://wordpress.org/support/topic/143772      Description: Removes IP, e-mail and URL of comment authors from Comments admin when viewed by 'contributors.'      Version: R1      Author: Kaf Oseo      Author URI: http://szub.net          Copyright (c) 2007 Kaf Oseo (http://szub.net)     Erase Commenter Details is released under the GNU General Public License     http://www.gnu.org/licenses/gpl.txt          This is a WordPress plugin (http://wordpress.org).          */          function szub_erase_commenter_details($text) {     if( !current_user_can('publish_posts') ) {         $patterns = array('/ \| .*<\/a>/', '/ \| ' . __('IP') . ': <a href=.*<\/a>/', '/ \| <a href=\'mailto:.*<\/a>/', '/(' . __('E-mail') . '|' . __('IP') . ')<\/th>/', '/(<a href=(\'mailto|"edit-comments\.php).*<\/a>)?<\/td>/');         $text = preg_replace($patterns, '', $text);     }     return $text;     }          if( strpos($_SERVER['REQUEST_URI'], 'wp-admin/edit-comments.php') ) {     ob_start('szub_erase_commenter_details');     }


Change Label for field used in Woo Commerce

I'm using WooCommerce, and using a BACS Payment method which is actually Bank Trasnfer. The fields account details are fine, but for Indian context.. i need to change following two fields labels to something else. For example: Change IBAN label to MICR Code, and BIC to IFSC. And also need to disable Sort Code. However, please note that I don't to make chanegs into plugin's code itself. So looking for some function that can help change the label from my theme function file. Any help is appreciated.


The conditional logic only works to show or hide?

I am using the Advanced Custom Fields for custom fields in the User Profile. I use conditional logic to display one of between four fields, each field will be displayed according to a radio field option previously clicked. In this case only one option would can be sent. But, when the user update your profile all four fields are being sent. The conditional logic in this case is only serving to show or hide. Some tip on how to improve this? I appreciate any help.


Same theme name issue with wordpress repository theme

I created new theme with name for example XYZ. its good till now but the issue comes before few days. Wordpress repository has a theme with same name as my theme's name. Now the issue is when the updates comes for wordpress theme, the update notification is display for my themes also. So what can i do for this ? Thanks, Aezaz


$content_width for responsive UI

In our " _mobile first_ " age a theme without responsive UI is treated like from stone age. It means that a theme could have different content width for different devices. But one of requirements for theme development is to provide `$content_width` variable which should contain actual width of content area of a theme. Taking in consideration said above, I have the big question what width should I set for `$content_width` variable? A width for `mobile phones`/`tables`/`laptops`/`desktops`?


Allowed memory size of (...) exhausted

I'm stuck trying to figure out what seems to be a very common problem, the above mentioned "Allowed memory size of (...) exhausted". After developing my first theme I was moving it (just the theme, not the whole WP installation) from my development computer to my production server. After installing WP everything seemed fine and the site was working great with the default theme. Upon activating my custom theme however WP started throwing the error, > PHP Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to > allocate 523800 bytes) in /srv/www/my.domain.com/public_html/wp- > includes/cache.php on line 113 Worth mentioning is that I've never had any issues like this during development. I've tried to increase both the memory limit in php.ini as well as setting the WP_MEMORY_LIMIT constant in wp-config without luck.               php -i | grep memory     memory_limit => 128M => 128M          cat wp-config.php | grep MEMORY     define('WP_MEMORY_LIMIT', '128M');      As you can see I've worked my way up to 128M. Still hitting the error I'm thinking this is getting ridiculous and not likely the source of my problem. As far as I can recall I never had to go much beyond 32M on much larger WP installations in the past.


$wpdb->flush(); breaks the loop

I am using `$wpdb->flush();` at the base of my page in an attempt to prevent the query executing multiple times due to caching however it seems that it isn't flushing the most recent query but the entire cache as my page is not loading past generating my content. Possibly Relevant information:   * I am using the `exec-php` plugin and consequently this page is entirely php   * I am also having another possibly related problem as detailed here


Adding line to multidimensional array option

I'm building a shipping plugin with a settings page where the user can add boxes with the attributes : Name, Length, Width, Height So far, I have managed to greate an option boxdata[l,w,h] and I have :                   function boxes_menu(){           add_options_page('boxes Config', 'boxes Plugin', 'manage_options', 'boxes-menu', 'boxes_options');           add_action( 'admin_init', 'register_mysettings' );     }          add_action('admin_menu','boxes_menu');          function boxes_options(){           include('admin/boxes-admin.php');     }         function register_mysettings() {            register_setting( 'boxes-settings-group', 'boxdata' );         }      and in my option page :               <form method="post" action="options.php">     <?php settings_fields( 'boxes-settings-group' ); ?>     <?php do_settings_sections( 'boxes-settings-group' ); ?>     <input type="text" name="boxdata[name]" value="<?php echo get_option('boxdata[name]'); ?>">       <input type="text" name="boxdata[length]" value="<?php echo get_option('boxdata[length]'); ?>">     <input type="text" name="boxdata[width]" value="<?php echo get_option('boxdata[width]'); ?>">     <input type="text" name="boxdata[height]" value="<?php echo get_option('boxdata[height]'); ?>">     <?php submit_button(); ?>          </form>      The page is visible, with the 4 fields, and it apparently submits without error. Now, I have 2 questions, I have done a lot of reading but it confused me more than anything. 1 - is this syntax correct and my option created properly? 2 - How do I enable the user to add more boxes with their attributes? Like boxdata1[name,length,width,height], boxdata2, etc... I'd like to store them all in a single array, but I can't figure out how. PS: I'm sure this question has been covered somewhere, but, although I'm fluent in PHP, I am quite a WP newbie, so please have some patience!


Wordpress Customise

I'm looking for a plugin that lets me put a "please wait" message (similar to **notebook-driver.com** where you're redirected to download link after a few seconds) when people click on certain links. For example, when people want to download something off my blog, I redirect them to a page with advertisements that is displayed for 5 seconds before the download is initiated. Does such a plugin exist? or how to do this manually ? Thanks.....


Get dimensions of referenced image (Magic Fields fields plugin with phpThumb)

I'm displaying a group of thumbnails on a Wordpress site using the Magic Fields plugin Here's the code in my template:                 <?php       $client_images = get_group ('images');       foreach($client_images as $image){ ?>
           <a href="<?php echo $image['client_image'][2]['original']; ?>">             <?php echo "" ;?>

Resolution

[ORIGINAL RESOLUTION]

Credit

<?php echo $image['client_image_credit'][4]; ?>

Description

<?php echo $image['client_image_description'][5]; ?>

         <?php }       ?>      Where it says [ORIGINAL RESOLUTION], I'd like to print the resolution (e.g. "1200x800") of the source image. Magic Fields uses phpThumb to generate thumbnails. phpThumb seems to have a function for this purpose:               //Getting the original size of the image     if( preg_match('/'.MF_FILES_NAME.'/',$image_name_clean) ){       $image_name_clean = preg_replace('/'.MF_FILES_NAME.'\//','',$image_name_clean);       $file = MF_FILES_DIR.$image_name_clean;     }else{       $file = WP_CONTENT_DIR.DS.$image_name_clean;     }          if(file_exists($file) && (empty($_GET['w']) || empty($_GET['h']))){         $size = @getimagesize($file);         $default['w'] = $size[0];         $default['h'] = $size[1];     }      Would anyone be able to help me connect the dots? Thanks!


Trying to do a custom Search results page. Failing when I use the pagination

I'm trying to do a page where the user can search for posts with a Keyword (as search.php) and post date filter (between one date and another). I have a form with 3 fields: keyword, date1 and date2 and I use these fields to filter the wp_query. I'm NOT working in search.php file, I have myfile.php with all the code. If I don't use pagination on the loop, all works perfect, the wp_query filters without problems with the fields of the form. The problem comes when I use the pagination, when I begin to go to previous entries, I can see ALL the posts of my site, it is like when I move with previous / next entries, the wp_query looses the 3 filters of the form. I have seen when I go to a previous entries, Wordpress refresh the page adding a parameter called "paged=2", and here it is where I loose the filters of the form, keyword,date1 and date2. I don't want use the search.php. I'm trying to create my own search results page. I newbie in WordPress, so I will appreciate any help or comment. Thanks This is my code:               <?php     // **************** GET THE PARAMETERS FROM THE FORM     function getData($campo) {          return isset($_REQUEST[$campo]) ? $_REQUEST[$campo]:'';      }          $filterKeyword = getData('Keyword');     $filterDate1 = getData('Date1');     $filterDate2 = getData('Date2');          //*** IF THERE IS NOT PARAMETERS, DON'T RUN QUERY AND LOOP     $show = true;     if(($filterKeyword == '') && ($filterDate1 == '') && ($filterDate2 == ''))         $show = false;          get_header();            ?>     // ********** FORM ****************     <form id="form_datos" action="<?php the_permalink(); ?>" method="post">             <input type="text" name="Keyword"  />             <input type="text" name="Date1"  />             <input type="text" name="Date2"   />                  <input type="submit" id="enviar" value="Send">     </form>          <?php     if ($show) :                              // ********** Query filters *************         $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;         $args = array(             's'=> $filterKeyword,             'post_type'=> 'post',             'posts_per_page' => 10,             'paged'=> $paged,             'orderby' => 'date',             'order' => 'DESC',             'date_query' => array(                 array(                 'after'     => $filterDate1,                 'before'    => $filterDate2,                 'inclusive' => true,                 ),             ),             );              // ************ Query  & Loop ********************         $query = new WP_Query( $args );              if ($query->have_posts() ):             while( $query->have_posts() ): $query->the_post();                      the_time('G:i');               endwhile;           // ********* Navigation *************     next_posts_link( 'Entradas anteriores', $query->max_num_pages );     previous_posts_link( 'Entradas posteriores' );          endif;            wp_reset_postdata();              endif;     ?>


How to add more upload directories?

I have two types of files in my WordPress Media Library, one is for pictures and attachments from posts, the other is for attachments from a custom post type. I want to organize them separately, **use my plugin's dir as basedir** for the custom post type, while **keep other files in Wordpress' default upload directory.** Is it possible to add one more basedir?


WP 3.3 RC1 new switch_theme() method foobars sidebars

I've been testing the new 3.3 RC1 code against my plugin and I've found a significant difference in the switch_theme() function that foobars my ability to preset widgets dynamically. The problem appears to be the call to the global $sidebars_widgets. Notice that in prior versions, the switch_theme() method did not involve the sidebar widgets. Anyone know what the purpose of that is? I have a plugin that creates and inserts widgets dynamically just before installing a new theme and calling switch_theme() during plugin activation. The code runs fine in 3.2.1, but does not run in 3.3 rc1 (The sidebar widgets are created, just not inserted into the sidebars) Here's the code from 3.2.1               function switch_theme($template, $stylesheet) {         global $wp_theme_directories;              update_option('template', $template);         update_option('stylesheet', $stylesheet);         if ( count($wp_theme_directories) > 1 ) {             update_option('template_root', get_raw_theme_root($template, true));             update_option('stylesheet_root', get_raw_theme_root($stylesheet, true));         }         delete_option('current_theme');         $theme = get_current_theme();         if ( is_admin() && false === get_option( "theme_mods_$stylesheet" ) ) {             $default_theme_mods = (array) get_option( "mods_$theme" );             add_option( "theme_mods_$stylesheet", $default_theme_mods );         }         do_action('switch_theme', $theme);     }      And here's the updated code from 3.3 rc1               function switch_theme($template, $stylesheet) {         global $wp_theme_directories, $sidebars_widgets;              if ( is_array( $sidebars_widgets ) )             set_theme_mod( 'sidebars_widgets', array( 'time' => time(), 'data' => $sidebars_widgets ) );              $old_theme = get_current_theme();              update_option('template', $template);         update_option('stylesheet', $stylesheet);              if ( count($wp_theme_directories) > 1 ) {             update_option('template_root', get_raw_theme_root($template, true));             update_option('stylesheet_root', get_raw_theme_root($stylesheet, true));         }              delete_option('current_theme');         $theme = get_current_theme();              if ( is_admin() && false === get_option( "theme_mods_$stylesheet" ) ) {             $default_theme_mods = (array) get_option( "mods_$theme" );             add_option( "theme_mods_$stylesheet", $default_theme_mods );         }              update_option( 'theme_switched', $old_theme );         do_action( 'switch_theme', $theme );     }


MySQL query performed 4 times inside loop

I have enabled custom php in my pages through the use of the `exec-php` plugin so I can run more complex pages than the standard WordPress page. I have had no problems with this plugin so far. I have recently moved a page I was using independently from WordPress to inside the WordPress system. Now instead of running a `INSERT` mysql query once like it should, it runs it 4 times leaving me with 3 redundant rows in my database. As far as I can tell there is no help on this issue, has anybody encountered this problem or know of a way to circumvent this? ~~As it may impact the answer I am using`mysql_query()` in favour of `$wpdb->query()`.~~ EDIT:   I have since rewrote the page to use the most appropriate `$wbdb` function (my code can be found here). In addition I found that when I use `$wpdb->flush();` it inserts 1 row only however it seems to break the loop as it doesn't load the template.


How does $wpdb handle COUNT(*)

I understand how to do simple queries and display results using $wpdb. This is my process:               <?php $sql = 'select * from wp_votes;'; ?>     <?php $votes = $wpdb->get_results($sql); ?>     <?php if ( !empty ( $votes ) ) { ?>          <?php foreach ( $votes as $vote ) { ?>                <?php echo $vote->id; ?>	               <?php echo $vote->post_id; ?>	               <?php echo $vote->date_voted; ?>	          <?php } ?>      <?php } ?>       Now, what if my query is more complicated, where there is a COUNT(*) involved, like so:               <?php $sql = 'select wp_votes.post_id, wp_posts.post_title, count(*) from wp_votes INNER JOIN wp_posts ON wp_votes.post_id = wp_posts.id group by wp_votes.post_id order by count(*) desc;'; ?>       This should return:               --------+------------+----------+     Post ID | Post Title | Count(*) |     --------+------------+----------+     1       |  "My post" |   6     2       |  "Hello..."|   5      Would it be OK if I do something like this?               <?php $wpdb->get_results($sql, ARRAY_N); ?>       and then, to get the count,               <?php echo $row[2]; ?>       EDIT: Turns out, it's actually just this simple, I don't have to do anything else $row[x] will work.


Question about the way that wp_register_script works

Ok so I'm using the Roots Theme for WordPress (https://github.com/retlehs/roots), which, is sort of a starter theme or theme framework. I'm confused about the way that it deregisters the WordPress loaded version of jQuery and but it registers it again **without specifying the exact location of the script**. So in the header.php of the theme there's this code:               ...     <script src="//ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script>       <script>window.jQuery || document.write('<script src="<?php echo get_template_directory_uri(); ?>/js/libs/jquery-1.6.4.min.js"><\/script>')</script>     ...      ,which, reads to me: 'download the Google hosted jQuery script but if for some reason the jQuery object isn't present then just create a script element that loads the script that comes with the theme. However, inside a theme file called roots-cleanup.php that is included in the functions.php of theme there is this code that deregisters the jQuery script that comes with WordPress but immediately registers jQuery again without really specifying the script's url:               ...     function roots_head_cleanup() {       ...            // don't load jQuery through WordPress since it's linked in header.php       if (!is_admin()) {         wp_deregister_script('l10n');         wp_deregister_script('jquery');         wp_register_script('jquery', '', '', '', true);       }     }          add_action('init', 'roots_head_cleanup');     ...      Now I went to see what the documentation says about this and it says something like: _"This parameter [the location parameter] is only required when WordPress does not already know about this script."_ So I'm wondering, by including the script tags that load jQuery in the header.php does that mean WordPress is aware of them as far as calling wp_register_script goes? Like so:               wp_register_script('jquery', '', '', '', true);      I'm asking because I wanted to try this technique but I didn't get the results I expected. Namely, javascripts that I included using wp_enqueue and that depended on jQuery still loaded even when I removed the script tags that includethem in the header, which, means the javascripts I loaded failed because there was no jQuery being loaded. This also tells me that WordPress isn't necessarily aware of the jQuery script if I don't specify the location paramater.


Posts 2 Posts: query connected -- orderby problem

Using Posts 2 Posts plugin I've created `'piece'`, `'person'` and `'collection'` custom post types: any piece may be connected to person (with roles `'author'`, `'conductor'` etc) and collection. Now the relevant code looks like this:               // get all audio pieces connected to current $person:     $audio_ascond = p2p_type( 'pieces_persons' )->get_connected( $person->ID,           array( 'connected_meta' => array( 'role' => 'conductor' ),              'media_tag' => 'audio_tag',              'posts_per_page' => -1 ) );     // get their IDs:     $audio_ascond_IDs = array_map( create_function( '$p', 'return $p->ID;' ),                                           $audio_ascond->posts );     // get collections for those pieces:     $colls = p2p_type( 'pieces_collections' )->get_connected( $audio_ascond_IDs,                 array( 'orderby' => 'menu_order title', 'posts_per_page' => -1 ) );      So, the problem is that `'orderby'` has no any effect. Everything else works great. `print_r($colls)` looks like ok. What this could be, please? Thanks!


images in wordpress themes

I am developin a theme in php using wordpress.I want to display images on the website . so my question is what will be the best practise 1)store the image itself in a table using an "image" or "binary data" data type of the database server. or 2)store the images as a file in the file system and create a record in a table with the exact path to that image. ..trying to bother the database as little as possible... .


TinyMCE - TypeError: r is undefined

With the latest pgrade of wordpress tinyMCE was upgraded. This resulted in my custom plugin being rendered useless with deprecated calls. I was able correctly format the event handling and now I am seeing the issue:               TypeError: r is undefined      Can anyone explain what 'r' is? Any way to further debug tinyMCE?               (function($) {     tinymce.create('tinymce.plugins.editor_toolkit', {         init : function(ed, url) {                     var VK = {                         DELETE: 46, BACKSPACE: 8, ENTER: 13, TAB: 9, SPACEBAR: 32, UP: 38, DOWN: 40, LEFT: 37, RIGHT: 39,                         modifierPressed: function (e) {                             return e.shiftKey || e.ctrlKey || e.altKey;                         }                     };                      function scrollToThisNode(node, padding) {                     vp = ed.dom.getViewPort( ed.getWin() )                     y = ed.dom.getPos(node).y;                     if (y < vp.y || y + padding > vp.y + vp.h) {                         ed.getWin().scrollTo(0, y < vp.y ? y : y - vp.h + padding);                     }                 }                  // Adds an observer to the onInit event using tinyMCE.init             tinyMCE.init({                setup : function(ed) {                   ed.onInit.add(function(ed) {                       console.debug('Editor is done: ' + ed.id);                       ed.dom.addClass(ed.getBody(), 'editor-toolkit');                              // Last-ditch effort to structure content                         $('#post').submit(function(){                             $( ed.getBody() ).children('p').each(function(){                                 $(this).replaceWith('

' + $(this).html() + '

');                             });                             return true;                         });                   });                }                plugins: "compat3x"                  });                  ed.on('BeforeSetcontent', function(ed, o){               if (adminpage == 'post-new-php' && !$( ed.getBody() ).hasClass('editor-toolkit-init') ) {                     o.content = '

';                     ed.dom.addClass(ed.getBody(), 'editor-toolkit-init');                 }             });                  ed.on('KeyDown', function(ed, event){               if ( event.keyCode === VK.DELETE && !VK.modifierPressed(event) ) {                    }               if ( event.keyCode === VK.BACKSPACE && !VK.modifierPressed(event) ) {                    }               if ( event.keyCode === VK.ENTER && !VK.modifierPressed(event) ) {                 setTimeout(function() {                     var currentNode = ed.dom.getParent(ed.selection.getRng().startContainer, ed.dom.isBlock);                     var prevSibling = $(currentNode).length > 0 ? currentNode.previousSibling : false;                     var nextSibling = $(currentNode).length > 0 ? currentNode.nextSibling : false;                     var prevPrevSibling = $(prevSibling).length > 0 ? prevSibling.previousSibling : false;                     var nodeIndex = $(currentNode).length > 0 ? $(currentNode).index() : false;                     var nodeIsLast = $(currentNode).length > 0 ? $(currentNode).is(':last-child') : null;                          var nodeParent = ed.dom.getParent(currentNode, 'div');                     var nodeParentPrevSibling = $(nodeParent).length > 0 ? nodeParent.previousSibling : false;                     var nodeParentNextSibling = $(nodeParent).length > 0 ? nodeParent.nextSibling : false;                     var nodeParentChildren = $(nodeParent).length > 0 ? $(nodeParent).children().length : false;                          var contentBody = ed.getBody();                     var contentFirstChild = ed.getBody().firstChild;                          var newNodeData = '

';                          function isEmpty(node) {                         if (ed.dom.isEmpty(node) || node.firstChild.nodeName === 'BR' || $(node).html() === ' ')                             return true;                         else                             return false;                          }                          switch(true) {                         // Start new block at selection point ("after")                         case nodeIsLast && nodeIndex + 1 === nodeParentChildren && nodeParentChildren > 3:                         case nodeIndex === 2 && nodeParentChildren === 3 && ( !isEmpty(prevSibling) || !isEmpty(prevPrevSibling) ):                             if ( isEmpty(prevSibling) && isEmpty(currentNode) ) {                                 $(nodeParent).after('
' + newNodeData + '
');                                 ed.dom.remove(prevSibling);                                 ed.dom.remove(currentNode);                                 newBlock = nodeParent.nextSibling;                                 ed.execCommand('mceSelectNode', false, newBlock.firstChild.firstChild);                                 ed.selection.select(newBlock.firstChild.firstChild, true);  // Extra to get FF to show cursor                                 scrollToThisNode(newBlock, 100);                             }                             break;                         // Start new block at selection point ("before")                         case nodeIndex === 2:                             if ( isEmpty(prevSibling) && isEmpty(prevPrevSibling) ) {                                 $(nodeParent).before('
' + newNodeData + '
');                                 ed.dom.remove(prevSibling);                                 ed.dom.remove(prevPrevSibling);                                 newBlock = nodeParent.previousSibling;                                 if ( $(newBlock).is(':first-child') ) {                                     ed.execCommand('mceSelectNode', false, newBlock.firstChild.firstChild);                                     ed.selection.select(newBlock.firstChild.firstChild, true);  // Extra to get FF to show cursor                                     scrollToThisNode(newBlock, 100);                                 }                             }                             break;                         // Correct new paragraph created outside a block                         case currentNode && currentNode.nodeName === 'P' && !nodeParent:                             newNodeData = $(currentNode).html();                             $(currentNode).after('

' + newNodeData + '

');                             newBlock = currentNode.nextSibling;                             ed.dom.remove(currentNode);                             break;                         // Rare but best to cover all angles (problematic on empty pages)                         case contentFirstChild.nodeName === 'P':                             $(contentFirstChild).replaceWith('
' + newNodeData + '
');                             newBlock = ed.getBody().firstChild;                             ed.execCommand('mceSelectNode', false, newBlock.firstChild.firstChild);                             ed.selection.select(newBlock.firstChild.firstChild, true);  // Extra to get FF to show cursor                             break;                         // Fix empty block                         case ed.dom.is(ed.selection.getNode(), 'div') && isEmpty(currentNode):                             ed.execCommand('mceReplaceContent', false, '

');                             break;                     }                          // Run a check for paragraphs outside a block, at root level                     setTimeout(function() {                         $(contentBody).children('p').each(function(){                             $(this).replaceWith('

' + $(this).html() + '

');                         });                     }, 250);                          ed.execCommand('mceCleanup');                 }, 0);               }             });            },       createControl : function(n, cm) {           return null;       },       getInfo : function() {           return {               longname : "Editor Toolkit",               author : 'Studio Anino',               authorurl : 'http://studioanino.com/',               infourl : 'http://studioanino.com/',               version : "1.0"           };       }     });     tinymce.PluginManager.add('editor_toolkit', tinymce.plugins.editor_toolkit);     })(jQuery);      **Is it at all possible to downgrade tinyMCE within wordpress?**


Plugin to redirect all 404 pages to a specific page

I want to redirect all 404 pages to a specific page (not the homepage). Is there any plugin that does that?


Have parent category contain only one post?

Projects <-contains basic info about projects      -Proj1 <-detailed info about proj1      -Proj2 <-detailed info about proj2      -Proj3 <-detailed info about proj3      I have a post attributed to the parent category 'Projects', and I want only that post to be seen when 'Projects' is clicked. By default, each of the subcategories' posts are being shown when I click 'Projects.' Is there a way to change this default setting, so that no posts from subcategories 'Proj1,' 'Proj2,' and 'Proj3' are seen in 'Projects'? I was referred to a plugin called Cat Lists Plus, but this completely eliminates the parent category link. (This has also not been released yet.)


wp 3.9.1. - default image resizer of WordPress doen't work!

I have a problem with the default image resizer of WordPress. Simply doesn't work. All images are uploaded as are. No thumbnails are generated. Probably there is some environment problem. I'm using windows 200 server with php 5.5, all it works fine for the other tks


Pods CMS - Get ACT's attached image records by auto-id?

I have a situation where I can't use usual Pod object and I have Advanced Content Type to deal with. I have a very large record set and I need to build a custom query to fetch the attached image records with main record. **Example Data:** Pod Name = coupons Fields (e.g.) id, name, description, thumbnails(multiple image upload field). Now, I am querying for example like this:               SELECT t.id, t.name FROM `wp_pods_coupons` t      How do I get the images attached (thumbnails field) with each coupon? I can't do new Pod('coupons').


Proper way to make a tweaked theme into child-theme setting?

I've started to tweak a theme and it's been a long road since I've started, but I came across several sources that claim this is not a good practice. I've read that the proper way to do this modifications is to make a "child theme" first. I've tried to set up a child theme but I couldn't even get the parent's css... Having this in mind, how would you migrate all the tweakings and modifications you've already done to the main original theme into a child theme? Is there a straight-forward way to do this?


images not showing despite using add_theme_support('post-thumbnails');

I've got a system for post images where I have a specific category's post thumbnail shown in the header, with a cropped version appearing in the blog `#preview`, and the full size image appearing in the full post. Images are not appearing in any of the 3 locations, and I'm not quite sure why. functions.php-               <?php         register_sidebar();              if (function_exists('add_theme_support')) {           add_theme_support('post-thumbnails');           set_post_thumbnail_size(140,170);         }              if ( function_exists( 'add_image_size' ) ) {          add_image_size( 'custom-image', 440, 265, true ); //(hard cropped)         }              function ravs_get_custom_image( $featured_img ){         global $post, $posts;         $args = array(             'post_type' => 'attachment',             'numberposts' => 1,             'post_status' => null,             'post_parent' => $post->ID,             'exclude' => $featured_img         );            $attachments = get_posts( $args );          if ( $attachments ) {             foreach ( $attachments as $attachment ) {                          $img =  wp_get_attachment_image( $attachment->ID, 'custom-image' );                return $img;               }          }else{              echo 'Please attach images to your post';          }         }     ?>      index.php               <?php echo get_header('cait');;?>     <?php echo get_sidebar();;?>

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

<?php the_title() ;?>
                                      <?php the_excerpt('read more...'); ?>                     <?php endwhile; else: ?>
Sorry, no posts to list
                          <?php endif; ?>
>> Posted on <?php the_date('M-d-y'); ?> >> <?php the_tags('tags: ', ', ', '
'); ?>

               <?php get_footer(); ?>


Show limited menu to admin

I am using the latest wordpress 3.2.1. I would like to let create a new admin to do ONLY this: 1) Manage order to change the order status to (e.g. approve..reject). 2) Able to view user only without the ability to Edit or Delete. 3) Accept email notification on new registered user and new order. This would meant that when this new admin login, he is able to view only these 3 menu and All other menu will be invisible. Could anyone advice? I have tried many like the Adminimize, Admin Menu Editor, hide-admin-panels.. But all don works as it is a role based instead of user based. Should i create a new `admin` for these features above? or should i create an `editor` instead ? Then change the menu for editor.. I need your advice. thanks


How to upload image without post ID using the new media uploader?

In the past when using thickbox to upload images, an image could be uploaded without having the post ID 'attached' to it by simply using the code below :               jQuery('.upload_slider_button').click(function() {          tb_show('', 'media-upload.php?post_id=&type=image&TB_iframe=true&referer=matrix-settings');          return false;     });      However, how can I achieve the same thing using the new Media Uploader which was introduced since WP3.5? I have spent the whole day searching in the internet but there isn't much resources available on this new media uploader. Most of it are focused on utilizing it in theme options / plugins. Or perhaps there are other ways of uploading an image without having the post ID 'attached' to it and yet not using any plugins? Thanks a lot for helping.


the_content() is not displaying content, why?

I have a custom theme and have built a blog page where I'd like to utilize "the loop", but get_content() is not working. Instead of displaying page content, it displays code from a template. I don't understand why this doesn't function properly, because get_posts(), the_time(), and the_title() all work fine... here's what my code looks like:                  <?php get_header(); ?>

             <?php if(function_exists('bcn_display'))                 {                     bcn_display();                  }?>

                                  <?php if( is_page('blog') ) {                   $debut = 0; //The first article to be displayed                        while(have_posts()) : the_post(); ?>
<?php the_title(); ?>

                  <?php                    $myposts = get_posts('numberposts=-1&offset=$debut');                  foreach($myposts as $post) :                  ?>
<?php the_time('d/m/y'); ?>

<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                   <?php the_content(); ?>
                     <?php endforeach; ?>
                  <?php endwhile; ?>                 <?php } else{ ?>                          <?php while ( have_posts() ) : the_post(); ?>                          <?php get_template_part( 'content', 'page' ); ?>                               <?php endwhile; // end of the loop. ?>                      <?php } ?>
                    <?php get_sidebar(); ?>                  <?php get_footer(); ?>
      And my output:               03/05/12      Cool Post 1      /*       Template Name: All posts       */        ?>         $debut = 0; //The first article to be displayed         ?>         $myposts = get_posts('numberposts=-1&offset=$debut');          foreach($myposts as $post) :           ?>         : 03/05/12        Test Post        /*         Template Name: All posts         */          ?>         $debut = 0; //The first article to be displayed          ?>         $myposts = get_posts('numberposts=-1&offset=$debut');         foreach($myposts as $post) :         ?>          : 19/04/12          Hello world!         /*         Template Name: All posts         */        ?>        $debut = 0; //The first article to be displayed         ?>        $myposts = get_posts('numberposts=-1&offset=$debut');          foreach($myposts as $post) :         ?>          :      Whatever it is, it's messing with my css as well. I noticed he /* Template Name: All posts */, but I don't have a template (to my knowledge) named all posts, so I don't know where this code came from. If anyone could please lend a hand, I'd greatly appreciate it


Redirect to post with only post ID in the URL vs post_type/post ID

The title may be a little confusing, I don't know how to word it to be short. Right now my permalink structure is `/%post_id%/%postname%` so the final URL is `/post_type/%post_id%/%postname%`. When I go to `domain.com/post_id` then it redirects to `domain.com/post_type/%post_id%/%postname%` but when I got to `domain.com/post_type/post_id` it doesn't redirect but shows the correct post. I'm not sure how to make it work the way the default redirect works.


Limit the number of inactive widgets

I'm trying to restrict the number of widgets from the "wp_inactive_widgets" sidebar to maximum 10, because the widgets admin page is incredibly slow:               add_filter('pre_update_option_sidebars_widgets', 'cleanup_inactive_widgets', 10, 2);          function cleanup_inactive_widgets($new, $old){       if(!empty($new['wp_inactive_widgets']) && count($new['wp_inactive_widgets']) > 10)         $new['wp_inactive_widgets'] = array_slice($new['wp_inactive_widgets'], -10, 10);            return $new;     }      This works apparently, but the problem is that the widget instance options still remain in the database, regardless if the widget instance exists or not inside a sidebar... Does anyone know a way to remove the widget options too? * * * ~~I found out a solution:~~ Edit: in certain situations it seems to remove widgets from other sidebars too, I'm not sure what's causing this...               if(!empty($new['wp_inactive_widgets']) && count($new['wp_inactive_widgets']) > 10){            // find out which widget instances to remove       $removed_widgets = array_slice($new['wp_inactive_widgets'], 0, -10);            // remove instance options       foreach($removed_widgets as $widget_id)         if(isset($GLOBALS['wp_registered_widgets'][$widget_id])){                $instance = $GLOBALS['wp_registered_widgets'][$widget_id]['callback'][0]->number;           $option_name = $GLOBALS['wp_registered_widgets'][$widget_id]['callback'][0]->option_name;                $options = get_option($option_name);   // get options of all instances           unset($options[$instance]);            // remove this instance's options           update_option($option_name, $options);         }            // keep only the last 10 records from the inactive widgets area       $new['wp_inactive_widgets'] = array_slice($new['wp_inactive_widgets'], -10, 10);          }     return $new;