Remove All, Published and Trashed Post Views in Custom Post Type

Further down on the page you linked to is this comment: Similar views can be edited by hooking into ‘views_’ . $screen->id where $screen is the global $current_screen (or get_current_screen()). Draft, Pending, Mine and Sticky could all be removed in a similar manner. When you’re editing a post, you’re on the “edit-post” screen, so the … Read more

Get post id in wordpress action?

I haven’t tested so I’m providing you with two possibilities, Inside a loop, use the following: $post_id = get_the_ID(); Outside a loop, use the following: global $wp_query; $post_id = $wp_query->post->ID; Or: global $post; $post_id = $post->ID Or you can pass the post ID in a function, much like function my_function($post_id){ // code }

Filter Posts By Tag

here you go, The following returns all posts that belong to category 1 and are tagged “apples” query_posts( ‘cat=1&tag=apples’ ); Add this inside the page before the loop change ‘1’ and ‘apples’ to whatever category and tag you want. If you must use query_posts(), make sure you call wp_reset_query() after you’re done. look here for … Read more

Define a name to the posts slug

Set your permalink structure to custom and use: /post/%postname%/ Then when registering your custom post types use something like this: ‘rewrite’ => array( ‘slug’ => ‘something’, ‘with_front’ => false ), Using with_front set to false will make sure that your new custom post types don’t share the /post/ part of your permalink structure

Latest 5 posts (custom post type), each post different CSS

First setup a WP_Query to fetch the latest 5 posts from your custom post type “apps”. You also need to update a “counter” for each post in the loop. Then simply echo the count in the class for the div. <?php //Query posts $query = new WP_Query(array( ‘post_type’ => ‘apps’, ‘posts_per_page’ => 5 )); //Reset … Read more

Blogroll – Different layout for first post

Creating 2 queries for your scope is absolutely an not need work… Use only one query and use the $wp_query->current_post property to change the output of first post.. $args = array ( ‘pagination’ => true, ‘paged’ => $paged, ‘posts_per_page’ => ’10’, ‘ignore_sticky_posts’ => true, ‘order’ => ‘DESC’, ‘orderby’ => ‘date’, ); // The Query $query … Read more