Custom field drop down to set the term of the post when published
Access your post data as a real array: $_POST[‘magicfields’][‘shop_artist’][1][1]. Do a var_dump($_POST) if in doubt.
Access your post data as a real array: $_POST[‘magicfields’][‘shop_artist’][1][1]. Do a var_dump($_POST) if in doubt.
do you know where is your code fails? Is the hook runs properly? One thing for sure, term_exists() returns the ID not an object. Also $wpdb is not needed at all. wp_delete_term($theterm, ‘byartist’);
get_categories() does not require parameters, by default it will query the post type post and the taxonomy category. However, get_terms() require a taxonomy parameter. Also, in the second function, you wrote: $categories = get_terms(); It should have been $terms = get_terms(‘your_taxonomy’);
I would create custom post meta for this data, as it seems the most logical. It should be easy to implement, since you don’t need to expose this custom meta data to the UI; just add a callback to save_post. You can use wp_get_theme() to retrieve information about the current Theme. This function returns an … Read more
I doubt you’re going to find a function that created the exact output you’re using, so you’re probably looking at two nested called to get_terms(). I usually avoid most other taxonomy-related plugins in favor of get terms. Most of the other functions are wrappers for this one. Here’s some psuedo-code for what I’d do: <?php … Read more
I managed to fix this $labels undefined by writing the following work around. Its custom to how I wanted it to work but it may give others a pointer of how to get it to work for them. It occurs when WordPress could use two types to serve its page and gets confused. Say if … Read more
If you mean to add the description of the term as a title attribute which will show on hover then you can “fork” get_the_term_list function to a version that would add the title attribute, something like this should work: function get_terms_with_desc( $id = 0 , $taxonomy = ‘post_tag’, $before=””, $sep = ”, $after=”” ){ $terms … Read more
get_the_term_list & url
It depends a bit on what are your exact status slug and title and page title are, but something like this should work, if I understand you correctly: $page = get_page_by_title($status->name.” tickets”); echo ‘<li><a href=”‘.get_permalink($page->ID).'”>’ .$status->name.’ (<span>’.$counts[$status->slug].'</span>)</a></li>’;
Got the answer, encase anyone else needs it, here it is. <?php $currauthor_id = get_the_author_meta(‘ID’); $terms = get_terms(‘your_taxonomy’, array( ‘orderby’ => ‘name’, ‘order’ => ‘ASC’, ‘hide_empty’ => 1, ) ); foreach ( $terms as $term ) { $myquery = new WP_Query( array( ‘author’ => $currauthor_id, ‘post_type’ => ‘post_type_name’, ‘your_taxonomy’ => $term->slug, ‘posts_per_page’ = > -1, … Read more