Welcome to WebmasterWorld Guest from 23.22.220.37

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

PHP / WordPress

Help with the IF statement

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

Preferred Member

10+ Year Member

joined:May 23, 2002
posts: 444
votes: 0


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
1:16 pm on Feb 27, 2012 (gmt 0)

Senior Member

WebmasterWorld Senior Member 10+ Year Member

joined:Sept 22, 2002
posts:1749
votes: 0


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');
}
?>
 

Join The Conversation

Moderators and Top Contributors

Hot Threads This Week

Featured Threads

Free SEO Tools

Hire Expert Members