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

The main product post page

In this section, we'll work on this main content area, the area where the posts show up. Right now it's just a bunch of static HTML, so we'll go ahead and fix that.

So let's go into the index.php file in the MyShop folder in themes. Let's go to div class="products" where we have 4-column divs to represent each product. We'll add a class of row on this products div and then get rid of all but one of these 4-column divs. We'll preserve the div tag with the black shirt details. We'll get rid of all the div tags and then inside the 4-column div we'll go right above it and create our while loop.

Before we do the while loop, though, let's make sure that there are some posts. So we'll say if(have_posts) and then we'll end it. Also, if there are some posts then we want our while loop:

&lt...
lock icon The rest of the chapter is locked
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 R$50/month. Cancel anytime