We can check which page we are on and then we can add the content we want to show, Here
if(have_posts()): while(have_posts()):the_post(); ?> <article class="post page"> <h2><?php the_title(); ?></h2> <small> <?php if(is_page(17)){ echo "Displaying by checking which page we are on"; } ?> </small> <p> <?php the_content(); ?> </p> </article> <?php endwhile; else : echo "No Posts Found"; endif;
Here we are checking if page id is 17 then display certain text we can check for multiple pages like
if(is_page(17) && is_page(16)){ echo "Displaying by checking which page we are on"; }
Instead of id you can use slug as well
<?php if(is_page('about_us') && is_page('contact_us')){ echo "Displaying by checking which page we are on"; } ?>
Hope this helped