solution here as function:
function testchildren () {
global $post;
$childtest = get_pages('child_of=".$post->ID);
if( count( $childtest ) != 0 ) {
return false;
} else {
return true;
}
}
and implementation as markup:
<?php if (have_posts()) : while (have_posts()) : the_post() ; ?>
<h2><?php $parent_title = get_the_title($post->post_parent); echo $parent_title; ?> </h2>
<?php if ( testchildren() ) : ?>
<h1 style="margin-top:6px; margin-bottom:12px;"><?php the_title(); ?></h1>
<?php endif; ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
Related Posts:
- Jquery Slider for profile template
- if ( is_home() && ! is_front_page() )
- Is including the loop necessary for page.php? [duplicate]
- What is best way passing variables to theme templates and using them different places like widgets?
- Showing current subcategory
- Page template not displaying
- Loop through pages with specific template
- How to get_template_part using AJAX?
- wp alchemy multiple image uploader output images to template
- code suddenly appearing from my tempate second loop
- Get search.php results in header.php?
- WordPress Loop inside Loop?
- Conditional query that displays on Woo product attribute pages
- Template structure
- How to show “teaser” posts on blog / archive pages, otherwise full posts
- Order archive results by post id in custom taxonomy template
- Default ‘post’ post type archive slug?
- How do I make a variable available inside partials?
- 404 Template customization | Want 10 recent Post on the 404.php error page apart from the error Notice
- Second Loop Showing Only One Post on Single Post Page
- How do I put my frontpage featured image in a page template for home.php?
- How can have a conditional template tag based on the main loop within a secondary loop with new WP_Query(), using get_template_part()
- Get markup for post without loading into the template
- How to render the single post template with the post name?
- excerpt not showing up
- new custom theme – posts displaying on top of one another
- Using has_tag() outside loop
- How do i create a list-posts-page?
- How to sort a loop after most viewed
- How to loop specific Category menu from archive page?
- How do I set the Stewart Search Template to return only published posts in the result
- Is it possible to set archive.php instead of index.php to display blog?
- Using is_page_template inside loop
- is it bad to copy the loop for a template?
- Is “the loop” a template tag?
- Deeply Nested Menu Loop with Twig using Timber [closed]
- WordPress with woocommerce custom query
- Alternative layout the loop
- Cant pull in featured Image
- Template included with plugin doesn’t return all posts for custom taxonomy
- Show all child categories associated to post ID within loop
- Creating a archive for taxonomy terms, not the term results
- Secondary loop cuts off at 10 posts?
- get all page templates
- Load featured article once in a loop
- Using in_category for non standard loops
- wordpress showing all posts instead of date range
- How to show only specific tag in wordpress loop
- How to implement template file and the loop
- loop mix my child-category and parent-category
- Same posts within a paginated page
- How can I create an entirely new, separate display of posts?
- How to fix pagination for custom loops?
- Counting the posts of a custom WordPress loop (WP_Query)?
- Get excerpt using get_the_excerpt outside a loop
- How to display Yoast SEO meta description in archive template for each post instead of the_excerpt()? [closed]
- Get post content from outside the loop
- Why should I put if(have_posts()), is while(have_posts()) not enough?
- Display featured products through custom loop in woocommerce on template page
- Split Content and Gallery
- Get the children of the parent category
- How to get Author ID outside the loop
- How can i display the content in plaintext
- Redirect loop when trying to login to /wp-admin/ [duplicate]
- How to split a loop into multiple columns
- Is it necessary to reset the query after using get_posts()?
- Is there any difference between the_title() and echo get_the_title()?
- AJAX with loop filtering categories
- Do I need to use The Loop on pages?
- Remove the Homepage Query
- Is it possible to define a template for a custom post type within a plugin independent of the active theme?
- remove tags from the_content
- the_title() shows title of the first post instead of the page title?
- How to force excerpts / teasers in the loop
- Retrieve each widget separately from a sidebar
- Why am I being limited to ten posts on a custom loop?
- Ways to have multiple front-page.php templates that can be swapped out?
- Should I use loop in the single.php file?
- A search for ‘0’ returns results
- Why do themes rely on “The Loop”?
- How to return loop contents
- Using the Loop to show all levels of subpages under a parent page? Halfway there
- Cleanest Way to Select Every Second Element in a Loop?
- How to control output of custom post type without modifying theme?
- Insert image or ad script after 3 posts using the loop
- Get date of last update outside of loop
- Pagination not working on home page
- Child Pages Loop
- How to place comments_template(); outside the loop?
- Multiple Loops Homepage?
- How to Change Loop to Order Posts by Views (using wp-postviews plugin)
- how to upload image using wp_handle_upload
- Avoiding using a loop to access a single post
- Executing Queries in tag.php
- How to get the first image gallery of a product in woocommerce in a loop
- Get post by page name or slug
- save_post + insert_post = infinite loop
- Loop.php vs looping inside template file
- Get ID of a page containing secondary loop in content
- Custom Loop and Infinite Scroll