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–>

Getting a value from a custom field from a page that shares a parent with the current page

I’m assuming there are only two children in such cases. <?php $child_id = $post->ID; if ( $post->post_parent ) { $args = array( ‘post_parent’ => $post->post_parent, ‘post_type’ => ‘page’, ‘numberposts’ => -1, ‘post_status’ => ‘publish’ ); $children = get_children($args); if(count($children) == 2) { $child_id = $children[0]->ID == $post->ID ? $children[1]->ID : $children[0]->ID; } } if ( … Read more

How to use wp_dropdown_pages or wp_list_pages to accomplish a menu like this?

Here’s an easy way to generate a dropdown menu from your blog pages using the WordPress wp_dropdown_pages() function. Adding a bit of javascript you can send the user to the page when they select it <section id=”pageselect”> <span> <?php wp_dropdown_pages(‘show_option_none=Explore…’); ?> </span> <script type=”text/javascript”><!– var selectmenu = document.getElementById(“page_id”); function onPageChange() { if ( selectmenu.options[selectmenu.selectedIndex].value > … Read more

Display child pages full template including the content

I would try setting up post data in the loop and then calling a page template using get_template_part function. Note: depending on theme it may produce some unexpected results, as page template sometimes also includes site header and footer. But it’s something to get you started. $getchilds = array( ‘parent’ => $post->ID, ‘child_of’ => $post->ID, … Read more

Add link to parent page in list of child pages

you would add something like //* List child pages [jla_childpages] function jla_list_child_pages() { global $post; $parentID = ( is_page() && $post->post_parent ) ? $post->post_parent : $post->ID; $parentPost = get_post($parentID); $isParentCurrent = (get_the_ID() == $parentID) ? ” current_page_item” : ”; $parent = “<li class=”page_item page-item-{$parentID}{$isParentCurrent}”><a href=””.get_permalink( $parentID ).””>{$parentPost->post_title}</a></li>”; $childpages = wp_list_pages( “sort_column=menu_order&title_li=&child_of={$parentID}&echo=0” ); if ( $childpages … Read more

Child pages and sub-pages do not appear. Why?

You need to check if the page have parent to display the child page template or if he doesnt have to display the parent page template. If $post->post_parent is equal to 0 thats mean that he doesnt have a parent. while ( have_posts() ) : the_post(); $template = ($post->post_parent == 0) ? ‘page’ : ‘child-page’; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)