Support » Theme: Tracks » Child Themes & Custom Post Types

  • Resolved nzrhcom

    (@nzrhcom)


    What started as a “is this what you mean” on a help request on another site has led to a help request here.

    I’ve created a child theme and the custom post types and taxonomies are working fine. Normally I’d create a custom version of single.php and archive.php but I see that you have them called content.php, content-archive.php.

    I’d hoped that content-inspirations.php would do the trick but no, it doesn’t.

    • Is there a way to do this?
    • Can it be added?
    • or is it just a limitation of the theme

    If it’s a limitation, that’s fine 🙂

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
  • Theme Author Ben Sibley

    (@bensibley)

    Thanks for using Tracks!

    Sorry the support for CPTs isn’t great. I’ve been meaning to fix that.

    In your child theme’s functions.php file, please add this function:

    
    function ct_tracks_get_content_template() {
    
    	/* Blog */
    	if ( is_home() ) {
    
    		/* Two-column Images Layout */
    		if ( get_theme_mod( 'premium_layouts_setting' ) == 'two-column-images' ) {
    			get_template_part( 'licenses/content/content-two-column-images' );
    		} /* Full-width Images Layout */
    		elseif ( get_theme_mod( 'premium_layouts_setting' ) == 'full-width-images' ) {
    			get_template_part( 'licenses/content/content-full-width-images' );
    		} /* Blog - No Premium Layout */
    		else {
    			get_template_part( 'content-archive', get_post_type() );
    		}
    	} /* Post */
    	elseif ( is_singular() ) {
    		get_template_part( 'content', get_post_type() );
    		comments_template();
    	} /* Attachment */
    	elseif ( is_attachment() ) {
    		get_template_part( 'content', 'attachment' );
    		comments_template();
    	} /* Archive */
    	elseif ( is_archive() ) {
    
    		/* check if bbPress is active */
    		if ( function_exists( 'is_bbpress' ) ) {
    
    			/* if is bbPress forum list */
    			if ( is_bbpress() ) {
    				get_template_part( 'content/bbpress' );
    			} /* normal archive */
    			else {
    				get_template_part( 'content-archive', get_post_type() );
    			}
    		} elseif ( get_theme_mod( 'premium_layouts_setting' ) == 'two-column-images' ) {
    			get_template_part( 'licenses/content/content-two-column-images' );
    		} elseif ( get_theme_mod( 'premium_layouts_setting' ) == 'full-width-images' ) {
    			get_template_part( 'licenses/content/content-full-width-images' );
    		} else {
    			get_template_part( 'content-archive', get_post_type() );
    		}
    	} /* bbPress */
    	elseif ( function_exists( 'is_bbpress' ) && is_bbpress() ) {
    		get_template_part( 'content/bbpress' );
    	} /* Custom Post Types */
    	else {
    		get_template_part( 'content', get_post_type() );
    	}
    }
    

    Then you can create a file named content-inspirations.php to override content.php and a file named content-archive-inspirations.php to override content-archive.php.

Viewing 1 replies (of 1 total)
  • The topic ‘Child Themes & Custom Post Types’ is closed to new replies.