WordPress Conditional Statements

<?php if (is_single()) { ?> // your HTML for posts only // <?php } ?> <?php if (is_page()) { ?> // your HTML for pages only // <?php } ?> <?php if (is_page('home')) { ?> // your HTML for your home page only, typically your blog's first page of posts or your site's page when that page is named 'Home' // <?php } ?> <?php if (is_front_page()) { ?> // your HTML for your home page only, when you have assigned a specific page to be your front page under Settings > Reading > Front page displays // <?php } ?> <?php if (is_page('about')) { ?> // your HTML for your about page only // <?php } ?>

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.