Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learn to Create WordPress Themes by Building 5 Projects

You're reading from   Learn to Create WordPress Themes by Building 5 Projects Master the fundamentals of WordPress theme development and create attractive WordPress themes from scratch

Arrow left icon
Product type Paperback
Published in Dec 2017
Publisher Packt
ISBN-13 9781787286641
Length 458 pages
Edition 1st Edition
Languages
Concepts
Arrow right icon
Author (1):
Arrow left icon
Eduonix Learning Solutions Eduonix Learning Solutions
Author Profile Icon Eduonix Learning Solutions
Eduonix Learning Solutions
Arrow right icon
View More author details
Toc

Displaying blog post

We created the theme and added the header and navigation bar. All of this stuff on the page is now dynamic and integrated with WordPress, but this is all just static HTML.

Let's go back to our index.php page and go down to where we have the container content div, and we have different blog posts. We have three article tags with blog posts; we will delete two out of the three.

Then we will cut the paragraphs down and make it much shorter just so we can get it all in the page or in view. We want to write in this main block div, and we want to create our post loop.

First, we'll have to check for posts, and for that, we will enter if(have_posts),and then we have to end it after the ending </article> tag. We will put an else statement as well. If there are no posts, then we will enter php echo, with the wpautop() function, where we can put the text...

You have been reading a chapter from
Learn to Create WordPress Themes by Building 5 Projects
Published in: Dec 2017
Publisher: Packt
ISBN-13: 9781787286641
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime