WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] asking for a suggestion about conditional tag (2 posts)

  1. antr
    Member
    Posted 4 years ago #

    I need a specific template for one oif my single posts. I have read about the is_single() conditional tag http://codex.wordpress.org/Conditional_Tags#A_Single_Post_Page and some examples http://codex.wordpress.org/Conditional_Tags#Single_Post, but I do not know how to handle my situation.
    Since the template I need is very different from the predefined one, I prefer a solution like the following:

    IF is_single('beef-stew') THEN
    USE template_ad_hoc_for_beef_stew.php
    ELSE
    USE template single.php

    How can I implement it? Which php files have I to modify?
    Thanks for your help.

  2. westondeboer
    Member
    Posted 4 years ago #

    you have to modify the single.php page

    <?php if (is_single('beef-stew')) {
    include(TEMPLATEPATH."/template_ad_hoc_for_beef_stew.php");
    } else {
    // show normal single.php code
    }
    ?>

Topic Closed

This topic has been closed to new replies.

About this Topic