Loop

About this Component

Loop Component is responsible to render the data on home, archive, search pages.

How to use:

Following are the steps to use this component.

step 1:

To initiate the support for this component in your theme just add the following code to the functions.php of the theme files.

This was the back-end part where we’ve just initiated, now to make it appear in the front-end follow the next step.

step 2:

To add the Loop in home, archive, search pages we need to call it where we want to display it.
example: add the following code in index.php, archive.php,search.php of the theme files.

with this, you’ll be able to set loop on your theme.

step 3:

Now create loop.php to get loop contents on pages. In this page you can show the posts list details with pagination. follow these steps to add the required content in loop.php

step 3-I:

To start loop

To end loop

step 3-II:

Inside the loop, you can show different contents of the loop according to your needs like:
Show image of post

Show title of post

Show excerpt(Short description) of post

Show Categories of post

Show posted date of post


Brief structure of loop.php

Step 4

To Start the pagination( which will add next page and previous page links )

Updated on September 9, 2017

Was this article helpful?

Related Articles

Add A Comment