Changing stylesheet depending on custom taxonomy terms

Like Justin Tadlock says in your referenced article, the body_class() provides the ability to add classes dependant on the type of term. Given that you indicate your php knowledge is still growing; this maybe the best solution. The codex provides a list of classes on a body_class enabled: http://codex.wordpress.org/Function_Reference/body_class If that isn’t sufficient; wordpress has … Read more

$wpdb: Counting posts corresponding to 3 terms in 3 different taxonomies

Do a tax-query and then count the result. No need for a custom query with dozens of JOINS. $posts = new WP_Query( array( ‘post_type’ => ‘MYPOSTTYPE’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘TAX_1’, ‘field’ => ‘slug’, ‘terms’ => array( ‘TERM_TAX_1’ ), ‘operator’ => ‘IN’ ), array( // etc. ) ), ‘post_status’ => ‘publish’ ); prinft( … Read more

Is it possible to get all term items from a custom taxonomy regardless of post attachment status?

If I understand right, you need all attachments (attached or not) with specified term? $args = array( ‘post_type’ => ‘attachment’, ‘my_taxonomy’ => ‘my_taxonomy_term’ ); $my_query = new WP_Query( $args ); if( $my_query->have_posts() ): while ($my_query->have_posts()) : $my_query->the_post(); // your stuff here endwhile; } // Don’t forget to reset wp_reset_postdata(); WP_Query Taxonomy Parameters.

Strip post_tags from list of returned taxonomy terms

Use this function to determine if Taxonomy is hierarchical or not: Function Reference/is taxonomy hierarchical « WordPress Codex Example: // taxonomy term archives $post_type = get_post_type(); $taxonomies = get_object_taxonomies($post_type); if(!empty($taxonomies)){ foreach($taxonomies as $taxonomy){ // only want hierarchical — no tags please if(is_taxonomy_hierarchical($taxonomy)){ $terms = get_terms($taxonomy); if(!empty($terms)){ echo “<ul>”; foreach ( $terms as $term ) { … Read more

Display only first level children of my custom taxonomy categories

Try the following code: $taxonomy_name=”listing_category”; $queried_object = get_queried_object(); $term_id = $queried_object->term_id; $termchildren = get_terms( $taxonomy_name, array( ‘parent’ => $term_id, ‘hide_empty’ => false ) ); echo ‘<ul>’; foreach ( $termchildren as $child ) { echo ‘<li><a href=”‘ . get_term_link( $child, $taxonomy_name ) . ‘”>’ . $child->name . ‘</a></li>’; } echo ‘</ul>’;

Include posts from feature category in pre_get_posts

I haven’t run this code so there may be a syntax error, but the gist is to return userfeed-taxonomy with the terms specified that have featured category OR cities-taxonomy with the terms specified and featured category OR anything else that’s not those taxonomies. It’s kind of clunky, maybe there is a better way: $query->set( ‘tax_query’, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)