Yakti-R
Forum Replies Created
-
I found the solution in another post, but if yours is different I am still interested to know.
Do you mind to share your solution? I am looking for the same. Thanks.
Maybe a good thing to mention in the description or FAQ.
Thanks for that. It was a styling issue indeed. The div for the next arrow was overlapping with the div for the close button (which I thought I had disabled with a “display: none”, but I hadn’t).
Putting the closing div to display:none (and just in case also put height and width to 1px and position it far away) fixed the issue.
Did you ever manage to resolve this? I am looking for a similar solution.
The code I use displays all child taxonomies (disregarding the parent taxonomy), but only those who have posts.
[41 lines of code moderated as per the Forum Rules. The maximum number of lines of code that you can post in these forums is ten lines. Please use the pastebin]
This page put me on the right path: https://www.wpbeginner.com/wp-tutorials/how-to-display-child-taxonomy-on-parent-taxonomys-archive-page
I managed what I wanted by using the following code:
<?php $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); if ($term->parent == 0) { ?> <?php wp_list_categories('taxonomy=YOUR-TAXONOMY-NAME&depth=1&show_count=0&hide_empty=0&title_li=&child_of=' . $term->term_id); ?> <?php } else { ?> <?php $term = $wp_query->queried_object; get_term( $term->slug, 'YOUR-TAXONOMY-NAME', '', '' ) ; query_posts( array( 'post_type' => 'YOU-CUSTOM-POST-TYPE', 'YOUR-TAXONOMY-NAME' => $term->slug ) ); if ( have_posts() ) : while ( have_posts() ) : the_post(); ?> <h3><?php the_title(); ?></h3> <?php the_content(); ?> <?php endwhile; endif; wp_reset_query(); ?> <?php } ?>
I am progressing a little here. Using the following code, I am able to list all the sub taxonomies using the parents taxonomy id:
<?php $termID = 12; $taxonomyName = "act_groups"; $termchildren = get_term_children( $termID, $taxonomyName ); echo '<ul>'; foreach ($termchildren as $child) { $term = get_term_by( 'id', $child, $taxonomyName ); echo '<li><a href="' . get_term_link( $term->name, $taxonomyName ) . '">' . $term->name . '</a></li>'; } echo '</ul>'; ?>
However, so far I haven’t been able yet to find a way to get the termID from the database, thus making the function dynamic.
Any help would be appreciated.