Querying Term Posts in Loop

To expand on the answer from @s_ha_dum – you need to modify a few things about your query. First, use his suggested tax query: $args = array( ‘post_type’ => ‘custcpt’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘custtax’, ‘field’ => ‘id’, ‘terms’ => $cat->term_id, ) ), ‘order’ => ‘ASC’ ); Then, modify your code as follows: … Read more

Add Tags to custom post type

It seems the issue was in part down to their being a theme-init.php in the child theme which was overwritting parts of the theme-init.php in the parent / cherry framework theme. I resolved the issue by adding the following code into my child theme’s theme-init.php; register_taxonomy(‘team_tag’, ‘team’, array( ‘hierarchical’ => false, ‘label’ => theme_locals(“tags”), ‘singular_name’ … Read more

Set a taxonomy as private

You should also set the query_var to false. So your args array should be like this: $args = array( ‘labels’ => $labels, ‘public’ => false, ‘query_var’ => false, ‘rewrite’ => false, ‘hierarchical’ => false, ); Cheers

If statement within PHP echo

According to the plugins documentation (http://zahlan.net/blog/2012/06/categories-images/), this seems pretty simple: <ul> <?php $categories = get_categories( $args ); foreach ( $categories as $category ) { $img_src = z_taxonomy_image_url($category->term_id); if ( $img_src ) { echo ‘<li><img src=”‘ . $img_src . ‘” alt=”” /><a href=”‘ . get_category_link($category->term_id) . ‘” rel=”bookmark”>’ . $category->name . ‘ – ‘ . $category->description … Read more

List subcategory on taxonomy term page

You can make use of get_term_children() instead of get_categories() You can try something like this $term = get_queried_object(); $term_id = $term->term_id; $taxonomy_name = $term->taxonomy; $termchildren = get_term_children( $term_id, $taxonomy_name ); echo ‘<ul>’; foreach ( $termchildren as $child ) { $term = get_term_by( ‘id’, $child, $taxonomy_name ); echo ‘<li><a href=”‘ . get_term_link( $term, $taxonomy_name ) . … Read more

Programatically added attribute, set to ‘show on product page’ automatically. Woocommerce [closed]

It actually doesn’t matter because WooCommerce uses this, to display: $values = wc_get_product_terms( $product->id, $attribute[‘name’], array( ‘fields’ => ‘names’ ) ); However, if you don’t set the display to true, you’d have to add this code to your template files. You might have to do other things as well (styling, etc). If you just set … Read more

Is there a way to connect a custom post type to another custom post type’s taxonomy? (specific to locations)

I didn’t know that I can register a taxonomy for more than 1 CPT/post type! register_taxonomy( ‘location’, array( ‘offer’, ‘store’ ), array( ‘label’ => __( ‘Location’, ‘themeify’ ), ‘hierarchical’ => true, ‘labels’ => array( ‘name’ => __( ‘Location’, ‘themeify’ ), ‘singular_name’ => __( ‘Location’, ‘themeify’ ), ‘menu_name’ => __( ‘Location’, ‘themeify’ ), ‘all_items’ => __( … Read more