December 2017
Beginner
458 pages
7h 52m
English
Next, we will add an else statement to the if statement we have defined, which will come into the picture if there are no posts. If there are no posts, we will echo a message saying Sorry, there are no posts:
<?php if(have_posts()) : ?> <?php while(have_posts()) : the_post(); ?> <?php get_template_part('content', get_post_format()); ?> <?php endwhile; ?><?php else : ?> <?php echo wpautop('Sorry, there are no posts'); ?><?php endif; ?>
Now let's save the index.php file. For the content files, we'll add STANDARD CONTENT in the content.php file as shown here:

And add PHOTO in the content-gallery.php file, as shown here: ...
Read now
Unlock full access