Conditional Tags
-
I found this code at wordpress codex, my question is how do I use this code?
<?php if ( is_page('about') || $post->post_parent == '2' ) { // the page is "About", or the parent of the page is "About" $bannerimg = 'about.jpg'; } elseif ( is_page('learning') || $post->post_parent == '56' ) { $bannerimg = 'teaching.jpg'; } elseif ( is_page('admissions') || $post->post_parent == '15' ) { $bannerimg = 'admissions.jpg'; } else { $bannerimg = 'home.jpg'; // just in case we are at an unclassified page, perhaps the home page } ?>
How do I make it work with my <div>:
<div id="image"><img src="BANNERHERE></div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Conditional Tags’ is closed to new replies.