Inserting Random Ad Between Posts in Bricks

This Pro tutorial provides the steps to insert a random post of ad post type in between regular posts on the Posts page (blog posts index) whilst ensuring that pagination is not broken in Bricks.

We shall use ACF (a different plugin like Meta Box can also be used) to create a URL-type of custom field for entering the webpage that the ads should link to.

Step 1

Create ad CPT.

Create an associated field group having a URL type of field.

Add as many ad CPT entries as needed.

Step 2

Edit the Page set as the Posts page (at Settings → Reading) with Bricks.

Copy the following JSON and paste to paste the entire pre-built Section from our test site:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Instant access to all 250+ Bricks code tutorials with BricksLabs Pro