• Resolved keress

    (@keress)


    I’m trying to write what seems like some simple code, but I’m getting unexpected results. I’m trying to use the page.php template file to direct WordPress onto specific templates for each page or group of pages. The code works when I use only one ‘if’ statement at a time, but when combining them, only the first two statements work. After that, subsequent pages use the second template called for.

    I’m excited that WordPress is finally giving me practical call to use PHP Ive been trying to learn for awhile. Any help is greatly apprecated.

    <?php

    if (is_page(services) || $post->post_parent==”60″)
    {
    include (TEMPLATEPATH . “/services.php”);
    }

    elseif (is_page(about-addiva) || $post->post_parent==”71″)
    {
    include (TEMPLATEPATH . “/about.php”);

    }

    elseif (is_page(media-center) || $post->post_parent==”72″)
    {
    include (TEMPLATEPATH . “/media-center.php”);
    }

    else
    {
    include (TEMPLATEPATH . “/about.php”);
    }

    ?>

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using page.php to direct wp to various templates’ is closed to new replies.