Welcome to WebmasterWorld Guest from 54.160.131.144

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP / WordPress

Help with the IF statement

     

giggle

10:48 am on Feb 25, 2012 (gmt 0)

10+ Year Member



Hi

I have a piece of code in a WordPress theme that I'd like some help with, please.


<?php if (is_page('ThisPage')) { include (TEMPLATEPATH . '/HeaderResults.php'); } else { wp_get_header(); } ?>

<div class="art-contentLayout">
<?php include (TEMPLATEPATH . '/sidebar1.php');?>


I would only like the last two lines executed if the page selected is not ThisPage. I've searched the web and tried all sorts of variations but I cannot get any to work. Help!

Also, how do I substring a page name to see if it starts with the string "STARTSWITHTHIS"?

Thanks

Mick

RonPK

1:16 pm on Feb 27, 2012 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You'll need to jump out of PHP parsing at the right spot in the else condition:

<?php 
if (is_page('ThisPage')) {
include (TEMPLATEPATH . '/HeaderResults.php');
} else {
wp_get_header();
?>
<div class="art-contentLayout">
<?php
include (TEMPLATEPATH . '/sidebar1.php');
}
?>
 

Featured Threads

Hot Threads This Week

Hot Threads This Month