Im trying to simply just output some HTML onto these 3 specific page-ids that I am referring too in the code below. Does anyone have any ideas as to why this php isn’t working? (its at the bottom of my functions.php file in the child theme.
if( is_page('96') || is_page('98') || is_page('61') ) { ?> <div class="test"><h2>test content</h2></div> <?php }
Any help would be appreciated as to why this ‘test content’ is not appearing on these pages. Thanks!
Advertisement
Answer
Try the below code that will work properly.
if( is_page(96) || is_page(98) || is_page(61) ) : ?> <div class="test"><h2>test content</h2></div> <?php endif;
===================== or ==========================
$id = get_the_ID(); if( ($id == 96) || ($id == 98) || ($id == 61) ) : ?> <div class="test"><h2>test content</h2></div> <?php endif;