Custom Post Status Posts viewable to the public

I have been looking to do something like that with EditFlow, where a custom status will determine if the post shows up on the homepage via a get_posts() query. $promoted_posts = get_posts( array( ‘post_status’ => ‘promoted’ ) ); That works, but it looks like I’ll need to filter the WP Query on the single page … Read more

Change existing label in the admin bar with something else

Found my answer including my full solution: <?php /* Plugin Name: Rename Posts to News Description: Rename built in posts to be called News Version: 1.0 Author: Scott Cariss @ Philosophy Design Author URI: http://www.philosophydesign.com */ // Not a WordPress context? Stop. ! defined( ‘ABSPATH’ ) and exit; add_action( ‘init’, array ( ‘chg_Posts_to_News’, ‘init’ ) … Read more

deleting terms programmatically

You can use below to assign all posts to another term during deletion mentioned on same page.. “The $args ‘force_default’ will force the term supplied as default to be assigned even if the object was not going to be termless.” Other wise if there was only one term attached with post, post becomes term less.

add image map script to post

The post content is filtered by kses, but you can extend the list of allowed tags. A search in the plugin directory for kses shows some useful results. Try Extend KSES, it seems to be exactly what you need (I haven’t tested it): This plugin extends the HTML functionalify of the WordPress kses.php file, which … Read more

Different amount of posts on homepage than paged pages

You should use the pre_get_posts filter. You can exclude the homepage with ! is_front_page or ! is_home depending on your configuration. /** * Changes the number of posts per page if not is_home * * @author SFNdesign, Curtis McHale */ function wptt_change_posts_on_page( $query ) { if ( ! is_home() && $query->is_main_query() ) { $query->set( ‘posts_per_page’, … Read more

Remove post_tag from default post type, add custom taxonomy

to completely remove post tags: https://stackoverflow.com/a/8363082 if you want to remove post tags from posts, but keep on other custom post types: add_action( ‘init’, ‘my_register_post_tags’ ); function my_register_post_tags() { register_taxonomy( ‘post_tag’, array( ‘my_post_type_here’ ) ); } to add your own custom taxonomy to posts, use register_taxonomy, setting the $object_type parameter to post.

custom single.php not working

Read Template Hierarchy article in the codex, especially pay attention to Single Post Display part. As you can see you have only three options: single-{post_type}.php single.php index.php It means that you can’t create a template for posts related to blog category. So you shouldn’t use single-blog.php template, use single.php instead and add there something like … Read more

How can I display a specific user’s first published post?

The following query retrieves the oldest post of a specified user/author: $user_id = 42; // or whatever it is $args = array( ‘posts_per_page’ => 1, ‘post_status’ => ‘publish’, ‘author’ => $user_id, ‘orderby’ => ‘date’, ‘order’ => ‘ASC’, ); $first_post = new WP_Query($args); if ($first_post->have_posts()) { $first_post->the_post(); // Now you can use `the_title();` etc. wp_reset_postdata(); } … Read more