Problem with is_page_template
-
Hi guys,
I am trying to make a conditionnal comment work with is_page_template.
<div id="nav"> <ul <?php if ( is_page_template('what.php') ) { echo ' class="what"';} ?> <?php if ( is_page_template('who.php') ) { echo ' class="who"';} ?> <?php if ( is_page_template('where.php') ) { echo ' class="where"';} ?> > <li id="who"><a href="<?php bloginfo('url'); ?>/who">Who?</a></li> <li id="what"><a href="<?php bloginfo('url'); ?>/what">What?</a></li> <li id="where"><a href="<?php bloginfo('url'); ?>/where">Where?</a></li> </ul>
It’s suppose to put a class when the page tempalte is being used but it actually not working.
Could it be that those page templates don’t really have any content but fetching post from categories? meaning that they don’t print any content from that actual page but still use the template.
here is an example:
<?php /* Template Name: who.php */ ?> <?php get_header(); ?> <div class="posts-wrap"> <!-- profile --> <?php query_posts('page_id=60');?> <div class="profile"> <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?> <H2><?php the_title(); ?></H2> <div id="line" style="margin-top:10px;"></div> <?php the_content( __('')); ?> <?php endwhile; ?><?php else : ?><?php endif; ?> </div> <!-- people --> <div><h2>Directors</h2></div> <div id="line" style="margin-top:10px;"></div> <?php query_posts("cat=4");?> <?php if (have_posts()) : ?><?php while (have_posts()) : the_post(); ?> <div class="directors"> <div class="directorspic"><?php echo c2c_get_custom('who'); ?></div> <div class="directorstext"> <H3><?php the_title(); ?></H3> <?php the_content( __('')); ?> </div></div> <br clear="all" /> <?php endwhile; ?><?php else : ?><?php endif; ?> </div><!-- end .posts-wrap --> <?php get_sidebar(); ?> <?php get_footer(); ?>
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Problem with is_page_template’ is closed to new replies.