Disable sticky option for specific categories

I ended up going with another approach. I check to see what the current user’s role is, then if the role is ‘author’, enqueued a CSS file to hide the sticky option’s checkbox. In the theme’s functions.php file: function hide_sticky_option($hook) { global $current_user; if(‘post.php’== $hook || ‘post-new.php’==$hook){ $role = array_shift($current_user->roles); //get role of current user … Read more

Query Posts With Over 1000 Views

This should work, but I didn’t have the time to test it. $query = new WP_Query( array( ‘meta_key’ => ‘_hit-counter’, ‘meta_value’ => ‘1000’, ‘meta_compare’ => ‘>=’, ‘orderby’ => ‘date’ ) );

Customizing Comments on Posts

Set per_page to 5 and page to 1 in wp_list_comments http://codex.wordpress.org/Function_Reference/wp_list_comments Then add your read more link just below your comments to reload the page with per_page and page not set. You can do this with AJAX for smoothness.

WordPress Automatic Filename Changer

The add_attachment action is called after the attachment has been named. If you only want to change the name of the attachment (and the slug), you don’t need to change the name of the file and can just replace the code inside rename_attachment with a call to wp_update_post. add_action(‘add_attachment’, ‘rename_attacment’); function rename_attacment($post_ID){ $new_attachment_name = array( … Read more

Set Default Category to Username

The default category is stored in the options table under option named default_category , so you can do something like this: add_action(‘admin_init’,’set_user_default_cat_wpa89057′); function set_user_default_cat_wpa89057(){ global $current_user; if ( isset($current_user) ) { update_option( ‘default_category’, $current_user->user_login); } }

Blog posts not displaying

From the “Settings” menu in the wordpress admin panel Select the “Reading” options and select your blog page for “Posts Page” from the dropdown beside it, see the screenshot here http://d.pr/i/h4nV Hope it will help