Dynamically Create Terms in Taxonomy when Custom Post Type is Published. Almost There!

You’re almost there – the problem is you’re trying to access the $post object when the function only receives the post ID. add_action( ‘publish_country’, ‘add_country_term’ ); function add_country_term( $post_ID ) { $post = get_post( $post_ID ); // get post object wp_insert_term( $post->post_title, ‘country_taxo’ ); }

Too much recursion error when chosing image from image library for two different meta boxes in one post

I think you’re running into a problem people mentioned in the comments to that story. Someone else posted about it here: http://www.theenglishguy.co.uk/2010/01/24/multiple-media-uploads-in-wordpress-functions-php/ Basically, the JavaScript from that site should be modified to be more like this: jQuery(document).ready(function() { var formlabel = 0; var old_send_to_editor = window.send_to_editor; var old_tb_remove = window.tb_remove; jQuery(‘.upload_image_button’).click(function(){ formlabel = jQuery(this).parent(); tb_show(”, … Read more

Include custom post types in categories widget

I have an ‘actor’ cpt and it seems to automatically get added to the query: SELECT object_id, term_taxonomy_id FROM wp_term_relationships INNER JOIN wp_posts ON object_id = ID WHERE term_taxonomy_id IN (38,40,30,11,32,34,29,39,35,9,31,19,33,37,42,41,27,25,36,1,26) AND post_type IN (‘post’, ‘actor’) AND post_status=”publish” Call from: require, require_once, include, get_sidebar, get_template_part, locate_template, load_template, require, dynamic_sidebar, call_user_func_array, WP_Widget->display_callback, WP_Widget_Categories->widget, wp_list_categories, get_categories, get_terms, … Read more

List taxonomies with thumbnails

How to get the data back When you look at your code, then you got get_option( “taxonomy_{$t_id}” ) in it, which actually calls the value from the DB options table. So you should simply replace the $t_id with your actual term id. The term ID can be retrieved via get_query_var( ‘tag_id’ ) for Tags on … Read more

How would I leverage custom Taxonomies in this scenario?

First I would create a new custom post type called Trips. Add this to your theme’s functions.php //trips Custom Post Type add_action( ‘init’, ‘create_trips_post_type’ ); function create_trips_post_type() { register_post_type( ‘trips’, array( ‘labels’ => array( ‘name’ => __( ‘Trips’ ), ‘singular_name’ => __( ‘Trips’ ) ), ‘public’ => true, ‘has_archive’ => true, ‘hierarchical’ => true, ‘supports’ … Read more