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?
- Retrieve each widget separately from a sidebar
- How to control output of custom post type without modifying theme?
- how to upload image using wp_handle_upload
- Avoiding using a loop to access a single post
- Adding ‘current_post_item’ class to current post in the loop
- Where should I use post_class()?
- Landing Page – Redirect Loop?
- Sort Popular Posts by Views for the Last Week
- Is it possible to display previous post revision?
- How to get current post id of a custom post type in a loop using template singel-{custom type}.php?
- How to retrieve an image from a post and display it before excerpt of a post? [duplicate]
- Easiest way to show total number of subpages
- Adding shortcode closing tag after a loop
- Get Pagination (WP-PageNavi) not to work
- Filtering The Loop For Single Page and Blog Page
- the_content() seems to block my ACF-code
- Removing the_content() from the page
- Category Template: Need to display different content on first page of archives
- Filter the loop by categories using checkbox form
- Duplicated posts on category page
- WordPress loop: exclude if it is the latest post
- Page-loop is looping content from custom loops on the same site. How to avoid that?
- WordPress: Loop Help
- Display Post Author Link above the loop
- Enabling users to control custom loop’s query
- Loop counter style
- Can I add generic numbering HTML classes to items as a loop runs?
- Custom Post Type on Homepage – Studiopress Genesis Framework
- display post format text in loop
- Use BuddyPress data in loop (mkdir)
- Wrap every four posts within a div [duplicate]
- Get most recent post for every term in a given taxonomy type
- Open Graph in Index Loop
- How to get post category and author name for cusmot API?
- How to add Default Level-0 parent and Level-1 class in WordPress Category in li element?
- How to add pagination in Terms
- A code that I could not fully grasp related to foreach & count_user_posts()
- Include only one category but Exclude if is in a category from loop
- WordPress Pages in an Array
- numberposts not responding to wp_reset_postdata()
- Problems With Query and/or Template Part and/or PHP
- Get child taxonomies in loop
- Building theme so user can change header image [closed]
- Can’t seem to get an else statement correct? [closed]
- get_page() unlike Loop returns the post content without html tags. How can I fix this?
- Creating mixture of shortcodes to use in the visual/text editor
- wp_mail function not working in user query loop
- How to set and retrieve cookies while in the loop