How can I hide children of draft pages using wp_list_pages()?

I’m displaying a simple sitemap with wp_list_pages(); $args = array( ‘sort_column’ => ‘menu_order’, ‘title_li’ => ”, ‘post_status’ => ‘publish’ ); wp_list_pages( $args ); The problem is that by default this also shows the published children of draft pages, like so : Page 1 (published) -> displayed — Page 2 (draft) -> not displayed —— Page … Read more

A check for if is parent page, if has children, if has grandchildren

I have one default page template that I wish to use for two scenarios. I’d prefer to use only one page template for the sake of simplicity for my client. Here’s what I’m trying to accomplish: if parent_page OR if child-page without children { display full-width-layout } if child page with children or if grandchild … Read more

Check if a post is in any child category of a parent category

In a site I’m developing, I have the following category structure: * movies (parent) * thriller (child) * comedy (child) * drama (child) The current post is in the comedy category. The has_term function with the following parameters returns true: has_term( ‘comedy’, ‘category’ ) But, the same function with the following parameters returns false: has_term( … Read more

Custom Nav walker display current menu item children, or siblings on no children

I’ve been messing around / searching for hours and still can’t get this to work, so i’m finally giving in and asking for some help. I’m trying to write a custom walker that shows only the current pages children, or if there are no children display the pages siblings. For example, take the following menu … Read more

Get the children of the parent category

I’m trying to get all the children categories to display in this loop but I’m struggling with the code. This is what I have so far. <?php $args=array(‘orderby’ => ‘name’, ‘order’ => ‘ASC’); $categories=get_categories($args); foreach ($categories as $cat) { ?> <dt><a href=”#” class=”customer-acquisitiontop” id=”<?php echo $cat->slug; ?>” data-filter=”.<?php echo $cat->slug; ?>”><h2><?= $cat->cat_name; ?></h2></a></dt> <dd><div class=”services”> … Read more