If , else condition in wordpress
<h2>If , else if , else condition</h2>
<?php
if (is_page('12')) {
// below content only show when page id is 12
echo 'This is page id 12';
} elseif ( is_page( '14' )) {
// if page id is 14 then it will show below line only
echo 'Email me for to discuss your project';
}
// if page id is not 12 & 14 then below line will be print
else {
echo 'Get Your Water Bore Quote Here!';
}
?>
</code></pre>
<h2>If home condition</h2>
<?php
if ( isfrontpage() ) {
// This is a homepage
} else {
// This is not a homepage
}
?>
</code></pre>
Written by Rajesh Khatri
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Wordpress
Authors
Related Tags
#wordpress
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#