• I want to have two type of post in my blog, each one in a diferent page.
    as an example: i want page A and page B, and each page would have diferent posts.

    is this posible?
    is it done with $page_type?

    thanks in advanced.
    if anyone can help me figure this out i would be very thankkfull

Viewing 1 replies (of 1 total)
  • You can….well if it was me I would create a page template (a copy of the single.php) lets say you call it single-post-oftypeA.php and the other is called single-post-oftypeB.php then in the single.php file you would need to add in some code like this to the top of the script

    <?php
    $category = get_the_category();
    $currentcat = $category[0]->slug;

    if (file_exists(TEMPLATEPATH.”/single-post-“.$currentcat.”.php”)) {
    include(TEMPLATEPATH.”/single-post-“.$currentcat.”.php”);
    } else {
    ….the original single.php code goes within the else statement

    }


    ?>

    In the above I am checking for the slug so if it matches myurl/postsA/posttitle (so /postA/)

    this then tries to use the template you created called single-post-oftypeA.php

    anyway this works for me and by the way I am developing in WP 2.7.

    BTW

    The beauty of making your own templates like this (with different structures) is that in the wordpress admin it detects then in the Page Template drop down so in their you will see something like

    Default
    ..
    PostTypeA

    ??

    Good luck!

Viewing 1 replies (of 1 total)
  • The topic ‘Can i separate posts in two different pages?’ is closed to new replies.