taxonomy query on front page
taxonomy query on front page
taxonomy query on front page
It’s hard to understand how you use your taxonomy and where you want to display it. Does your posts have a custom taxonomy and you want to display it there? Or you have some page, like /issues/, with a list of posts that linked to a certain issue number and grouped some how? So, if … Read more
Well I did it.. <ul id=”filter”> <li><a href=”#” class=”current” data-filter=”*” title=””>*</a></li> <?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) ); ?> <?php $term_id = $term->term_id; $taxonomy_name=”categories”; $termchildren = get_term_children( $term_id, $taxonomy_name ); foreach ( $termchildren as $child ) { $term = get_term_by( ‘id’, $child, $taxonomy_name ); echo ‘<li><a href=”#” data-filter=”.’ . $term->slug … Read more
I rewrote the function based on a few other posts I have seen online and now have the following code which works without any errors. I am still open to any further suggestions on the best way to streamline this code even further it it can be. Thanks again function downloads_shortcode($atts){ extract(shortcode_atts(array( ‘download_type’ => ” … Read more
CPT-onamies is a great plugin for this and would some extra custom fields not work? What I would do is use Advanced custom fields and load different fields based on the location rule. Like using the taxonomy term rule or you could go really specific with the post taxonomy and load fields when a certain … Read more
Terms are grouping mechanism. Query logic for them is mostly limited to matching or not matching, which makes you use huge arrays of many possible values in your case. While year is passably a group (might or might not make sense) the price is most definitely not. Would you shop in store where items are … Read more
You can use taxonomy term meta for that. Like you said you have “team” and “player” taxonomy. Now you can add a taxonomy term meta on “player” taxonomy’s terms and save the “team” terms(where the “player” belong) ID on that “player” taxonomy term meta. Then get the the player based on that “team” taxonomy term … Read more
Here I’ve written a function for you- function the_dramatist_get_product_cat_posts( $args = array() ) { $default_args = array( ‘taxonomy’ => ‘product_cat’, ‘get_post_type’ => ‘post’ ); $t = array(); $param = wp_parse_args($args, $default_args); $prod_terms = get_the_terms(get_the_ID(), $param[‘taxonomy’]); foreach ($prod_terms as $prod_term ) { $t[] = $prod_term->term_id; } $posts = get_posts(array( ‘post_type’ => $param[‘get_post_type’], ‘numberposts’ => -1, ‘tax_query’ … Read more
As Milo mentioned, this is an Advanced Custom Fields plugin (ACF) question. As such I have raised this ticket with the ACF support team here https://support.advancedcustomfields.com/forums/topic/how-to-replace-hard-coded-list-of-custom-taxonomy-terms-based-on-custom-field-qu/
DonĀ“t know how this plugin works in detail but i would try this: <?php $taxonomy = ‘channel’; $tax_terms = get_terms($taxonomy); ?> <ul> <?php foreach ($tax_terms as $tax_term) { ?> <li> <?php echo esc_attr(get_term_link($tax_term, $taxonomy)); ?> <?php echo $tax_term->name; ?> <?php echo $tax_term->count; ?> <?php print apply_filters( ‘taxonomy-images-queried-term-image’, ” ); ?> </li> <?php } ?> </ul>