Add custom taxonomies as class names to an archive page of custom post types

The function you mention is going to return a list of links — aren’t you just trying to get the term slug as a class? Why not do…. $terms = get_the_terms($post->ID, ‘my-category’); $more_terms = get_the_terms($post->ID, ‘another-category’); $slug_out = array(); foreach($terms as $term){ $slug_out[] = $term->slug; } foreach($more_terms as $term){ $slug_out[] = $term->slug; } echo ‘<div … Read more

Query a custom taxonomy for certain posts

You are setting your taxonomy arguments incorrectly in WP_Query. You need to set up a tax_query, which takes an array of arrays. See the codex. $args = array( ‘post_type’ => ‘post’, ‘orderby’ => ‘rand’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘newsdates’, ‘field’ => ‘id’, ‘terms’ => $field ) ) );

Issue on adding Icons to Custom Post Type

This code works perfectly for me: add_action( ‘admin_head’, ‘my_icons’ ); function my_icons() { ?> <style type=”text/css” media=”screen”> #menu-posts-product .wp-menu-image, .icon32-posts-product { background: url(<?php echo get_template_directory_uri(); ?>/img/contactLensemenu.png) no-repeat center center!important; } #menu-posts-product .wp-menu-image { background-size:16px 16px!important; } .icon32-posts-product { background-size:32px 32px!important; } </style> <?php } ?> PHP part is the same of the yours, (except for … Read more

Custom taxonomy subcategories template page

Yes, this is achievable with the action ‘template_redirect’ I’ve left to write code to find sub-category for yourself! function my_subcat_template() { if ( <is sub category>) { include (TEMPLATEPATH . ‘/category-fun.php’); exit; } } add_action(‘template_redirect’, ‘my_subcat_template’); Update This is a better answer for your problem Put this is functions.php What it does is, it redefines … Read more