How to set specific values for a taxonomy via IXR_Client?

I am trying to create posts using IXR_Client. I am already able to do that, but now I am facing a problem were I don't know how to create sub-categories for the posts I am creating. The way I am creating the categories is like this               $content['terms_names'] = array('article-category' => array( "New Product","Product Alpha ) );      I would like `Product Alpha` to be a sub-category or `New Product`, but is not happening. So I decided setting it by hand and looking at `wp.getPost` to see the output and look if I can figure something out and here is the reponse:               [terms] => Array         (             [0] => Array                 (                     [term_id] => 2                     [name] => New Product                     [slug] => newproduct                     [term_group] => 0                     [term_taxonomy_id] => 2                     [taxonomy] => article-category                     [description] =>                      [parent] => 0                     [count] => 4                     [filter] => raw                 )                  [1] => Array                 (                     [term_id] => 4                     [name] => Product Alpha                     [slug] => productalpha                     [term_group] => 0                     [term_taxonomy_id] => 4                     [taxonomy] => article-category                     [description] =>                      [parent] => 2                     [count] => 12                     [filter] => raw                 )              )      So as you can see, if there is any way I can set the `parent` I will be good to go, but I have no idea where in `$content['terms_names']` I can do that. Any tip in the right direction will be deeply appreciated! Thanks!


Stop spam users from registering without disabling user registration?

My site http://remotejobs.io currently uses a plugin to power the job board and user supplied resumes. The plugin creates users from it's own interface, so there is not typical user creation method on the site. However, lately I've had an overwhelming amount of new user creations from spam bots. I know the difference because I get a new user registration email from these users who I suppose are just hitting the http://remotejobs.io/wp- login.php?action=register page, whereas the interface used by users actually posting a resume or a job doesn't generate this email notification. Is there someway to block the ability for spam bots to create accounts this way without disabling user registration all together? To be clear, no spam is actually ending up on the site because users can only post content through the plugin's interface. But I'd like to prevent a user database filled with spam accounts. EDIT: I'm using the wpjobboard plugin.


How to set path with WP_Filesystem and ftp base / chroot

In my theme i will use the WP_Filesystem to write a file to for example:               $file = get_template_directory().'/library/assets/css/wpless2css.css';      Which outputs something like `/home/user/domain/http_docs/wp- contents/theme/mytheme/library/assets/css/wpless2css.css` This will work unless the ftp user will be chroot to `/home/user/domain/` (on some servers?). In the case of a chroot the WP_Filesystem can't find `$file`. A solution seems to define `FTP_PATH` in wp-config.php into `/home/user/domain/` and use:               if(FTP_BASE) $file =  str_replace(FTP_BASE,'',get_template_directory()).'/library/assets/css/wpless2css.css';      I'm looking for a solution more robust and support for the different possible permissions systems.


Use domain with existing Wordpress install

I have a working, self-hosted Wordpress install residing in my webspace at crypticname.online.de/Mysite/ and acquired a domain, let's say mysite.de. I would like mysite.de to request the home page of crypticname.online.de/Mysite/ and mysite.de/photos/ -> crypticname.online.de/Mysite/photos/ but without actually changing the url in the browser to the cryptic address. The respective pages in the Wordpress codex only explain how to move a site from one location to another but I didn't find a solution to this particular problem. What kind of settings do I need to set in the Wordpress backend and at my domain name provider?


div having different appearances in different themes

I have a shortcode in a plugin that is supposed to display a div. The div can be styled in the settings. The problem is: the div has different appearance in different themes. This obvious is caused by other themes modifying the styles in a generic way that I am not specifically handling. What is the _optimal_ solution such that its appearance remains same through out themes. One obvious one is to override **ALL** possible css properties in the my div related styles. Is there a better way to do that?


my custom_post_type does not appear in my web page...how?

i created a custom_post_type and created a post in there and it does not appear in my web page... how can i call it to where i want? normal post are called like this:               <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<a href="<?php the_permalink() ?>"><?php the_title(); ?>

         <?php the_content(); ?>


Get Posts From A Certain Post Type In An ID Array

I have some post ids in an ID array, like:               $ids = array(20,34,65,126) ;      There is many custom post types in my project, these ids are related to different post types, but I dont know which id is related to which post type in that condition. In another word, I need to do something like this:               $posts = my_get_posts(        'ids' => array(20,34,65,126),        'post_type' => 'product',     ) ;      That function has to be eliminate ids which is not a producy. How to do this?


Add robots.txt to root

I have a new Wordpress 3.5.1 install (hosted on Dreamhost FWIW) that I do **not** want to be indexed by search engines. I would like to serve a simple robots.txt with `Disallow: /` for all user agents. I have checked the "Discourage search engines from indexing this site" box on the Settings > Reading menu, but http://mysite.com/robots.txt still returns a 404. Is there a way to have Wordpress automatically generate and serve an appropriate robots.txt file? If not, what is the best way to configure it to serve my own static robots.txt file?


Adding CSS to Blog Posts?

How do you add CSS code to a certain blog post in WordPress? Would I have to create a new file and keep the CSS code I need for this blog post in that file?


Sort my event calendar by date

I'm currently building an event calendar on WordPress with a custom post type. I'm using custom fields for date, description, etc. Now I want to sort the events by date.. So -->               January 3, 2012     January 10, 2012     Feburary 1, 2012     ....


is_archive for custom tax archive page?

Having trouble getting the achieve page of a custom taxonomy to know its that page. It just shows the detail from the default is_archive blog page... This is what i've tried..               <?php  } elseif ( is_archive() && is_tax() == 'article-area') { get_template_part( 'includes/inc-article' ) ?>      When all its doing is showing the details from this...               <?php  } elseif ( is_archive() ) { get_template_part( 'includes/inc-blog' ) ?>      Any ideas, as i'm stumped? :( Thanks for looking.. :)


I want to know about the plugins that help in while I write code on my Page?

I want to know about the plugins that help me to write the coded blocks. I have tried out two or three but I am not able to know how to get along and put it to use. Please suggest me some good plugins and also how to use it if I need to represent some codes. Yeah I have many different languages that I code in... so the highlighting and other stuffs does matter. Please help.


Set Featured Image not opening - Stuck at loading

I am unable to set featured image for posts/pages. The 'set featured image window' opens but never loads and thumbnails. Then I tried to upload the image using Media, it stucks at crunching. But when I refresh the media page after quire good amount of time, image was uploaded. Things I have tried:   * Disabling all the plugins   * Regenerating thumbnails      * gives me this error `function (){if(h){var d=h.length;!function f(b){n.each(b,function(b,c){var d=n.type(c);"function"===d?a.unique&&k.has(c)||h.push(c):c&&c.length&&"string"!==d&&f(c)})}(arguments),b?e=h.length:c&&(g=d,j(c))}return this}`   * Removed all the images from existing Media Libary   * Manually removed UPLOADS/2014 folder.   * Change to default twentyfourteen theme.   * Asked hosting to reset all file permissions


How can I disable the multisite feature of WordPress 3.0?

I want to use the Google XML Sitemaps plugin and it says: "The plugin will not be active until you disable the multisite mode". I don't need a multisite mode.


Wordpress Custom Query to show posts from last x years

I have found a way to show all posts from the current year with this code:               <?php     $today = getdate();     $lastyear = $today[ 'year' ];     $args = array(          //'nopaging' => true,         'paged' => $paged,         'category' => 1,          'posts_per_page' => 36,         'year' => $lastyear,     );     query_posts( $args ); // The Query ?>              <div id="grid">              <?php while ( have_posts() ) : the_post(); // The Loop ?>             <?php get_template_part( 'article', 'thumb' ); ?>         <?php endwhile; ?>              </div>              <?php get_template_part( 'navigation' ); ?>          <?php wp_reset_query(); // Reset Query ?>      However, what I really want is to show posts from 2 years ago till today (it's Jan 2014), meaning, posts from 2012 and 2013 and 2014. How do I do this? Many thanks in advance.


How to edit widgets in WordPress

In the Appearance -> Widgets menu there is a list of widgets that you can drag and drop to show in the sidebar. Where is the HTML/PHP code for these custom widgets? I've been on WordPress's Function Reference but couldn't find anything. Surely these widgets must be pulled from a HTML/PHP template. The reason I want to know is the widget titles by default are `<h3>` tags and i want to change them to `<h5>` tags. Also i need to add some `<hr />`'s and other things. I've looked in the `theme/includes/widgets.php` file but found nothing. I'm using a copy of Twenty Eleven to modify my theme by the way. The code in `theme/sidebar.php` is for `(!dynamic_sidebar())`, however my sidebar _is_ dynamic so this code is useless.


Getting images from media library and get_the_date() not working

I've got a function to display all images in the media library on a page. I would like to display the date of each image, but using get_the_date() only returns today's date. Here is the code I'm using:               function get_images_from_media_library() {     $args = array(         'post_type' => 'attachment',         'post_mime_type' =>'image',         'post_status' => 'inherit',         'order'    => 'DESC'             );     $query_images = new WP_Query( $args );     $images = array();     foreach ( $query_images->posts as $image) {         $images[]= $image->guid;     }     return $images;         }          function display_images_from_media_library() {          $imgs = get_images_from_media_library();     $html = '
';          foreach($imgs as $img) {              $html .= '';         echo get_the_date('F j, Y');     }          $html .= '
';          return $html;          }      I could someone show me where I'm going wrong?


Preserve shortcode content formatting

How can I preserve the formatting of the content within a shortcode block when I switch back and forth between the visual and text editor in TinyMCE? As in, the stuff between `[myshortcode]` and `[/myshortcode]`. I am using JSON inside the shortcode. I've seen the Switch between Visual and HTML tab freely question and the Preserved HTML Editor Markup plugin. The plugin seems good, but I have hundreds of sites and hundreds of clients who own those sites and I don't want to risk messing up their content with the "Fix it" solutions required by that plugin. Really what I'm asking for seems to be special for the content section of shortcode blocks, so I'm hoping for a solution that's 'lighter' than the Preserved HTML Editor Markup plugin. Here's an example of the 'before', while in **text** mode:               [myshortcode]     {         "map": {             "zoom": 5         }     }     [/myshortcode]      Now here's an example of switching to the **visual** mode:               [myshortcode]     {     "map": {     "zoom": 5     }     }     [/myshortcode]      After that, if you switch back to the **text** mode, you see:               [myshortcode]     {     "map": {     "zoom": 5     }     }     [/myshortcode]


WordPress multisite custom query pagination issue

I have a site with a query to grab by a particular category. The current site is also running a multisite system. Before upgrading to 3.9 this query worked fine, but after updating to wp 3.9 & doing the wp network updates, the pagination no longer works. I have a dev site with the same exact code & data to compare what could be the problem. The only thing I can come up with is that it's a multisite issue. I haven't been able to find anything online (yet) where people are able to reproduce this same problem. If anyone can provide any insight, or have ideas of what is exactly going on with this issue, appreciate it. Here is the query.               $paged = (get_query_var('page')) ? get_query_var('page') : 1;     $args = array(     'category_name' => 'blog',     'posts_per_page' => '8',     'order' => 'DESC',     'paged' => $paged,     'status' => 'publish'     );     $posts = query_posts($args);      Errors being drawn up: > Strict Standards: Declaration of Menu_With_Description::start_el() should be > compatible with Walker_Nav_Menu::start_el(&$output, $item, $depth = 0, $args > = Array, $id = 0) in /home/user/pub/wp- > content/themes/sometheme/functions.php on line 59 > > Strict Standards: Declaration of Hook::call_parent() should be compatible > with Mixin::call_parent($method) in /home/user/pub/wp- > content/themes/photocrati-theme/pope/lib/class.extensibleobject.php on line > 1377 > > Strict Standards: Declaration of C_Component_Factory::define() should be > compatible with C_Component::define($context = false) in /home/user/pub/wp- > content/themes/photocrati-theme/pope/lib/class.component_factory.php on line > 35 > > Strict Standards: Declaration of C_Base_Module::define() should be > compatible with C_Component::define($context = false) in /home/user/pub/wp- > content/themes/photocrati-theme/pope/lib/class.base_module.php on line 184 > > Strict Standards: Declaration of C_Base_Product::define() should be > compatible with C_Base_Module::define($id, $name, $description = '', > $version = '', $uri = '', $author = '', $author_uri = '', $context = false) > in /home/user/pub/wp-content/themes/photocrati- > theme/pope/lib/class.base_product.php on line 36 > > Strict Standards: Declaration of M_Photocrati_GalleryLegacy::define() should > be compatible with C_Base_Module::define($id, $name, $description = '', > $version = '', $uri = '', $author = '', $author_uri = '', $context = false) > in /home/user/pub/wp-content/themes/photocrati-theme/photocrati- > gallery/module.photocrati_gallery_legacy.php on line 33 > > Strict Standards: Declaration of M_Photocrati_ThemeBulk::define() should be > compatible with C_Base_Module::define($id, $name, $description = '', > $version = '', $uri = '', $author = '', $author_uri = '', $context = false) > in /home/user/pub/wp-content/themes/photocrati- > theme/module.photocrati_theme_bulk.php on line 109 > > Strict Standards: Declaration of M_Photocrati_ThemeAdmin::define() should be > compatible with C_Base_Module::define($id, $name, $description = '', > $version = '', $uri = '', $author = '', $author_uri = '', $context = false) > in /home/user/pub/wp-content/themes/photocrati- > theme/admin/module.photocrati_theme_admin.php on line 250 > > Strict Standards: Declaration of P_Photocrati_Theme::define() should be > compatible with C_Base_Product::define($id, $name, $description = '', > $version = '', $uri = '', $author = '', $author_uri = '') in > /home/user/pub/wp-content/themes/photocrati- > theme/products/photocrati_theme/product.photocrati_theme.php on line 47 > > Strict Standards: Declaration of M_AutoUpdate::define() should be compatible > with C_Base_Module::define($id, $name, $description = '', $version = '', > $uri = '', $author = '', $author_uri = '', $context = false) in > /home/user/pub/wp-content/themes/photocrati- > theme/products/photocrati_theme/modules/autoupdate/module.autoupdate.php on > line 788 > > Strict Standards: Declaration of M_AutoUpdate_Admin::define() should be > compatible with C_Base_Module::define($id, $name, $description = '', > $version = '', $uri = '', $author = '', $author_uri = '', $context = false) > in /home/user/pub/wp-content/themes/photocrati- > theme/products/photocrati_theme/modules/autoupdate_admin/module.autoupdate_admin.php > on line 324 > > Notice: wpdb::escape is deprecated since version 3.6! Use wpdb::prepare() or > esc_sql() instead. in /home/user/pub/wp-includes/functions.php on line 3078 > > Strict Standards: Only variables should be passed by reference in > /home/user/pub/wp-content/themes/photocrati-theme/functions/photocrati- > fonts.php on line 42 > > Notice: wpdb::escape is deprecated since version 3.6! Use wpdb::prepare() or > esc_sql() instead. in /home/user/pub/wp-includes/functions.php on line 3078 > > Notice: wpdb::escape is deprecated since version 3.6! Use wpdb::prepare() or > esc_sql() instead. in /home/user/pub/wp-includes/functions.php on line 3078


Simple Redirect but getting the right code?

I need to change these links so the dashboard link directs to the forum profile instead of the wordpress admin panel profile can you help?

<a href="<?php echo home_url() ?>/wp-admin/"><?php _e( 'Dashboard' , 'tie' ) ?>

<a href="<?php echo home_url() ?>/wp-admin/profile.php"><?php _e( 'Your Profile' , 'tie' ) ?>

<a href="<?php echo wp_logout_url(); ?>"><?php _e( 'Logout' , 'tie' ) ?>

      apparently this guy has done it and it works with this code, however i don't know how to change
<a href="<?php echo home_url() ?>/wp-admin/"><?php _e( 'Dashboard' , 'tie' ) ?>
      to               <?php echo bbp_get_user_profile_url( get_current_user_id() ); ?>


Make custom post type column sortable

My site has two custom types: Auction and Lot. Lots are connected to an Auction via the **post_parent** field. I added an Auction column to the Lots list in the admin area.               function theme_lot_custom_columns($columns){         $new = array();         foreach($columns as $key => $value) {             if ($key=='date') {                 // Put the Auction column before the Date column                 $new['auction'] = __('Auction');             }             $new[$key] = $value;         }     return $new;     }     add_filter('manage_lot_posts_columns', 'theme_lot_custom_columns');          function theme_lot_custom_column($column, $post_id) {         if ($column === 'auction'){             $post = get_post($post_id);             if ($post->post_parent) {                 $post_parent = get_post($post->post_parent);                 echo 'ID). '">' . $post_parent->post_title . '';             }         }     }     add_action('manage_lot_posts_custom_column', 'theme_lot_custom_column', 5, 2);      I'd like to make this Auction column sortable alphabetically by the auction title. I thought that adding the following code was enough, but no.               function theme_lot_sortable_columns($columns) {         $columns['auction'] = 'auction';         return $columns;     }        add_filter('manage_edit-lot_sortable_columns', 'theme_lot_sortable_columns');      Any help would be appreciated. Thanks!


Dynamically Generating User Meta Field

I have an online education website using WordPress. I have a custom post type called "course" which is created automatically through the e-learning plugin I am using "WooThemes Sensei". I am still in an early stage but one important aspect I want to track is **users' participation in courses**. For this purpose, I want to automatically be able to create meta-fields for each individual course. Within each field, I want to have 3 radio choices: Did not start, started, and finished. I will then hook the function to another function which is related to the user completing a course to have this meta-field updated. I am not a programmer and certainly don't know if this is something possible. I've searched for weeks and read many online articles on user meta fields but did not find something that looked into how to do this. **So to sum up:** - Custom post type = course. - When I published a course, I want to use course slug to create a new user meta field. But how do I do it once only? I will perhaps try something "if not exist" here? - For each auto- generated meta-field, there are 3 choices: Did not Start, Started, Finished. I tried to be helpful and show that I've done some research on this before posting but I apologize if it's a complete mess! I tried the following code, it outputs the form fine but **it doesn't show the correct saved value, I suspect it has to do with $course_meta_name not working outside the loop** at the top but I am not that good with coding and I haven't found a way to define it properly for $courses pulled. Any help would be appreciated! Any comments are much appreciated with this and hopefully this will be of use to many others.                   function educadme_courses_for_user( $user ) {        $courses_args = array(     'status' => 'approve',     'post_type' => 'course',                 );     $courses = get_posts($courses_args);     $slug = $post->post_name;     $course_meta_name = $slug;     $course_for_user = get_the_author_meta( $course_meta_name, $user->ID);     ?>
<?php _e('الكورسات في الأكاديمية'); ?>
     سجل بالكورسات التي شارك فيها أو أنجزها المشارك.

                                                          <?php                                     foreach($courses as $post) {                                         $slug = $post->post_name;                                          $course_title = $post->post_title;                                                           ?>
                                                                                <label for="<?php echo $slug; ?>">                                              <?php echo $course_title; ?>
                                              <?php echo $slug; ?>                                          	                                     <input type="radio" name="<?php echo $slug; ?>" <?php if ($course_for_user == 'Did not start' OR $course_for_user == '' ) { ?>checked="checked"<?php }?> value="Did not start" />لم يبدأ
                                         <input type="radio" name="<?php echo $slug; ?>" <?php if ($course_for_user == 'Started' ) { ?>checked="checked"<?php }?> value="Started" />بدأ في الكورس
                                         <input type="radio" name="<?php echo $slug; ?>" <?php if ($course_for_user == 'Finished' ) { ?>checked="checked"<?php }?> value="Finished" />إنتهى من الكورس

                                     <?php } ?>

     <?php } ?>               <?php     function save_educadme_courses_for_user( $user_id ) {     if ( !is_super_admin() AND !current_user_can( 'edit_user', $user_id ) )         return FALSE;     update_usermeta( $user_id, $course_meta_name, $_POST[$course_meta_name] );     }                     add_action( 'show_user_profile', 'educadme_courses_for_user' );     add_action( 'edit_user_profile', 'educadme_courses_for_user' );     add_action( 'personal_options_update', 'save_educadme_courses_for_user' );     add_action( 'edit_user_profile_update', 'save_educadme_courses_for_user' );


Fixing my display pending posts

So basically I'm trying to make a list of posts that aren't published yet. (pending) http://streakingpirates.com/mytestpage/ here's my result with the below code so far and as you can see the post titles are showing 3 times per image. Here's my code:
     <?php          echo '
';         $args = array( 'post_status' => 'pending');         $recent_posts = wp_get_recent_posts ( $args );         $thumbnails = get_posts($args,'numberposts=5');         foreach ($thumbnails as $thumbnail) {          echo '
ID ) . '" title="' . esc_attr( $thumbnail->post_title ) . '">';         echo get_the_post_thumbnail($thumbnail->ID, 'thumbnail');          echo '
';          foreach( $recent_posts as $recent ){         echo '
' .   $recent["post_title"].' '. $recent["the_author"].'
';     }          }          echo '
';          ?>
      Pretty much new to php (as of today and minor experiences which were more html related in the past) and just about getting my head around it so any help would be greatly appreciated thanks :) I also have this page http://streakingpirates.com/pending/ but the reason I'm trying to make it different is I want them listed and closely together in the same content div rather than showing the whole article in huge chunks like the following code does               <?php     $args= array(         'post_type' => 'post',          'post_status' => 'pending'     );     query_posts($args);     ?>      but it might have an easier solution


a slider menu is compromised in space

I downloaded a theme from wpexplorer to use for the gallery and right out of the box I see that slider images it falls below post contents. I can adjust the the space thereby pushing the overlapping content down, using height argument. However I notice that the way the slider's navigation arrows and buttons are set up they would not move accordingly. I like to know what is the elegant solution so that everything (the posts bellow and slider's navigation) work around various image sizes like it was intended in the first place. Here is my theme (http://www.manartgallery.com/) and here is the source (http://www.wpexplorer.me/tetris/) This will be a great help to the gallery. Thank you so much.


Using wp_cron with custom time interval and the register activation hook

## Scenario 1: fails Adding a cron task `wp_schedule_event` with a **custom interval** on plugin activation using `register_activation_hook` outside the class definition fails to work because the custom interval is not recognized yet;               register_activation_hook(__FILE__, array('Test', 'test_plugin_activated' ) );     register_deactivation_hook(__FILE__, array('Test', 'test_plugin_deactivated' ) );       add_action('plugins_loaded', array ( Test::get_instance(), 'plugin_setup' ) );           class Test       {              protected static $instance = NULL;              public static function get_instance()         {                  if ( null === self::$instance )             {                 self::$instance = new self;             }             return self::$instance;               }              public function plugin_setup()         {             //init stuff...                 }              public function __construct()          {             add_filter( 'cron_schedules', array($this, 'custom_cron_schedule') );         }              public function custom_cron_schedule( $schedules )          {            $schedules['minute'] = array(             'interval' => 60,              'display' => __( 'Once per minute' )            );            return $schedules;         }               public static function test_plugin_activated()          {             wp_schedule_event( time(), 'minute', 'MINUTE_EVENT') ;         }              public static function test_plugin_deactivated()          {             wp_clear_scheduled_hook( 'MINUTE_EVENT' );         }          }      ## Scenario 2: fails Adding a cron task with `wp_schedule_event` with a **custom interval** on plugin activation using `register_activation_hook` inside the class constructor does work because the call to the `add_filter('cron_schedules', ...);` is also fired in the chain of events.               add_action('plugins_loaded', array ( Test::get_instance(), 'plugin_setup' ) );           class Test       {              protected static $instance = NULL;              public static function get_instance()         {                  if ( null === self::$instance )             {                 self::$instance = new self;             }             return self::$instance;               }              public function plugin_setup()         {             //init stuff...                 }              public function __construct()          {             register_activation_hook(__FILE__, array($this, 'test_plugin_activated' ) );             register_deactivation_hook(__FILE__, array($this, 'test_plugin_deactivated' ) );              add_filter( 'cron_schedules', array($this, 'custom_cron_schedule') );         }              public function custom_cron_schedule( $schedules )          {            $schedules['minute'] = array(             'interval' => 60,              'display' => __( 'Once per minute' )            );            return $schedules;         }               public function test_plugin_activated()          {             wp_schedule_event( time(), 'minute', 'MINUTE_EVENT') ;         }              public function test_plugin_deactivated()          {             wp_clear_scheduled_hook( 'MINUTE_EVENT' );         }          }       ## Question How can I get scenario 1 or 2 to work successfully with a custom time interval. ## Edit: Both scenarios fail with a custom interval time, other than the default inbuilt intervals.


Should I use is_admin() inside 'admin_init' hook callback

I'm adding an action witht he following line: `add_action( 'admin_init', 'fb_init_scripts');` And my function looks like this:                 function fb_init_scripts() {         //Only use these scripts in admin interface         if (is_admin() ) {             wp_enqueue_script('jquery-ui','http://ajax.googleapis.com/ajax/libs/jqueryui/1.7/jquery-ui.min.js',array('jquery'));         }       }      In this instance, is it pointless to use `is_admin()` to controll if I'm in admin panel, since I'm running this function in `admin_init` ?


Unable to show recent custom post types in default recent posts widget

I have a custom post type "books" and there are already 'books' added. However, I am unable to modify `WP_Query` to change Recent Posts widget. I know that there is filter to modify `WP_Query` args:               add_filter( 'widget_posts_args', 'wp130512_recent_posts_args');     function wp130512_recent_posts_args($args) {         $args['post_type'] = array('post', 'books');         return $args;     }      But unfortunately this doesn't work. I have even tried to modify default- widgets.php (just for test) directly and it doesn't show any 'books' (just 'posts'). I even have tried to add this code (just for test) into default-widgets.php, but it shows nothing. If I add the exact code to my front page (front- page.php), then it shows "books".               <?php     $queryObject = new WP_Query( 'post_type=books&posts_per_page=5' );     // The Loop!     if ($queryObject->have_posts()) {         ?>
         <?php         while ($queryObject->have_posts()) {             $queryObject->the_post();             ?>
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>
         <?php         }         ?>

View More
         <?php     }     ?>      So, what is the reason I cannot get custom post types inside this widget? **EDIT** This is how I register custom pos type.               add_action('init', 'init_custom_post_types');     function init_custom_post_types() {     register_post_type('books', array(             'label' => 'Books',             'description' => 'Books',             'public' => true,             'menu_position' => 5,             'menu_icon' => '',             'show_ui' => true,             'show_in_menu' => true,             'capability_type' => 'post',             'map_meta_cap' => true,             'hierarchical' => false,             'rewrite' => array('slug' => 'books', 'with_front' => true),             'query_var' => true,             'supports' => array('title','editor','excerpt','trackbacks','custom-fields','revisions','thumbnail','author','post-formats'),             'has_archive' => true,             'labels' => array (               'name' => 'Books',               'singular_name' => 'Book',               'menu_name' => 'Books',               'add_new' => 'Add Book',               'add_new_item' => 'Add New Book',               'edit' => 'Edit',               'edit_item' => 'Edit Book',               'new_item' => 'New Book',               'view' => 'View Book',               'view_item' => 'View Book',               'search_items' => 'Search Supporters',               'not_found' => 'No Supporters Found',               'not_found_in_trash' => 'No Supporters Found in Trash',               'parent' => 'Parent Book',))          );         ... other custom post types here...        }


WP nav menu + Bootstrap, add role="menu" to UL

For one of my projects I'm trying to add a nav_menu to my WP theme. It should work as a quick menu (sidebar). The only problem remaining: How do I add a **role="menu"** to the **< ul >**?                   <?php             wp_nav_menu( array(                 'menu'              => 'menu',                 'theme_location'    => 'menu',                 'depth'             => 0,                 'container'         => '',                 'menu_class'        => 'dropdown-menu',                 'fallback_cb'       => 'wp_bootstrap_navwalker::fallback',                 'walker'            => new wp_bootstrap_navwalker())             );         ?>        I'm looking for the output `<ul class="dropdown-menu" role="menu">` anyone ?


Different number of posts per row in grid layout

Is there a way to return different number of posts per row in grid layout based on the post size retrieved from a custom field? For example:               |              Large post              |     |   Medium post    |    Medium post    |     | Small post | Small post | Small post |     |   Medium post    |    Medium post    |     |              Large post              |      Rows order can be different. I get the post size value from the custom fields. I believe the logics is as follows:   1. get the size of a post   2. if it fits the row fully, close the row tag, open a new row tag and check the next post    3. if the post doesnt fit the entire row, get the next post size and check if it fits etc. Any practical ideas? Thanks a lot. **EDIT** : I've already studied a lot of code snippets, which are quite simple. However all of them refer to creating the same number of columns by means of $counter variable and modulus, i.e. dividing the loop into two/three/four column layout. I've never seen a snippet allowing different post sizes in the same grid layout. Post size is defined in the custom post field. It can be checked by `get_post_meta($post_id, '_post_size', true);` An example of the grid with different number of posts per row and different post sizes can be seen at Virgin.


How To Activate Plugins via Code?

If possible, how can installed plugins (meaning the files have been placed in wp-content/plugins directory) be activated from other plugins?


Customise the custom menu widget

Is it possible to customise the custom menu widget? All I really want to do is change the text where it says "select a category". Thanks


How to implement time filter to show random post 1 month for one category and 3 months for other categories

I started to work on one website after another developer and there is problem with his "popular widget" which is basically showing 3 random posts from category. There is some Switch statement which is regulating to show from category news 3 random post not older then 1 month and for other categories 3 month. I don't understand what he did there with ['interval'] but when I use wordpress time parameters still I don't have results.               function getSomePost($category,$postsPerPage=3) {             global $post;                  $args = array(                 'category_name'=>$category,                 'posts_per_page'=>$postsPerPage,                 'post_type'=>'post',                 'post_status'=>'publish',                 'post__not_in'=>array($post->ID),                 'orderby'=>'rand',             );                  switch ($category)             {                 case 'news':                     $args['interval'] = '1 MONTH';                     break;                 case 'analysis':                     $args['interval'] = '3 MONTH';                     break;                 case 'reports':                     $args['interval'] = '3 MONTH';                     break;             }                  $query = new WP_Query($args);                  if ( $query->have_posts() ) {                    while ( $query->have_posts() ) {                    $query->the_post();                    $postThumbClass = 'no-thumb';                    ?>                        <div <?php post_class(array('wp-post-entry', 'sidebar-post' )); ?>>                         <?php if(has_post_thumbnail ()):?>                             <?php $postThumbClass = '' ?>
                                 <a href="<?php the_permalink() ?>">                                     <?php the_post_thumbnail(array(70,70)); ?>
                          <?php endif; ?>                                   <div class="wp-post-full-content <?php echo $postThumbClass ?> ">
<a href="<?php the_permalink(); ?>"><?php the_title(); ?>

                    }             }              }      I was trying to replace inside switch               case 'news':                     $args['interval'] = '1 MONTH';                     break;      with               case 'news':         // Create a new filtering function that will add our where clause to the query         function filter_where( $where = '' ) {             // posts in the last 30 days             $where .= " AND post_date > '" . date('Y-m-d', strtotime('-30 days')) . "'";             return $where;         }              add_filter( 'posts_where', 'filter_where' );         $query = new WP_Query( $args );         remove_filter( 'posts_where', 'filter_where' );         break;      and               case 'analysis':                         $args['interval'] = '3 MONTH';                         break;      with               case 'analysis':     // Create a new filtering function that will add our where clause to the query     function filter_where( $where = '' ) {         // posts in the last 30 days         $where .= " AND post_date > '" . date('Y-m-d', strtotime('-90 days')) . "'";         return $where;     }          add_filter( 'posts_where', 'filter_where' );     $query = new WP_Query( $args );     remove_filter( 'posts_where', 'filter_where' );     break;      but it is not working I tried also to use `if ($category == 'news')` but it breaks the site


Borrowing of Previously Translated Strings by Child Plugin

Gist: When writing an extension of a plugin, can the extension "borrow" the translations of the req'd parent plugin by using it's textdomain? Scenario: Let's say that there's a parent plugin, whose translation is up to date, and follows WP standards on the matter. I come along, and write an extension plugin. This extension requires the parent plugin (it will not install without it). Now lets say that there's a string in my plugin that's translated in the parent plugin. Assuming the strings are absolutely identical (case, alpha, etc), can I borrow the translation of that string, which has already been translated by others, from the parent plugin and use it in my extension by simply using the parent plugin's textdomain? like _e('String', 'parentplugin'); What I'd like to do is for several items that have identical, pretranslated strings in the parent plugin, use the parent plugin's translations for them, to reduce the amount of work required by people translating my plugin.


Create custom post on user registration and include custom fields

I am trying to create a custom post when a user registers. I found the solution below very helpful and it basically works. The problem I have is that I also need to set some custom field values when creating the post, and also set some custom taxonomies (basically custom category and tag) when creating the post. I've tried various methods but without joy. My registration form uses S2Member and I am able to query fields included in it - e.g. the custom post that is being created has a title set according to one of the S2 registration fields. The answer that I'm using is at: Create posts on user registration Thanks for any help, Cheers Bob Here's the code from the above answer that I'm using:               function create_new_user_posts($user_id){          $field1 = get_user_field("ws_plugin__s2member_custom_reg_field_reg_field1", $user_id);              if (!$user_id>0)                 return;              // Create post object              $my_bio_post = array(              'post_type' =>  'mycustompostype',              'post_title' =>  $field1,              //'post_content' => 'This is my post.',              'post_status' => 'pending',              'post_author' => $user_id         );              // Insert the post into the database         $bio = wp_insert_post( $my_bio_post );                   //and if you want to store the post ids in          //the user meta then simply use update_user_meta         update_user_meta($user_id,'_reg_listing',$bio);           }           add_action('user_register','create_new_user_posts');


Building a simple "settings" plugin to change textstrings on the home page

I am trying to build a little settings area to change the strings of some text (image urls & links) on the homepage via the dashboard. I have found a useful tutorial which provides the plugin structure (http://wakeusup.com/2011/11/how-to-create-plugin-options-page-in-wordpress/) , but when I try and change the 'key' (not sure if this is the correct term, but it is within the link) it wont display the text, tho when using 'kkpo_quote' as the key it works, I have searched both files and substituted all instances of kkpo_quote for 'exampletext' to no avail. What am I doing wrong? and is it simple to add another key?


Add Image Size for Featured Image with Responsive Design

So, I know that I can make a custom featured-image size by adding this to my functions.php file:               add_image_size('newsize', 883, 300, true);      and calling it with:               the_post_thumbnail('newsize');      But, I also have CSS rules to make images responsive by including:               img { display:block; width:100%; height:auto; }      So, what's happening is, if someone uploads an image that **exceeds** the image size I specified (883x300), then the image is cropped, and when I call it, I get a perfect 883 x 300 image. Unfortunately, if I have an image that is smaller than those dimensions, the function still works as it should (cropping the width or the height if they exceed), but then the image falls short of filling that canvas space (883 pixels.) So for example, if I load an image that is 500x350 in the featured image, normally calling that featured image would output a 500x300 image, but because images are meant to be responsive, CSS stretches that image to be 883 pixels wide, the size of the div. That, in turn, makes the height larger, as it stretches both dimensions. It's imperative that the image height does not exceed 300 pixels. So... how can I have my cake and eat it too? Is there a way I can force a smaller image into a 883x300 canvas before my CSS gets to it to stretch it out? Many thanks, WA


My plugin does not install correctly if a previous version is still installed

My plugin only installs correctly if the user first deactivates and then deletes a previously installed version. If they do not delete the previous version, the installation either does not complete or the plugin, once installed, does not work. Although it would be nice to get at the heart of why this is occurring, it seems like for best user experience anyway the plugin should automatically deactivate and remove previous versions upon installation. Is this possible?


wp_schedule_event in a class

This is my (stripped down) plugin, in OOP:               <?php     /*     Plugin Name: Cron Test     Plugin URI: http://www.mywebsite.com/     Description: Test     Version: 1.0     Requires at least: 3.0     */          class CronTest {       public function __construct() {           if ( !wp_next_scheduled( 'dailyops' ) ) {               wp_schedule_event( time(), 'daily', 'dailyops' );           }           add_action( 'dailyops', array($this, 'do_this_daily') );       }            function do_this_daily() {               // do something every day               error_log('daily');       }     }          $cronTest = new CronTest();      Anyway, it's not working (do_this_daily() is never fired). I tried the same in a non-OOP plugin (not based on a class) and it works flawlessy. How can I make it work here, in a class? EDIT: I replaced the initial portion of the code with a full (still minimal) plugin that can be tested.


Show only oldest post by author

I am working with a heavily customized install of WP. I've set up a specific post type, taxonomy, and roles that gets to use just that post type. Ideally, I'd like to restrict members of that role using that post type to only create one post. This seems like it might be more trouble than it's worth. So barring that, I'd like to display only the oldest of their posts in an archive view. I've got the following, which creates a workable archive loop, but I haven't figured out the "if number of posts > 1 then show only oldest post" bit.                   $args = array         ('post_type' => 'ticketlisting',             'posts_per_page' => 50,             'tax_query' => array             (array                 (                 'taxonomy' => 'tier',                 'field' => 'slug',                 'terms' => 'goldstar'                 )             )         );          $loop = new WP_Query( $args );     while ( $loop->have_posts() ) : $loop->the_post();         the_title();         echo '
';         $post_id = get_the_ID();         /* show post content here */         echo '
';     endwhile;


Geo Sorting Post

I wanna sort all post by GEO Location.Can you provide me an idea on how can I do that. When user submit a post, should I ask for a location as a tag but at the same time I wanna have tags to work as tags. Also Categories needs to be work as category. I am not sure how can I sort them. However, there will be address as a custom field associate to each post. Please guide me to a way to have this done or redirect me to a plugin that works. Regards,


Add class to all list items of wp_nav_menu

I have a `wp_nav_menu` to which I want to add a classes to the list items. I know this can be done by choosing 'css classes' from the screen options menu, but then I have to give every single `li` a class. I have a 2 depth menu. (for example)   * All the normal li's I want to give the class lidepth1   * All the sub menu li's I want to give the class lidept2 Is this possible in the `wp_nav_menu` function? I searched the codex but I only found "link before" and "link after" but I don't think that is what I need.


Wordpress Submitted Content

Whats the best approach to build this site in wordpress:   * 2 custom user levels (students, staff).   * staff use standard wordpress backend, students post from frontend.   * one section of the site has content uploaded by users, (title, content, image).   * frontend post creation (preferably custom post type).   * frontend login and password reminder I've looked at buddypress but it seems too big for what I need. Ideally I want to try and use one plugin for the submission and login, and setup custom post types in functions.php. Any suggestions?


the_content not including blog image URLs

I am using the jQuery Image Lazy Loading Plugin on my WP 3.3.1 blog, however I have found that `the_content` does _not_ include the image URLs, so the `preg_replace` that this function does cannot find any image URLs to replace.               function filter_the_content($content) {             if (is_feed()) {             return $content;         }                return preg_replace_callback('/(<\s*img[^>]+)(src\s*=\s*"[^"]+")([^>]+>)/i', array($this, 'preg_replace_callback'), $content);       }      What I am trying to establish is where does `$content` get passed in by (and why does it not contain the image URLs). `add_filter('the_content', array($this, 'filter_the_content'));` I have found this problem with other WP image lazy loading plugins, so it's not localised to this particular plugin. I am pulling my blog images from this code in `single-blog.php`:               <?php      while(the_repeater_field('blog_images')):                   if(get_sub_field('blog_image_link'))             {                 ?><a href="<?php the_sub_field('blog_image_link'); ?>"><img src="<?php the_sub_field('blog_image'); ?>"/><?php ;             }else {                 ?><img src="<?php the_sub_field('blog_image'); ?>"/><?php ;             }     endwhile;     ?>


Search stores (custom postcode field) within 5, 10, 15 miles of user inputted postcode.. Code modification

I have been searching for a location search solution for wordpress.. The best semi-solution I have found is http://mondaybynoon.com/2010/02/22/store- locator-wordpress-pods The problem being is that I do not want to use Pods and wish to search in the custom fields of a post instead. I have a separate table set up with all UK postcodes + lat, log data.. Here is the function.               function mbn_get_stores_by_location( $postcode, $radius )     {       global $wpdb;       $radius = intval( $radius );            // we first need to get the source coordinates       $sql = "SELECT `latitude`, `longitude` FROM `uk_postcodes` WHERE `postcode` = '$postcode'";       $coords = $wpdb->get_row( $sql );            // now we'll get the other Postcodes within the radius, ordered by distance       $sql = "SELECT uk_postcodes.postcode, ( 3959 * acos( cos( radians( $coords->latitude ) ) * cos( radians( uk_postcodes.latitude ) ) * cos( radians( uk_postcodes.longitude ) - radians( $coords->longitude ) ) + sin( radians( $coords->latitude ) ) * sin( radians( uk_postcodes.latitude ) ) ) )  AS distance FROM uk_postcodes HAVING distance <= $radius OR distance IS NULL ORDER BY distance";            $nearby_postcodes = $wpdb->get_results( $sql );            // we need to store the zips in order to build the Pods query       $target_postcodes = array();       foreach ($nearby_postcodes as $nearby_postcode)       {         array_push($target_postcodes, $nearby_postcode->postcode);       }            // we're going to store the results as we go       $store_results = array();            if( count( $target_postcodes > 0 ) )       {         $final_target_postcodes = implode(',', $target_postcodes);              if( strlen( $final_target_postcodes > 0 ) )         {           // let's snag the data           $stores = new Pod('stores');           $stores->findRecords('id ASC', 9, 't.postcode IN (' . $final_target_postcodes . ')');                $store_data = array();                while ( $stores->fetchRecord() )           {             $store_data['id']       = $stores->get_field('id');             $store_data['name']     = $stores->get_field('name');             $store_data['slug']     = $stores->get_field('slug');             $store_data['address']  = $stores->get_field('address');             $store_data['city']     = $stores->get_field('city');             $store_data['state']    = $stores->get_field('state');             $store_data['postcode']  = $stores->get_field('postcode');                  foreach ($nearby_postcodes as $nearby_postcode)             {               if( $store_data['postcode'] == $nearby_postcode->postcode )               {                 $store_data['distance'] = intval( $nearby_postcode->distance );               }             }                  array_push( $store_results, $store_data );             unset( $store_data );           }                usort( $store_results, "mbn_cmp" );         }            }         return $store_results;     }      I am assuming that I need to change               $stores = new Pod('stores');      $stores->findRecords('id ASC', 9, 't.postcode IN (' . $final_target_postcodes . ')');      to reflect query_posts.. I have tried many variations of               $stores = query_posts('meta_key=post_code&meta_value=' . $final_target_postcodes . '');      with no avail.. Could some one please give me a pointer in the right direction?


ABSPATH not working! Any idea why?

This is what in my wp-config.php :               if ( !defined('ABSPATH') )         define('ABSPATH', dirname(__FILE__) . '/');      I am calling from plugin/pluginName directory to :               require_once( ABSPATH . 'wp-includes/user.php');      But it is returning:               Warning: require_once(ABSPATHwp-includes/user.php) [function.require-once]: failed to open stream: No such file or directory in /home/------/wp-content/plugins/---/---.php on line 43          Fatal error: require_once() [function.require]: Failed opening required 'ABSPATHwp-includes/user.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/------/wp-content/plugins/---/---.php on line 43      Any idea why I am having this error? Any solution? Thanks.


Maintaining synced staging/production WP sites

This is a more general question about WP website best practices. An issue I encounter with many of my clients is maintaining two identical WP installs (staging and production). They insist on seeing changes before they go live. However, with WP's structure, that would involve constantly clearing and re-importing databases in addition to updating theme files. Is there a simple answer out there that would allow me to maintain two identical WP websites with as few headaches as possible? Thank you in advance for your help! Jake


adding custom meta as well as looping through posts

I am grabbing two sets of custom meta and looping through the posts, order goes: custom meta1, posts, custom meta2. but for some reason the second set of custom meta wont show up if I add the posts loop. does custom meta have to be within the loop? it seems to work if there is no loop call. here is what my code looks like:

         <?php if ( get_post_meta($post->ID, 'column1title', true) ) : ?>         <?php echo get_post_meta($post->ID, 'column1title', true) ?>         <?php endif; ?>
       <?php if ( get_post_meta($post->ID, 'column1', true) ) : ?>       <?php echo get_post_meta($post->ID, 'column1', true) ?>       <?php endif; ?>

Latest News
                    <?php     $args = array( 'post_type' => 'post');     $post_query = new WP_Query($args);     if($post_query->have_posts() ) {       while($post_query->have_posts() ) {         $post_query->the_post();     ?>
<a href="<?php echo get_permalink(); ?>"><?php the_title(); ?>

<?php the_content(); ?>
         <?php       }     }     ?>

       <?php if ( get_post_meta($post->ID, 'column3title', true) ) : ?>       <?php echo get_post_meta($post->ID, 'column3title', true) ?>       <?php endif; ?>
       <?php if ( get_post_meta($post->ID, 'column3', true) ) : ?>       <?php echo get_post_meta($post->ID, 'column3', true) ?>       <?php endif; ?>

      it is on a page so I think $post->ID is setting ID to last post hence, not pulling any meta because there is no meta for last post. but not sure how to get around this.


Adding <select> with javascript to admin bar. Works in Chrome/Safari, not Firefox

I'm trying to add a new menu item to the WordPress admin bar. The sub menu item contains a select drop down to switch themes. In Firefox with `href => false` it generated `<a href="">` and when I clicked the select it reloaded the page. I changed it to `<a href="#">`. That fixed the page reload when clicking on the select... but the javascript isn't working. The code itself works just fine in Chrome and Safari on Mac. I haven't tested IE or any browsers on Windows yet. In Firefox on Mac it does nothing. Here's the code generated by the plugin:
         Switch Themes

                                                          <select name="themeswitcher" onchange="location.href=this.options[this.selectedIndex].value;" style="color: #000; text-shadow: none;">                                         <option value="http://themes.fusionized.com?wptheme=Abstract" style="color: #000; text-shadow: none;">Abstract</option>                                         <option value="http://themes.fusionized.com?wptheme=Ambience" style="color: #000; text-shadow: none;">Ambience</option>                                 </select>

      Nothing fancy in the code to generate the admin bar items...               $wp_admin_bar->add_menu( array( 'id' => 'switch_themes', 'title' => __( 'Switch Themes', 'textdomain' ), 'href' => '#' ) );     $wp_admin_bar->add_menu( array( 'parent' => 'switch_themes', 'title' => $theme_switcher->theme_switcher_markup('dropdown'), 'href' => '#' ) );


Looking for plugins that notify users of comment replies

Is there a plugin that will notify users of comment replies? I don't want a email notification but something on the sidebar where a user can click and see what posts have been replied to. Kind of like a subscription thing?


Is there any wordpress plugin to upload images and captions to multiple pages once

Hi I have a couple of pages that need the same images and captions, is there a wordpress plugin that would allow this on 1 upload?


Prevent wordpress from rendering shortcode in post

Suppose I have a `[list]` shortcode. I want to have a post explaining how to use shortcodes (docs for my theme). How can I have a header like > `[list type="arrow"] Shortcode Tag` Currently wordpress will mess it up converting `[list type="arrow"]` into invalid HTML


Create unique robots.txt for every site on multisite-installation

Does anyone know how I can have a unique robots.txt file for every domain served by my wp-multisite-installation? I did a search on plugins but couldn't find anything suitable.


How to disable W3 Total Cache “Performance” menu under multisite?

I came across the following article W3 Total Cache - How to disable “Performance” menu under multisite? However on testing it with the latest version of WordPress 3.7 and W3 Total Cache v0.9.3 it seems to no longer work. How can I update the code from the link above so it works I also have the following code which works it removes the “Performance” from the admin top bar               //Remove Performance     function ds_w3tc_remove_adminbar() {        global $wp_admin_bar;          if ( ! is_super_admin() ) {             $wp_admin_bar->remove_menu('w3tc');         }     }     add_action( 'admin_bar_menu','ds_w3tc_remove_adminbar',999);


adding images to wordpress pagination?

I'm working with a blank theme and my nav.php looks like this

<?php next_posts_link('« Older Entries') ?>

<?php previous_posts_link('Newer Entries »') ?>
      My question is, how do I change the text links into image links?


Creating mulitple loops in a sub-category page

I have a main page that consists of 7 categories being output by wp_list_categories, each li specifically includes one ID. These categories are directed to a category-page.php specifically built for each category. Now, each category has sub categories. So on each of the category pages, I want to build out custom queries for each sub category. Example: the Weightloss category on the main page, links to the category-weightloss.php page. Within Weightloss, there are six sub categories. What is the best way, to create six different queries, in seperate div's, so I can style them? I have looked over WP_Query, but I am not sure of the best, and most appropriate, way to do this.


Removing or Restricting Access to Page Templates for Editor Role

I have a question about restricting access to page templates for blog editors who may create new pages in the future. During my buildout, I had to create specific templates to add custom features for specific pages (i.e. FAQs pulls from a CPT in a separate loop, but allows the editor to add an intro paragraph using the standard "page" post type) Now as I hand off the site, I want to make sure that those templates aren't re-used by the site editors as they are constructing new pages. Is there a way to limit the available page templates by user role? Or is it possible to just remove the "Page Template" dropdown completely? I can use Adminimize (http://wordpress.org/plugins/adminimize/) to remove the dropdown, but the label still remains. Thanks, Devin


Customize Multi-Column Tag Map to fetch specific post-type

I'm using a plugin called "Multi-Column Tag Map" that lets you display all tags that were used and arrange them in a alphabetical order. This plugin works fine in a regular post-type but It's not working on a custom post-type that I created. I created a new post-type called 'books' and has an additional taxonomy(Tags) of 'Writers' and 'Tags'. I followed this to create my custom post type: http://justintadlock.com/archives/2010/04/29/custom-post-types-in-wordpress How do i customize this to fetch my tags from my custom post-type? This is the plugin code: -- code removed, updated version below. **Update:** The purpose of this plugin on my site is to list all tags that we're used for the books. So user can just go to that page and browse articles/books by tags that were used. I also tried Helgatheviking solution, It's similar to the plugin (Multi-Column Tag Map). But I'll just be sticking on customizing the plugin for the meantime as the plugin already provide some formatting. I just need to deal with get_terms(). My current problem is when using Helgatheviking or the Multi-Column Tag Map plugin solution, they're both using get_terms(). and get_terms() only fetch tags that in my posts and not in my custom post-type ('books'). I wanted to fetch tags from my custom post type. So I did a little search and found this get_terms_by_post_type() by Bainternet. I think this is the solution in fetching tags to a certain post- type get_terms(). So this is what I did (code below), Unfortunately I have an error in my foreach(). It said "Warning: Invalid argument supplied for foreach() in mctagmap.php on line 366" **Additional Details:** post-type i'm targeting = 'the_books' taxonomy i'm targeting = 'book_tags', 'book_writers' -- This might sound dumb, but I use 'post_tag' below instead of any of those two because I want to target the two of them. **mctagmap.php** (modified version)               <?php     /*     Plugin Name: Multi-column Tag Map      Plugin URI: http://tugbucket.net/wordpress/wordpress-plugin-multi-column-tag-map/     Description: Multi-column Tag Map displays a columnized  and alphabetical (English) listing of all tags used in your site similar to the index pages of a book.     Version: 8.0     Author: Alan Jackson     Author URI: http://tugbucket.net     */          /*  Copyright 2009-2011  Alan Jackson (alan[at]tugbucket.net)              This program is free software; you can redistribute it and/or modify         it under the terms of the GNU General Public License as published by         the Free Software Foundation; either version 2 of the License, or         (at your option) any later version.              This program is distributed in the hope that it will be useful,         but WITHOUT ANY WARRANTY; without even the implied warranty of         MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         GNU General Public License for more details.              You should have received a copy of the GNU General Public License         along with this program; if not, write to the Free Software         Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA     */               /* get terms limited to post type       @ $taxonomies - (string|array) (required) The taxonomies to retrieve terms from.       @ $args  -  (string|array) all Possible Arguments of get_terms http://codex.wordpress.org/Function_Reference/get_terms      @ $post_type - (string|array) of post types to limit the terms to      @ $fields - (string) What to return (default all) accepts ID,name,all,get_terms.       if you want to use get_terms arguments then $fields must be set to 'get_terms'     */          function get_terms_by_post_type($taxonomies,$args,$post_type,$fields = 'all'){         $args = array(             'post_type' => (array)$post_type,             'posts_per_page' => -1         );         $the_query = new WP_Query( $args );         $terms = array();         while ($the_query->have_posts()){             $the_query->the_post();             $curent_terms = wp_get_object_terms( $post->ID, $taxonomy);             foreach ($curent_terms as $t){               //avoid duplicates                 if (!in_array($t,$terms)){                     $terms[] = $c;                 }             }         }         wp_reset_query();         //return array of term objects         if ($fields == "all")             return $terms;         //return array of term ID's         if ($fields == "ID"){             foreach ($terms as $t){                 $re[] = $t->term_id;             }             return $re;         }         //return array of term names         if ($fields == "name"){             foreach ($terms as $t){                 $re[] = $t->name;             }             return $re;         }         // get terms with get_terms arguments         if ($fields == "get_terms"){             $terms2 = get_terms( $taxonomies, $args );             foreach ($terms as $t){                 if (in_array($t,$terms2)){                     $re[] = $t;                 }             }             return $re;         }     }               function wp_mcTagMap($options='') {              $ns_options = array(                         "columns" => "2",                         "more" => "View More",                         "hide" => "no",                         "num_show" => "5",                         "toggle" => "no",                         "show_empty" => "yes",                        );              if(strpos($options, '|')) {                 $options = explode("|",$options);         } else {         $options = explode("&",$options);         }              foreach ($options as $option) {                  $parts = explode("=",$option);             $options[$parts[0]] = $parts[1];              }              if ($options['columns']) {         $ns_options['columns'] = $options['columns'];         } else {         $options['columns'] = 2;         }              if ($options['more']) {         $ns_options['more'] = htmlentities($options['more'], ENT_QUOTES);         } else {         $options['more'] = "View more";         }              if ($options['hide']) {         $ns_options['hide'] = $options['hide'];         } else {         $options['hide'] = "no";         }              if ($options['num_show']) {         $ns_options['num_show'] = $options['num_show'];         } else {         $options['num_show'] = 5;         }              if ($options['toggle']) {         $ns_options['toggle'] = $options['toggle'];         } else {         $options['toggle'] = "no";         }              if ($options['show_empty']) {         $ns_options['show_empty'] = $options['show_empty'];         } else {         $options['show_empty'] = "yes";         }              $show_empty = $options['show_empty'];         if($show_empty == "yes"){             $show_empty = "0";         }         if($show_empty == "no"){             $show_empty = "1";         }         $list = '
';         $gtargs = array('orderby' => 'count', 'order' => 'ASC',  'hide_empty' => $show_empty);         $terms = get_terms_by_post_type('post_tag',$gtargs,'the_books','get_terms');         $groups = array();                        if( $tags && is_array( $tags ) ) {             foreach( $tags as $tag ) {                 $first_letter = strtoupper( $tag->name[0] );                 $groups[ $first_letter ][] = $tag;             }         if( !empty ( $groups ) ) {               $count = 0;             $howmany = count($groups);                  // this makes 2 columns             if ($options['columns'] == 2){             $firstrow = ceil($howmany * 0.5);             $secondrow = ceil($howmany * 1);             $firstrown1 = ceil(($howmany * 0.5)-1);             $secondrown1 = ceil(($howmany * 1)-0);             }                       //this makes 3 columns             if ($options['columns'] == 3){             $firstrow = ceil($howmany * 0.33);             $secondrow = ceil($howmany * 0.66);             $firstrown1 = ceil(($howmany * 0.33)-1);             $secondrown1 = ceil(($howmany * 0.66)-1);             }                  //this makes 4 columns             if ($options['columns'] == 4){             $firstrow = ceil($howmany * 0.25);             $secondrow = ceil(($howmany * 0.5)+1);             $firstrown1 = ceil(($howmany * 0.25)-1);             $secondrown1 = ceil(($howmany * 0.5)-0);             $thirdrow = ceil(($howmany * 0.75)-0);             $thirdrow1 = ceil(($howmany * 0.75)-1);             }                  //this makes 5 columns             if ($options['columns'] == 5){             $firstrow = ceil($howmany * 0.2);             $firstrown1 = ceil(($howmany * 0.2)-1);             $secondrow = ceil(($howmany * 0.4));             $secondrown1 = ceil(($howmany * 0.4)-1);             $thirdrow = ceil(($howmany * 0.6)-0);             $thirdrow1 = ceil(($howmany * 0.6)-1);             $fourthrow = ceil(($howmany * 0.8)-0);             $fourthrow1 = ceil(($howmany * 0.8)-1);             }                  foreach( $groups as $letter => $tags ) {                  if ($options['columns'] == 2){                 if ($count == 0 || $count == $firstrow || $count ==  $secondrow) {                      if ($count == $firstrow){                     $list .= "\n
\n";                     $list .="\n";                     } else {                     $list .= "\n
\n";                     $list .="\n";                     }                     }                     }                 if ($options['columns'] == 3){                 if ($count == 0 || $count == $firstrow || $count ==  $secondrow) {                      if ($count == $secondrow){                     $list .= "\n
\n";                     $list .="\n";                     } else {                     $list .= "\n
\n";                     $list .="\n";                     }                     }                     }                 if ($options['columns'] == 4){                               if ($count == 0 || $count == $firstrow || $count ==  $secondrow || $count == $thirdrow) {                      if ($count == $thirdrow){                     $list .= "\n
\n";                     $list .="\n";                     } else {                     $list .= "\n
\n";                     $list .="\n";                     }                     }                     }                 if ($options['columns'] == 5){                 if ($count == 0 || $count == $firstrow || $count ==  $secondrow || $count == $thirdrow || $count == $fourthrow ) {                      if ($count == $fourthrow){                     $list .= "\n
\n";                     $list .="\n";                     } else {                     $list .= "\n
\n";                     $list .="\n";                     }                     }                     }              $list .= '
';         $list .="\n";         $list .='
' . apply_filters( 'the_title', $letter ) . '
';         $list .="\n";         $list .= '
';         $list .="\n";                    $i = 0;         foreach( $tags as $tag ) {             $url = attribute_escape( get_tag_link( $tag->term_id ) );             $name = apply_filters( 'the_title', $tag->name );         //  $name = ucfirst($name);             $i++;             $counti = $i;             if ($options['hide'] == "yes"){             $num2show = $options['num_show'];             $num2show1 = ($options['num_show'] +1);             $toggle = ($options['toggle']);                  if ($i != 0 and $i <= $num2show) {                 $list .= '
' . $name . '
';                 $list .="\n";                 }             if ($i > $num2show && $i == $num2show1 && $toggle == "no") {                 $list .=  "
"."".$options['more'].""."
"."\n";                 }             if ($i >= $num2show1){                    $list .= '
' . $name . '
';                    $list .="\n";             }             } else {                 $list .= '
' . $name . '
';                 $list .="\n";             }                 }              if ($options['hide'] == "yes" && $toggle != "no" && $i == $counti && $i > $num2show) {                 $list .=  "
"."".$options['more'].""."".$options['toggle'].""."
"."\n";             }             $list .= '
';         $list .="\n";         $list .= '
';         $list .="\n\n";             if ($options['columns'] == 3 || $options['columns'] == 2){             if ( $count == $firstrown1 || $count == $secondrown1) {                  $list .= "
";                  }                    }             if ($options['columns'] == 4){             if ( $count == $firstrown1 || $count == $secondrown1 || $count == $thirdrow1) {                  $list .= "
";                  }                    }             if ($options['columns'] == 5){                   if ( $count == $firstrown1 || $count == $secondrown1 || $count == $thirdrow1 || $count == $fourthrow1) {                  $list .= "
";                  }                    }                  $count++;                 }              }          $list .="
";         $list .= "

";             }         else $list .= '
Sorry, but no tags were found
';          print $list ;          }     // end long code          // short code begins     function sc_mcTagMap($atts, $content = null) {             extract(shortcode_atts(array(                         "columns" => "2",                         "more" => "View More",                         "hide" => "no",                         "num_show" => "5",                         "toggle" => "no",                         "show_empty" => "yes",                         "name_divider" => "|", // added 09.02.11                         "tag_count" => "no",                         "exclude" => "",                         "descriptions" => "no",                         "width" => "",                         "equal" => "no",             ), $atts));              if($show_empty == "yes"){             $show_empty = "0";         }         if($show_empty == "no"){             $show_empty = "1";         }              if($width){             $tug_width = "style=\"width: ". $width ."px;\"";         }         if($equal == "yes" && $columns != "1"){              $equalize = 'mcEqualize';         }         if($toggle != "no"){             $toggable = "toggleYes";         } else {             $toggable = "toggleNo";         }         $list = '
';         //$tags = get_terms('post_tag', 'order=ASC&hide_empty='.$show_empty.''); // new code!         $gtargs = array('orderby' => 'count', 'order' => 'ASC',  'hide_empty' => $show_empty);         $terms = get_terms_by_post_type('post_tag',$gtargs,'the_books','get_terms');              /* exclude tags */           foreach($tags as $tag){             $fl = mb_substr($tag->name,0,1);             $ll = mb_substr($tag->name,1);             $tag->name = $fl.$ll;             if (preg_match('/(?<=^|[^\p{L}])' . preg_quote($tag->name,'/') . '(?=[^\p{L}]|$)/ui', $exclude)) {                 unset($tag->name);             }         }              $groups = array();         if( $tags && is_array( $tags ) ) {             foreach( $tags as $tag ) {               /* exclude tags */             if(isset($tag->name)){                   // added 09.02.11                 if (strlen(strstr($tag->name, $name_divider))>0) {                     $tag->name = preg_replace("/\s*([\\".$name_divider."])\s*/", "$1", $tag->name);                     $tagParts = explode($name_divider, $tag->name);                     $tag->name = $tagParts[1].', '.$tagParts[0];                 }                      $first_letter = mb_strtoupper( mb_substr($tag->name,0,1) ); /* Thanks to Birgir Erlendsson */                 $groups[ $first_letter ][] = $tag;                 ksort($groups);             }             }         if( !empty ( $groups ) ) {               $count = 0;             $howmany = count($groups);                  // this makes 2 columns             if ($columns == 2){             $firstrow = ceil($howmany * 0.5);             $secondrow = ceil($howmany * 1);             $firstrown1 = ceil(($howmany * 0.5)-1);             $secondrown1 = ceil(($howmany * 1)-0);             }                       //this makes 3 columns             if ($columns == 3){             $firstrow = ceil($howmany * 0.33);             $secondrow = ceil($howmany * 0.66);             $firstrown1 = ceil(($howmany * 0.33)-1);             $secondrown1 = ceil(($howmany * 0.66)-1);             }                  //this makes 4 columns             if ($columns == 4){             $firstrow = ceil($howmany * 0.25);             $secondrow = ceil(($howmany * 0.5)+1);             $firstrown1 = ceil(($howmany * 0.25)-1);             $secondrown1 = ceil(($howmany * 0.5)-0);             $thirdrow = ceil(($howmany * 0.75)-0);             $thirdrow1 = ceil(($howmany * 0.75)-1);             }                  //this makes 5 columns             if ($columns == 5){             $firstrow = ceil($howmany * 0.2);             $firstrown1 = ceil(($howmany * 0.2)-1);             $secondrow = ceil(($howmany * 0.4));             $secondrown1 = ceil(($howmany * 0.4)-1);             $thirdrow = ceil(($howmany * 0.6)-0);             $thirdrow1 = ceil(($howmany * 0.6)-1);             $fourthrow = ceil(($howmany * 0.8)-0);             $fourthrow1 = ceil(($howmany * 0.8)-1);             }                                 foreach( $groups as $letter => $tags ) {                  if ($columns == 2){                 if ($count == 0 || $count == $firstrow || $count ==  $secondrow) {                      if ($count == $firstrow){                     $list .= "\n
\n";                     $list .="\n";                     } else {                     $list .= "\n
\n";                     $list .="\n";                     }                     }                     }                 if ($columns == 3){                 if ($count == 0 || $count == $firstrow || $count ==  $secondrow) {                      if ($count == $secondrow){                     $list .= "\n
\n";                     $list .="\n";                     } else {                     $list .= "\n
\n";                     $list .="\n";                     }                     }                     }                 if ($columns == 4){                              if ($count == 0 || $count == $firstrow || $count ==  $secondrow || $count == $thirdrow) {                      if ($count == $thirdrow){                     $list .= "\n
\n";                     $list .="\n";                     } else {                     $list .= "\n
\n";                     $list .="\n";                     }                     }                     }                 if ($columns == 5){                 if ($count == 0 || $count == $firstrow || $count ==  $secondrow || $count == $thirdrow || $count == $fourthrow ) {                      if ($count == $fourthrow){                     $list .= "\n
\n";                     $list .="\n";                     } else {                     $list .= "\n
\n";                     $list .="\n";                     }                     }                     }              $list .= '
';         $list .="\n";         $list .='
' . apply_filters( 'the_title', $letter ) . '
';         $list .="\n";         $list .= '
';         $list .="\n";                    $i = 0;              uasort( $tags, create_function('$a, $b', 'return strnatcasecmp($a->name, $b->name);') ); // addded 09.02.11              foreach( $tags as $tag ) {             /* exclude tags */             if(isset($tag->name)){             // added 9.28.11             if($tag_count == "yes"){                 $mctagmap_count = ' ('.$tag->count.')';             }                  $url = attribute_escape( get_tag_link( $tag->term_id ) );             $name = apply_filters( 'the_title', $tag->name );             if($descriptions == "yes"){                 $mctagmap_description = '' . $tag->description . '';             }             //$name = ucfirst($name);             $i++;             $counti = $i;             if ($hide == "yes"){             $num2show = $num_show;             $num2show1 = ($num_show +1);             //$toggle = ($options['toggle']);                  if ($i != 0 and $i <= $num2show) {                 $list .= '
' . $name . ''. $mctagmap_count . $mctagmap_description . '
';                 $list .="\n";                 }             if ($i > $num2show && $i == $num2show1 && $toggle == "no") {                 $list .=  "
"."".$more.""."
"."\n";                 }             if ($i >= $num2show1){                    $list .= '
' . $name . '' . $mctagmap_count . $mctagmap_description . '
';                    $list .="\n";             }             } else {                 $list .= '
' . $name . '' . $mctagmap_count . $mctagmap_description . '
';                 $list .="\n";             }                }                 }             if ($hide == "yes" && $toggle != "no" && $i == $counti && $i > $num2show) {                 $list .=  "
"."".$more.""."".$toggle.""."
"."\n";             }                  $list .= '
';         $list .="\n";         $list .= '
';         $list .="\n\n";             if ($columns == 3 || $columns == 2){             if ( $count == $firstrown1 || $count == $secondrown1) {                  $list .= "
";                  }                    }             if ($columns == 4){             if ( $count == $firstrown1 || $count == $secondrown1 || $count == $thirdrow1) {                  $list .= "
";                  }                    }             if ($columns == 5){                  if ( $count == $firstrown1 || $count == $secondrown1 || $count == $thirdrow1 || $count == $fourthrow1) {                  $list .= "
";                  }                    }                  $count++;                 }              }          $list .="
";         $list .= "

";             }         else $list .= '
Sorry, but no tags were found
';          return $list;          }          add_shortcode("mctagmap", "sc_mcTagMap");     // end shortcode                    function mctagmap_donate($links, $file) {     $plugin = plugin_basename(__FILE__);     // create link     if ($file == $plugin) {     return array_merge( $links, array( sprintf( 'Donate to mctagmap development', $plugin, __('Donate') ) ));     }     return $links;     }     add_filter( 'plugin_row_meta', 'mctagmap_donate', 10, 2 );          // the JS and CSS     add_action('wp_head', 'mcTagMapCSSandJS');     function mcTagMapCSSandJS(){     $mctagmapVersionNumber = "8.0";     $mctagmapCSSpath = './wp-content/themes/'.get_template().'/multi-column-tag-map/mctagmap.css';         echo "\n";         if(file_exists($mctagmapCSSpath)){             echo '<link rel="stylesheet" href="'.$mctagmapCSSpath.'?ver='.$mctagmapVersionNumber.'" type="text/css" media="screen" />';         } else {             echo '<link rel="stylesheet" href="'.WP_PLUGIN_URL.'/multi-column-tag-map/mctagmap.css?ver='.$mctagmapVersionNumber.'" type="text/css" media="screen" />';         }         echo "\n";         echo '';         echo "\n\n";     }               // overwrite single_tag_title()     add_filter('single_tag_title', 'mctagmap_single_tag_title', 1, 2);     function mctagmap_single_tag_title($prefix = '') {         global $wp_query;         if ( !is_tag() )             return;              $tag = $wp_query->get_queried_object();              if ( ! $tag )             return;              $my_tag_name = str_replace('|', '', $tag->name);         if ( !empty($my_tag_name) ) {             if ( $display )                 echo $prefix . $my_tag_name;             else                 return $my_tag_name;         }     }          ?>


Redirect to URL if x number of days passed

Let's say I have this URL: **www.example.com/myCPT/post** , here I want to check if 3 days has passed since the post was created to redirect to **www.example.com/myCPT/post/stats**. In this 3 days time frame the user should not be able to access **www.example.com/myCPT/post/stats**. But this needs to be dynamic, every time a post is created to check for it's URL and add a 3 days time till this URL will be accessible **www.example.com/myCPT/post/stats** For example I will have post1, post2, post3 and so on and every time the post will be created to add a 3 days time frame till the **"/post/stats"** will be available. Also I need the same for **"/post/comments"** : this address should be available after 3 days, and if someone try to access before should be redirected to post url: **"/post"** I did some research and I found this:   * `wp_redirect( $location, $status );` for redirection   * `<?php echo get_the_date(); ?>` and `<?php echo get_the_time(); ?>` for gettin the date/time of the post  Found a snippet which might be helpful :               if ( time() - strtotime( $posts[0]->post_date_gmt ) > ( 30 * 24 * 60 * 60 ) ) {         // DO SOMETHING      }     return $posts;     }      Later Edit : The `"/stats"` and `"/comments"` endpoints are built like this :               function wpa121567_rewrite_endpoints(){            add_rewrite_endpoint( 'stats', EP_PERMALINK );          }          add_action( 'init', 'wpa121567_rewrite_endpoints' );      Any suggestions on how can I achieve this?


I'm using `admin_footer-{$hook_suffix}` to selectively print scripts on the new post page and comments page. This hook is depreciated in 3.1. I see there's an `admin_print_scripts-{$hook_suffix}` but this does not print to the footer, rather to the header before any jQuery or other stuff is loaded. How can I selectively print scripts to the footer of certain admin pages?


Built in audio player?

I was certain that WordPress had built in a basic audio player. Am I mistaken. I cant find any evidence of one anywhere, just plugins ?


Changing the "Plugin Activated" Message Default

Whenever an administrator in WordPress activates a plugin, upon the reload of the plugin page, a notice will appear upon successful activation reporting "Plugin Activated". ![Screenshot of Plugin Activated message](http://i.stack.imgur.com/Ux1kg.png) Is there a way to change this text that appears inside the admin notice, or must I use my own custom message? Additionally, if I must use a custom message, will this suppress the default "Plugin Activated" message? **Related Questions:**   * Uninstall, Activate, Deactivate a plugin: typical features & how-to   * How to show custom message once on plugin activation?   * What's the point on gettext syntax? **Duplicate:** Thanks to Pieter for the find:   * How to Remove the Default "Plugin Activated" in WordPress" **Additional Resources:**   * gettext() Function > # **Note** > > Rememember that although 'gettext' filter is only applied during calls to > the `translate()` function, `translate()` is used by virtually all other > i18n functions in _i18n.php_. These include all of the functions listed here > in this post on "Gettext Syntax".


Headers already sent in Pluggable.php / homepage and wp-login error

After migrating site to another account on same host, I started to receives strange errors. Firstly I encountered an error where at the login page I was asked to turn on Cookies. And after I deleted that part of the file in wp- login.php (I turned off that test cookie wp is setting when user is wp login screen). Nowm when I visit my site without www, so just domainname.com, and when I visit wp-login.php and try to log in, I get a Headers already sent error, for file pluggable.php on line 897 I tried all standard solutions including:   * Downgrading Wordpress    * Reseting plugins folder    * Checked if my files are started and ended regulary with    * Checking sites URL in phpMyAdmin, reseting permalink structure  My sites on two accounts have _exact same files, dbs and settings_ I have properly done the migration itself, and changed the links in the database. Both of the sites are on new server, that has exact same configuration :) Any ideas? Thanks in advance


How to display page content in a page template?

In my WordPress site, I made a custom page template, which contained a custom query [using `WP_Query()`]. With that query, I can perfectly get the posts of a certain category. But I want to show the page contents along with the queried posts. Thing will be like:   --------------------------- ## Page Heading page contents   ### Queried Post Heading queried post contents   ---------------------------   * What can I do?


TwentyTwelve versioning

I'm making a child theme for TwentyTwelve, but my host is caching my files, so I'm not seeing the changes I do to my style.css file. Is there a way to version the stylesheet for my child theme? How is TwentyTwelve even adding the stylesheet? I don't see it in header.php. Thanks


Get the label from ACF checkbox

I feel like this should be easy but for some reason I can't get this to work? I have several similar but distinct colors in list of products. I need to be able to grap the label to show to the end user (so they see orange instead of m_orange) but I also need the value to be distinct so I can apply the appropriate class to the element. orange : orange   m_orange : orange   purple : purple   m_purple : purple   w_purple : purple My code:               <?php while ( $the_query->have_posts() ) : $the_query->the_post();     $color = get_field('color');     ?>          <?php foreach($color as $color_list){echo "
$color_list  /
";}?>             <?php foreach($color as $color_class){echo "

" ;}?>      I tried to follow instructions at http://www.advancedcustomfields.com/resources/field-types/checkbox/ but it hasn't worked and I can't seem to figure this out?


Adding 'active' class to custom taxonomies using walker in functions.php

I'm trying to use the following code in functions.php in order to show a menu with categories (custom taxonomies actually). I simply want it to show active when on the current page. What am I doing wrong? I also see that the `$category = get_category($mycatid);` line doesn't populate the `$category` variable.               <?php     class walker_archives extends Walker_Nav_Menu     {         public function start_el( &$output, $item, $depth, $args )         {             $attributes  = '';                  ! empty ( $item->attr_title )                 and $item->attr_title !== $item->title                 and $attributes .= ' title="' . esc_attr( $item->attr_title ) .'"';                  ! empty ( $item->url )                 and $attributes .= 'href="' . esc_attr( $item->url ) .'"';                  $attributes  = trim( $attributes );             $title       = apply_filters( 'the_title', $item->title, $item->ID );             $item_output = "$args->before$args->link_before$title"                             . "$args->link_after$args->after";                  $mycatid = $item->object_id;             $category = get_category($mycatid);             $mycatslug = $category->slug;             $classes = empty( $item->classes ) ? array() : (array) $item->classes;             $class_names .= in_array("current_page_item",$item->classes) ? ' active' : '';             $class_names = ' class="staysexy'. esc_attr( $class_names );             $output .= $indent . '
ID . '" class="genre-'. $mycatslug . '">';             $output .= apply_filters(                 'walker_nav_menu_start_el'                 ,   $item_output                 ,   $item                 ,   $depth                 ,   $args             );         }         public function start_lvl( &$output )         {             $output .= '
';         }         public function end_lvl( &$output )         {             $output .= '
';         }         function end_el( &$output )         {             $output .= '
';         }     }?>


Media Popup filter results by custom media Category

i'm using the wp.media for Media Uploader Popup http://mikejolley.com/2012/12/using-the-new-wordpress-3-5-media-uploader-in- plugins/ I created a new category called 'media-category' for the Media Library, i would like to filter the results by this new category. This is my current code:                 custom_uploader = wp.media.frames.file_frame = wp.media({           title: 'Choose Media',           button: {             text: 'Choose Media'           },           multiple: true,           library: {               type: 'video/mp4'                }       });      Thanks a lot for help.


Can't save Wordpress post with "/etc/" in it

In my self-hosted Wordpress site, if I create a post with "/etc/" (without quotes) in it anywhere, I get a 404 Not Found when I save the post. Wrap it in tags, or even escaping the characters (/etc/) doesn't work. I've tried disabling all my plugins, but that doesn't make a difference. Any pointers will be greatly appreciated.


Only User Upload image Http Error

I've search all over and tried a bunch of things. Basically, as admin I can use the featured image and upload with no issues. When i switch roles I cannot upload images, i get an HTTP error.   * I did set the upload_files & unfiltered_upload   * I did reduce the size of the image   * I double checked file permissions   * Host says it's wordpress not the server Anyone have any idea what this could be?


Keeping social share count after changing Wordpress Permalinks

I am going to change wordpress permalinks and will do 301 redirect from old to new URL's. But the problem is how can i keep my social sharing counts (like facebook,twitter, google +1) after the URL's are changed. Thanks


Using Shortcode to Grab Archive Listing, Separate by Year

Here's code I've modified to display an archive list of every month I've posted news. Each month of course links to the archive for that month. I can then include the shortcode wherever I like.               function my_archives($params, $content = null) {          extract(shortcode_atts(array(     'type' => 'style1'     ), $params));          ob_start();     ?>          <?php wp_get_archives( array( 'type' => 'monthly' ) ); ?>               <?php return ob_get_clean();     }     add_shortcode('archives','my_archives');      However, I just cannot figure out from reading the wp_get_archives page (http://codex.wordpress.org/Function_Reference/wp_get_archives) how to organize the list of months with, say, a year heading. So right now the above code outputs like this:
June 2014

May 2014

April 2014
     etc. etc. etc. for every year and month (my website has been up for 11 years, so that's over 100 links in one blob of a list).      I was wondering if it is even possible to change the list to something like this instead:               2014

June 2014

May 2014
     etc.
     2013

December 2014

November 2014
     etc.
      Thank you!


My theme is not showing up on any other computers

I have Wordpress installed to mydomain.org/blog, and everything works fine and dandy from my computer (localhost). However, when I connect to the blog from another computer, the theme (Twenty Twelve) disappears and it's all plaintext. I have not tried to install any other themes. Help? Edit: URL upon request is http://boj.cc/blog


Is it possible to add short code and html tag in Category Description?

I want to add a shortcode (like slider) and html tag like `<h2>\-------- text -----</h2>`. Is that possible? I have already tried but is not really working. Only normal text is showing, no short code or html tag even. Any idea how or not possible? i want to use this for own theme. i have one product page. but many category (like 7) and each category will have different slideshow banner. and under there product picture and details. i don't want make each category page separately, i can show shortcode from category description then i can it will be work for me. my shortcode will be `[rev_slider slider]` category page code                <?php if ( category_description() ) :  ?>
<?php echo wpautop( term_description() ); ?>
       <?php endif; ?>      function page               remove_filter( 'pre_term_description', 'wp_filter_kses' );


Where is the best place to use add_filter

Should I use the function `add_filter` In my plugin's `init` action hook or just the in the main plugin script? Since sometimes I found people is using filter all over the place and if I put in the `init` hook, it would be too late for some case. Are there any general advice on the precedence of `action` & `filter` hook so we can have a more consistent code style?


send information from the thickbox image uploader second tab

in this question i've found how to create a custom tab at the image uploader. this is the code:               add_filter('media_upload_tabs', 'my_media_upload_tabs_filter');          function my_media_upload_tabs_filter($tabs) {             unset($tabs["type_url"]);             unset($tabs['library']);             $newtab = array('ell_insert_gmap_tab' => __('Google Map','insertgmap'));                  return array_merge($tabs,$newtab);     }          add_action('media_upload_ell_insert_gmap_tab', 'media_upload_ell_gmap_tab');          function media_upload_ell_gmap_tab() {         return wp_iframe('media_upload_ell_gmap_form', $errors );     }          function media_upload_ell_gmap_form() {         ?>         echo media_upload_header();         ?>
HTML Form
          <?php     }        Now i want to use that tab for image choosing function. so i modified the code inside the tab into this:                 <form enctype="multipart/form-data" method="post" action="">
Choose Background:
                 Alternatively, you can choose one of these background images:
                 <img style="float:left; margin:15px; cursor:pointer" id="background-Green-stripes" src="<?php bloginfo('url'); ?>/wp-content/themes/mytheme/images/background-Green-stripes-thumb.jpg">     choose this                 <img style="float:left; margin:15px; cursor:pointer" id="background-Pail-pink-squares.jpg" src="<?php bloginfo('url'); ?>/wp-content/themes/mytheme/images/background-Pail-pink-squares-thumb.jpg">     choose this                 <img style="float:left; margin:15px; cursor:pointer" id="background-Purple-wall.jpg" src="<?php bloginfo('url'); ?>/wp-content/themes/mytheme/images/background-Purple-wall-thumb.jpg">         choose this             </form>       and tried to get the html from the "window.send_to_editor" but didn't knew how... can any body help? i'm lost here...