How to link a custom page to custom single page template?

Discussion in 'WordPress' started by webwebby, Sep 29, 2013.

  1. #1
    Hi


    I am newbie in wordpress theme development & working on a wordpress theme.


    I have 2 types of posts, i.e. default & news.

    I have a page called page_news.php where I am listing all news from news posttype. There is another page called page_news-details.php which will be detail page for each news item.

    The problem is how to link the two so that when I click on a news item from my news listing page, it should take me to page_news-details.php.

    What values I will pass & get in these 2 pages?

    Also confused that the news details is using page.php or single.php ?


    Regards
     
    Last edited: Sep 30, 2013
    webwebby, Sep 29, 2013 IP
  2. WPLOL

    WPLOL Active Member

    Messages:
    57
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    70
    Digital Goods:
    9
    #2
    absolutely it's using single.php.

    Take TwentyTwelve as example -
    In single.php, find
    <?php get_template_part( 'content', get_post_format() ); ?>
    PHP:
    and change it to
    <?php get_template_part( 'content', get_post_type() ); ?>
    PHP:
    Then if the post type is news, the details page will use content-news.php. If this file doesn't exist, it will use content.php.

    Above is just a hint. Hope it helps.
     
    WPLOL, Oct 10, 2013 IP