How to Get The Taxonomy Term in Custom Post Type Loop Inside a Wp Query

while ( $loop->have_posts() ) : $loop->the_post(); //Edit Width post type $categories = get_the_terms(get_the_ID(), ‘services’); $separator=”, “; if ( ! empty( $categories ) ) { foreach( $categories as $category ) { echo ‘<a class=”cat_item” href=”‘ . esc_url( get_category_link( $category->term_id ) ) . ‘” alt=”‘ . esc_attr( sprintf( __( ‘%s’, ‘your-themes’ ), $category->name ) ) . ‘”>’ … Read more

Sub-Theme (based on Taxonomies)

Yes, you can. In many ways. One way is to have custom templates based on tag or category slug. So, you just tag your posts appropriately and then WordPress will automatically select appropriate template. If the template difference are miniscule, you can use php includes or wordpress includes to keep common content in other files. … Read more

Error in Custom Taxonomy UI

The issue at first glance appears to be here.. add_action(‘game_edit_form_fields’, ‘game_form_fields’); add_action(‘game_add_form_fields’, ‘game_form_fields’); function game_form_fields($tag,$taxonomy) { Your function is expecting 2 vars to be passed from the hook, but your add_action calls default to 1.. Eg, this.. add_action(‘game_edit_form_fields’, ‘game_form_fields’); Is equal to this.. add_action(‘game_edit_form_fields’, ‘game_form_fields’, 10, 1 ); The fourth parameters sets how many arguments … Read more

How to pull a number posts from a specific Taxonomy within a Custom Post type

The get_the_terms() returns a list of term objects. So first of all, you need to treat the output as a list rather than a single element. The name you’re looking for is stored in the name field. $artistnames = get_the_terms($post->ID, ‘artist’); if (!empty($artistnames)) : ?> foreach ($artistnames as $obj) { $name = $obj->name; // Do … Read more