Use WordPress is_page() To Display Custom Content

Last Updated On Tuesday 24th Aug 2021


According to the codex

This Conditional Tag checks if Pages are being displayed. This is a boolean function, meaning it returns either TRUE or FALSE.

wordpress is_page

A simpler explanation would be that the tag checks the name of the page and returns TRUE or FALSE.It display whatever you want.

global $post;

if( $post->ID == 1234) { ?>
<!-- Anything -->
<?php } ?>

if page id wordpress

For your blog page use is_home()

For your single posts use is_single()

    if ( is_page('about')) { 
        echo '<div>Something New Here.... BlaBlaBla</div>';