WordPress.org

Support

Support » Themes and Templates » [Resolved] using single.php to filter normal and custom post types

[Resolved] using single.php to filter normal and custom post types

  • Hello,

    PHP Newbie trying to learn, Looking for some syntax help please:

    I am looking to use single.php to segregate standard posts to one template file and an array of other custom post types to other template files, could someone please help me with making this following code work if I am close, or please point me in the direction of how to make this code work?

    <?php
    query_posts( array( 'post_type' => array('artistgallery', '123') ) )
    if ( 'post_type' => array('artistgallery', '123') {
    include(TEMPLATEPATH . '/single-artist.php');
    } else {
    include(TEMPLATEPATH . '/single-all.php');
    }
    ?>

    It was based on this:
    In the recent past I successfully filtered by category to different template files using:

    <?php
    if ( have_posts() ) { the_post(); rewind_posts(); }
    if ( in_category( array( '5355', '5392', '5393') )) {
    include(TEMPLATEPATH . '/single-video.php');
    } else if ( in_category('82')){
    include(TEMPLATEPATH . '/single-video-vod.php');
    } else {
    include(TEMPLATEPATH . '/single-news.php');
    }
    ?>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] using single.php to filter normal and custom post types’ is closed to new replies.
Skip to toolbar