Custom post type and body_class: Remove “blog” class

You can use body_class filter to check if you are on your custom post type, and if so then just remove the blog class like this: function remove_blog_from_cpt_classes($classes, $class){ global $post; if ($post->post_type != “products”){ return $classes; }else{ foreach($classes as &$str){ if(strpos($str, “blog”) > -1){ $str = “”; } } } return $classes; } add_filter(“body_class”, … Read more

How to create new category for custom post type?

You could create a taxonomy called Job Types and your terms would be PHP Jobs etc. In your register post type function change: ‘taxonomies’ => array( ‘post_tag’, “category”), to ‘taxonomies’ => array(‘job_types’), add_action(‘init’ , ‘c3m_job_taxonomis’ ); function c3m_job_taxonomies() { $labels = array( ‘name’ => _x( ‘Job Types’, ‘taxonomy general name’ ), ‘singular_name’ => _x( ‘Job … Read more

How Can I Set the Post Author of a Post I Just Created With PHP?

If you know the ID of the author you can use wp_insert_post specifying the ID and the author ID to it. $id = $post->ID; // change this to whathever $user_id = ‘4’; // change this too $the_post = array(); $the_post[‘ID’] = $id; $the_post[‘post_author’] = $user_id; wp_insert_post( $the_post ); The trick is to specify the ID … Read more

Add TinyMCE to CPT metaboxes in 3.1?

Use this class: http://www.deluxeblogtips.com/p/meta-box-script-for-wordpress.html and then call the metabox like this (don’t forget to read the manual and view some examples): $meta_boxes[] = array( ‘id’ => ‘textmetabox’, ‘title’ => ‘Your Meta Box Title’, ‘pages’ => array(‘post’, ‘slider’, ‘whatever-your-cpt-is’), ‘fields’ => array( array( ‘name’ => ‘Your thoughts about Deluxe Blog Tips’, ‘id’ => $prefix . ‘thoughts’, … Read more

how can i get posts from custom post type particular taxonomy category

If you read http://codex.wordpress.org/Class_Reference/WP_Query#Taxonomy_Parameters in detail it outlines everything you need. Take a look at the following code sample taken from the codex. It should help you 🙂 $args = array( ‘post_type’ => ‘Article’, /* This is where you should put your Post Type */ ‘tax_query’ => array( array( ‘taxonomy’ => ‘people’, ‘field’ => ‘slug’, … Read more