post_parent is a numerical value field in $post object. So you should check if there’s a valid number. Try this –
<?php if ( $post->post_parent > 0 ) { ?>
the child single-artists.php
<?php } else { ?>
the parent single-artists.php
<?php } ?>
Related Posts:
- Conditional for single-{post-type}.php
- is_singular() not working if called via callback function of admin-ajax.php
- How do test if a post is a custom post type?
- How to disable the single view for a custom post type?
- Custom post type single page returns 404 error
- Custom post type single-{custom}.php not working
- What is singular.php?
- Template for specific post of custom post type
- Single custom post type page redirecting to 404 page
- Pre get posts for single post
- Pull Two Posts Into Custom Post Type `single-cpt.php`
- Disable Single Post View for Specific Taxonomy on Custom Post Type
- functions.php conditional tag only for custom post type
- Exclude custom function content from certain pages
- Get template part based on custom taxonomy term
- How to get a list of term names of the custom post type im currently on in single.php
- is_singular won’t call my functions?
- Create sub single pages
- If on term-page -> get the current term?
- Using previous_post_link and next_post_link to wrap around post sequence
- How do I create new content pages for my Custom Post Type?
- Display “Post 2 of 4” on single post page?
- custom post type upcoming post and past post
- posts_nav_link on single post template
- changing default comment form arguments [duplicate]
- Post Rank on Single Post page based on custom field
- Disable single pages and archives and keep preview
- Displaying Meta Box Image
- Custom template for post type not working
- Make custom post type display as a page
- is_page_template not working as expected
- Disable single view in register_post_type [duplicate]
- Archive page for custom post type not working
- Redirect Single Post CPT (Custom Post Type) to a specific URL
- Need post_type_archive_title function but in ‘single’
- remove child post from custom post type archive
- pagination redirecting from page number url before page requested
- if custom posts type exists and there are posts load script
- How to check the terms in single custom post type template
- How to show the archive / post type description on Single templates
- Need to display same custom post type on 2 different singles templates
- Made Custom Post Types, but single.php not working
- Posts of custom post type load the page template
- How to call custom single post?
- Need help targeting a custom post type with conditional tags
- Why would this IF statement not work? [closed]
- Custom post template for particular posts
- custom comments on specific post type
- Excluding custom post types
- Remove single page for custom post type
- Single Template that can be applied only via URL
- How do I display tags for a custom post type single page?
- Custom post type not displaying content from single-{custom post type} page
- Register widget only page is a singular of custom post type
- custom post type parsed as attachment
- Is there a conditional tag to determine whether the post is _any_ custom post type?
- Conditional Query of Custom Post Type and custom taxonomy
- Single template showing all posts of that type
- Programmatically rewriting slug through functions.php but returns 404
- How to display single post from custom post type loop?
- Setup template_redirect using has_term when NO term assigned
- How to run filter only on custom post type edit screen
- Conditional statement for if archive page has posts which contain certain taxonomies/categories/tags, show those terms
- Custom Post Conditional for Parent & Child Single.php?
- Not Able To Render Single-CustomPostType.php File
- Single page not working for custom post type
- Conditional for a Single Post That Belongs to a Category?
- single-{post_type}.php not working
- Get term name without a foreach loop
- Cant get paginations on single.php to work with my custom post types
- Including all post id’s of a custom post type into an array
- How to show only the most recent post on my custom post type archive?
- Associate page w/ specific single post template?
- Display custom post types in wp_list_pages
- Conditional Tags for specific category of custom posts
- List of users that clicked a ‘Join’ button at single post
- Move Genesis Single Page/Single Post Title
- How to check if post/page or taxonomy post is published by admin
- TinyMCE Buttons on Certain Post Type
- Inserting custom fields into single.php
- hide specific div on single.php [closed]
- Display message if no posts in Custom Post Type loop
- Showing taxonomy terms on custom post type
- How do I find a way to create a global single.php for a custom post type?
- How to use single.php for creating, reading and editing Custom Posts with ACF
- Can’t access private custom posttype single- or archives-page
- How to show custom field on specific custom post type posts only when filled
- Check if custom post is a parent?
- adding custom post type “name” to single template
- trying to show single post but displays all post on a custom post type
- Custom Post Type Specific Post Template
- Redirect to URL if x number of days passed
- comments hooks on custom post type
- Conditional Statements
- If custom taxonomy else conditional [closed]
- If tag exists, then echo once
- Show specific content on parent custom post type and all children
- Make Next and Previous on single-$posttype.php use the same order as archive-$posttype.php
- Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed
- Function to allow single post template based on custom taxonomy?