15th Apr '23
/
0 comments

Post Specific Footers in Bricks using Meta Box

This Pro tutorial provides the steps to output post-specific footer using Meta Box' Post type of field when using Bricks.

Sample screenshots below.

Course CPT item:

Course 1's footer has been set to be Footer 1

Footer CPT item:

Populating Footer 1's custom fields

Course 1 on the front end:

Another course, Course 2 whose Footer field has been set to Footer 2:

We shall set this up such that single course pages that don't have a footer set and all other pages of the site (like the homepage, blog posts index) will output the field values from a "Default Footer".

Step 1

Install and activate Meta Box and Meta Box AIO plugins.

Create Course and Footer CPTs.

Step 2

Create a field group for the Course CPT having a Post type of field set to footer post type.

Step 3

Create a field group for the Footer CPT having a Group field like this [field group export JSON (mirror)]:

Step 4

Create your post-specific footers.

Make sure to also create a default footer.

Edit your Course CPT entries and select the corresponding footers.

Step 5

Edit your Footer template with Bricks and paste this JSON.

In the outer loop, we are querying the Footers. But this is going to pull all the footer CPT items. In the next step, we shall limit this to only the footer that has been set (if set) for the current single course (when on a single course page) or the default footer.

In the inner loop, the query is set to "Footer Links" - a custom query type that we are going to create in the next step. Since this does not exist yet, after doing Step 5 you may have to come back and ensure that the query type is set correctly.

The heading text inside the inner loop is set to:

{echo:bl_get_looping_sub_field(header)}

and the Basic Text element's text set to:

{echo:bl_get_looping_sub_field_links}

Step 6

Add the following in child theme's functions.php or a code snippets plugin:

This is a BricksLabs Pro tutorial.

For full access login below or create your BricksLabs Pro account

Get access to all 633 Bricks code tutorials with BricksLabs Pro

Related Tutorials..

Output HappyFiles Folders in Metabox Select-Field

Output HappyFiles Folders in Metabox Select-Field

This tutorial is part of a series where I'm gonna show you how to output custom HappyFiles Galleries and Sliders. Part one will cover a…
Categories:
Latest Featured Posts First in Bricks Query Loop (No Duplicates)

Latest Featured Posts First in Bricks Query Loop (No Duplicates)

In the Bricks Facebook group a user asks: We can use AI to help unfreeze our brains sometimes or at least have it write the…
Categories:
Pro
Dynamic Posts Lightbox in Bricks using GLightbox

Dynamic Posts Lightbox in Bricks using GLightbox

Steps to set create a dynamic lightbox with content from the post inside of the query loop.
Categories:
Pro
Posts Grouped by Taxonomy Terms in Bricks using BricksExtras’ Dynamic Table and Pro Tabs

Posts Grouped by Taxonomy Terms in Bricks using BricksExtras’ Dynamic Table and Pro Tabs

How to output any post type, with the taxonomy terms as Tab titles and posts inside tables with sortable columns.
Pro
Nav Menus Custom Query Types in Bricks

Nav Menus Custom Query Types in Bricks

Updated on 21 Aug 2024 This Pro tutorial shows how custom query types for each navigation menu can be generated in Bricks. This enables us…
Show Product Categories Count Using Bricks Filter Hook

Show Product Categories Count Using Bricks Filter Hook

Unable to find terms count from the Dynamic Data provided by Bricks theme? It's okay, this simple tutorial shows you how to properly get the…
Categories:
Tags:
Filtering out Media Items from “Select post/page” Bricks control

Filtering out Media Items from “Select post/page” Bricks control

The dropdown that appears after choosing "Internal post/page" when setting a link in Bricks shows media (attachment) items besides Pages, Posts and other CPTs. If…