Custom Post Types and Categories?

It appears that although register_post_type() will add the new post_type immediately, it seems as though you need to bind up the logic into a function, and add it to the init action for the categories taxonomy to be associated with the post_type. A working example follows: function add_articles_post_type() { register_post_type(“article”, array( ‘label’ => ‘Article’, ‘public’ … Read more

How would I create a shortcode to display a custom post within a page or regular post?

There are great tutorials about shortcodes all over the web and some good examples here but just to get you started: add_shortcode(‘film_q’, ‘film_shortcode_query’); function film_shortcode_query($atts, $content){ extract(shortcode_atts(array( // a few default values ‘posts_per_page’ => ‘1’, ‘post_type’ => ‘film’, ‘caller_get_posts’ => 1) , $atts)); global $post; $posts = new WP_Query($atts); $output=””; if ($posts->have_posts()) while ($posts->have_posts()): $posts->the_post(); … Read more

Getting a thumbnail for an external video as the thumbnail for a custom post type?

You can use the Blip TV API: http://wiki.blip.tv/index.php/Blip.tv_API Look for “How do I find the thumbnail for an item?” Examples of the API can be found in the wiki e.g. the PHP Example: include_once(“blipPHP.php”); $blipPHP = new blipPHP(“username”, “password”); $respond = $blipPHP->info(4794325); returns a LONG array. Inside this you find: [3] => SimpleXMLElement Object ( … Read more

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

Programmmatically adding a Custom Post

you need to specify the post_type in your $data array : $data = array( ‘post_type’ => ‘classifieds’, ‘post_content’ => stripslashes($output), ‘post_title’ => stripslashes($title), ‘post_date’ => date(‘Y-m-d H:i:s’), ‘post_category’ => array($cat_ID), ‘post_status’ => $statusPost, ‘post_author’ => $post_author );

Exclude specific taxonomy term when using wp_get_post_terms

I’d use wp_list_filter() with the operator ‘NOT’ to compare either the term’s name, slug or ID (depending how you want to test for term to be exluded). Untested but something like this should work (assuming that you want to exclude the term with slug ‘myslug’): $terms = wp_get_post_terms( $post->ID, ‘wedding_cat’); $terms = wp_list_filter($terms, array(‘slug’=>’myslug’),’NOT’); (Of … Read more