WordPress.org

Ready to get started?Download WordPress

Forums

Single.php conditional arguement (3 posts)

  1. stinkyleaf
    Member
    Posted 2 years ago #

    <?php
        $post = $wp_query->post;
        if ( post_type_exists( 'swc_staff' ) ) {
        include(TEMPLATEPATH . '/post-staff.php');
    
        } else {
        include(TEMPLATEPATH . '/post-news.php');
        }
        ?>

    I am trying to split off my single.php so I have a different template for custom post type posts to news posts. Is this arguement correct? it doesnt work for me. Instead it shows post-staff.php for both custom posts read more AND regular posts read more permalinks.

  2. It would be easier to simply make a single-{post_type}.php

    http://codex.wordpress.org/Template_Hierarchy#Single_Post_display

  3. stinkyleaf
    Member
    Posted 2 years ago #

    Ok so I tried the get template part childtheme method

    I created a file called category-parnters.php
    in that file i created get template part loop , partners

    Then i created loop-partners.php

    Right now they duplicate loop.php and category.php

    I get the title to show up but the loop-partners.php is not loading. Am I leaving out a step?

Topic Closed

This topic has been closed to new replies.

About this Topic