Ads by ProfitSence
Close

Use WordPress is_page() To Display Custom Content

Last Updated on Wednesday 5th Oct 2022

ispage

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.

			
					<?php 
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()

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

			
	

References

is_single

is_page