Displaying Child Page’s Information

Something like this would work: <!–Child Page Thumbnails Start–> <?php $subs = new WP_Query( array( ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ‘meta_key’ => ‘_thumbnail_id’ ) ); if( $subs->have_posts() ) : while( $subs->have_posts() ) : $subs->the_post(); echo ‘<a href=”‘.get_permalink().'” title=”‘.get_the_title().'”>’.get_the_post_thumbnail().'</a>’.'<br/><h2><a href=”‘.get_permalink().'”>’.get_the_title().'</a></h2>’; the_content(); endwhile; endif; wp_reset_postdata(); ?> <!–Child Page Thumbnails End–>

How to create template for children category?

I have found answer, based on this post For cases when someone wants to have different template for child category. For example, if you have categories ordered like this: continent->country->city. And for example, you need a different template for city. First, we look if city have a children, if not, we call city template, the … Read more

Custom post type loop without children

please add your Custom post type name here ‘post_type’ => ‘Services’, // required <?php $args=array( ‘post_parent’ => 0, // required ‘post_type’ => ‘Services’, // required ‘orderby’ => ‘menu_order’, // to display according to hierarchy ‘order’ => ‘ASC’, // to display according to hierarchy ‘posts_per_page’ => -1, // to display all because default is 10 ); … Read more

Child and Parent Pages list of sub pages

You need to work out what page level you are on first, so that you know the correct ID to pass to the child_of argument of wp_list_pages. Give this a try: global $post; $page_level = 0; $post_parent = null; // Work out what page level we’re on if($post->post_parent > 0) { $post_parent = get_post($post->post_parent); $page_level … Read more

How to show children terms even if they are empty

Ok, I think I got it! 😀 After some research in theme functions how taxonomy hierarchy structure is done I modified the code as below (don’t know if it’s coded good but it works): /* * Display filter taxonomies */ static public function taxonomy_listing( $name, $terms, $taxonomy, $selected_term, $hide_empty = false ){ $search_more_less = adifier_get_option( … Read more

Show children connected to parent pages

Add this to you theme, just after the title part that displays the title. <?php $args = array( ‘post_type’ => ‘page’, // Only get pages (attachments can be listed as children) ‘posts_per_page’ => -1, // List all the children ‘post_parent’ => $post->ID // Get pages that are the children of the current page ); $parent … Read more

Get first level children of a page ID

As per the get_pages() documentation: ‘child_of’ (int) Page ID to return child and grandchild pages of. ‘parent’ (int) Page ID to return direct children of. Default -1, or no restriction. So to get immediate children of a specific page, you would use the parent arg and not child_of. $pages = get_pages( array( ‘parent’ => $pageID, … Read more

wp_list_pages two columns

I got everything working, but had to change my approach to get it working the way I wanted. Basically, the easiest approach (at least for me), was to create two menus…one for small screen sizes and one for larger ones. So, the code looks like: <!– Head –> <div id=”head”> <!– Nav –> <ul class=”nav”> … Read more