Check if a post is in any child category of a parent category

In a site I’m developing, I have the following category structure: * movies (parent) * thriller (child) * comedy (child) * drama (child) The current post is in the comedy category. The has_term function with the following parameters returns true: has_term( ‘comedy’, ‘category’ ) But, the same function with the following parameters returns false: has_term( … Read more

Get the first post term

How do I get only the first term of a custom post type. I can get all – no problem. This what I am using to grab all of them <?php foreach ($terms as $term) {echo ‘<a href=”‘.get_term_link($term->slug, ‘sitecat’).'”>’.$term->name.'</a>,’;} ?> >> <a href=”<?php the_permalink(); ?>”><?php the_title(”, ”); ?></a></h2></span> Would appreciate an answer using my code … Read more

Custom taxonomy list page?

I’m working on a restaurant site, and I have a custom post type for dishes, like so: $args = array( ‘labels’=> $labels, ‘public’=> true, ‘publicly_queryable’=>true, ‘show_ui’=>true, ‘show_in_nav_menus’=>true, ‘query_var’=>’dish’, ‘rewrite’=>true, ‘capability_type’=>’post’, ‘hierarchicial’=>false, ‘menu_position’=>5, ‘supports’=>array( ‘title’, ‘editor’, ‘thumbnail’, ‘excerpt’, ‘custom-fields’, ‘revisions’ ) ); register_post_type(‘dish’, $args); An example of one of the custom taxonomies I want to use … Read more

Taxonomy: Why ‘with_front’ => false DOES NOT WORK?

Seriously, why ‘with_front’ => false does not work as it should be? It is supposed to remove TAXONOMY BASE NAME and my question is why it does not work? I just dont want the taxonamy base slug appear in my URL and codex says ‘with_front’ => false should help but it does not. Leaving the … Read more

Custom columns for taxonomy list table

I have the following code to add a new column to my taxonomy edit screen (edit-tags.php?taxonomy=book_place&post_type=books) function add_book_place_columns( $columns ) { $columns[‘foo’] = ‘Foo’; return $columns; } add_filter( ‘manage_edit-book_place_columns’, ‘add_book_place_columns’ ); function add_book_place_column_content( $content ) { content=”test”; return $content; } add_filter( ‘manage_book_place_custom_column’, ‘add_book_place_column_content’ ); It’s working, but I need to access the current term id … Read more