How to make a metabox that contains link categories?

Found the last bit. It was just a syntax error: <?php selected( $selected, “.$term_id”. ); ?> Should be… <?php selected( $selected, $term_id ); ?> Entire Function: function tf_book_deets_create(){ add_meta_box(‘tf_book_purchase’, ‘Book Purchase Links’, ‘tf_book_purchase’, ‘books’,’side’,’default’); } function tf_book_purchase (){ global $post; $custom = get_post_custom($post->ID); $link = $custom[“link”][0]; $selected = isset( $custom[‘link’] ) ? esc_attr( $custom[‘link’][0] ) … Read more

Page for custom taxonomy

This is a default part of the custom taxonomy functionality built into WordPress. When you register your taxonomy, the following argument play a part in determining whether to display that archive and where: public (is it accessible on the front end?) rewrite (how do the permalinks work?) You should read through all of the arguments … Read more

Taxonomy Drop Down with hierarchical view using $terms

I can kick myself, been struggling for 2 days and all that I had to do to make the wp_dropdown_categories option work is change the name to the same value as the taxonomy. My complete working code is: <?php // Equipment Category Dropdown, thanks https://gist.github.com/2902509 class Walker_SlugValueCategoryDropdown extends Walker_CategoryDropdown { function start_el(&$output, $category, $depth, $args) … Read more

Post to inherit custom category background image from parent

You can use this function to output the parent category ID and then style off of that. <?php function wpse_74737_category_top_parent_id($catid) { while ($catid) { $cat = get_category($catid); $catid = $cat -> category_parent; $catParent = $cat -> cat_ID; } return $catParent; } And then call this in your body class: <?php echo wpse_74737_category_top_parent_id( $cat->term_id ); ?>

PHP displaying wrong custom taxonomy images

I think (at least part of) the problem is that you’ve got a nested loop where you don’t really need one. The output of get_terms() is an array of objects. So $categories should be an array of objects. You loop through this array of objects here: foreach ( $categories as $category ) { $id = … Read more

Problem retriving the post type category

get_terms retrieves all terms in a taxonomy, not terms added to a post. you want to use get_the_terms to retrieve terms assigned to a specific post. there are no additional arguments to filter the list of terms returned, you’ll have to manually check a term’s parent to only output terms that are a child of … Read more

view subcategories order by id

If you want to order by id you can replace $subcategories = get_terms( ‘category’ , ‘parent=”.get_query_var(“cat’) ); with $args=array( ‘parent’=>get_query_var(‘cat’), ‘orderby’ => ‘id’, ‘order’ => ‘ASC’, ); $subcategories = get_terms( ‘category’ , $args); You can read more about the available parameters in the Codex here: http://codex.wordpress.org/Function_Reference/get_term

Show single Child Category on Custom Post

You can use get_term_children function. For Example: <?php $termID = 10; $taxonomyName = “region”; $termchildren = get_term_children( $termID, $taxonomyName ); echo ‘<ul>’; foreach ($termchildren as $child) { $term = get_term_by( ‘id’, $child, $taxonomyName ); echo ‘<li><a href=”‘ . get_term_link( $term->name, $taxonomyName ) . ‘”>’ . $term->name . ‘</a></li>’; } echo ‘</ul>’; ?>