How to show all possible parents and children of a hierarchical taxonomy term?
How to show all possible parents and children of a hierarchical taxonomy term?
How to show all possible parents and children of a hierarchical taxonomy term?
Taxonomies on custom taxonomies
I guess you want to check if the active page is a) of your custom post type and b) one of the ancestors is your parameter. First of all, i would advise you to keep on using the ID, as slugs and titles can be non-unique, so one slug could be different posts. Second, you … Read more
WP_Query with meta_query for children
I recommend you use the pre_get_posts filter or ditch query_posts and use WP Query. That way you can easily use category__not_in (array) parameter and not mess any other loops up. function exclude_category($query) { // this requires term id instead of term name so change “20” to the “sport” id // this assumes “sports” is in … Read more
Before amending $query we first have to find out which posts to exclude, which requres two querys (if I can think of a way of doing it in one I’ll update the answer). The first will grab a list of distinct ID’s of all parent events, for example – SELECT DISTINCT wp_posts.post_parent FROM wp_posts WHERE … Read more
Just to check I understood your question, you want to display child posts under each parent post? In that case you have to write one more WP_Query inside your while loop, with parent as current post in loop. Something like: if ($query->have_posts()) : ?> <?php while ($query->have_posts()) : $query->the_post(); ?> <div class=”col-md-3 col-sm-6 wow fadeInRight”> … Read more
Simply put: no. If you want dynamic updating of your menu items, you would probably be better-served using wp_list_pages() or wp_page_menu().
Not sure if this will help, but I have used the code on the following page to add a parent page filter to the list of pages: http://www.finalwebsites.com/add-a-parent-pages-filter-function-your-wordpress-admin-section/ Very handy if you have a parent page for each section. There is just one problem – it only returns the children not grandchildren etc. I am … Read more
sort_column is not a valid parameter for WP_Query. You want orderby. sort_order is also not a valid parameter. It should just be order. $all_wp_pages = $my_wp_query->query( array( ‘post_type’ => ‘page’, ‘order’ => ‘ASC’, ‘orderby’ => ‘menu_order’ ) ); The Codex is your friend.