6th Dec '23
/
1 comment

Color Custom Field as Section Background Color on Category/Term Archives in Bricks

Updated on 15 Sep 2024

Looking to apply a color picker type of custom field’s value for categories/custom taxonomy terms as the background color of a hero section on the category/term archive pages in Bricks?

A term archive page for which a blue color is set:

Another term archive page for which no color is set (shows the default):

This tutorial shows how.

Step 1

Using a plugin like ACF or Meta Box, create a field group whose location is set to your category or custom taxonomy.

Add a field of Color Picker type.

Notice that we have set a default value of #333.

Step 2

Edit your categories or taxonomy terms and assign a color for each.

Step 3

Create a template of “archive” type for your category/term archive pages and edit it with Bricks.

Apply a template condition to ensure that it applies to the correct category/term archive pages.

Add a Section and inside its Container, a h1 Heading having:

{term_name}

Select the Section → STYLE → ATTRIBUTES.

Add a style attribute having this value:

background-color:{acf_service_category_color}

Replace acf_service_category_color with the dynamic tag of your custom field.

Update 1

If you use JetEngine the process is similar.

For the style attribute value type background-color: then position the cursor at the end and pick your custom field name.

Ex.:

background-color:{je_service-category_service_category_color}

where service-category is the taxonomy slug and service_category_color is the name/ID of the Colorpicker JetEngine field.

Get access to all 610 Bricks code tutorials with BricksLabs Pro

1 comment

Leave a Reply to Manos G (Cancel Reply)

 

Related Tutorials..

How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 2)

How to populate a map with dynamic markers from a CPT using ACF in Bricks (PART 2)

This tutorial provides the PHP & JS codes that can be pasted in order to create a flying effect on map markers each time your…
Pro
Programmatically populating ACF field values in WordPress

Programmatically populating ACF field values in WordPress

An example of how to set the values of a Select-type field with the names and labels of all public post types.
Categories:
Pro
Meta Box Image Advanced Field Images in Bricks Query Loop

Meta Box Image Advanced Field Images in Bricks Query Loop

Updated on 3 Feb 2025 A user asked: Do you know what the best way to query an image from metabox gallery? I would like…
Categories:
Tags:
Limiting the Query Loop Posts Output to Post IDs From a Custom Field in Bricks

Limiting the Query Loop Posts Output to Post IDs From a Custom Field in Bricks

A user asks: Recently Bricks introduced the PHP query editor that lets us modify the query parameters right within the query dialog of the builder…
Categories:
Tags:
Pro
Upcoming Events Grouped by ‘Month Year’ in Bricks

Upcoming Events Grouped by ‘Month Year’ in Bricks

A custom query loop type for showing future events based on a date custom field using three nested query loops.
Pro
Conditional Rendering of ACF Repeater Rows Based on True / False Sub Field in Bricks

Conditional Rendering of ACF Repeater Rows Based on True / False Sub Field in Bricks

This Pro tutorial provides the steps to modify a ACF Repeater query loop to only output the rows for which a True / False type…
Categories:
How to create filters with IsotopeJS in Bricks (Part 3): apply multiple filters

How to create filters with IsotopeJS in Bricks (Part 3): apply multiple filters

This tutorial will review how to apply multiple filters to an isotope container using the IsotopeJS library‘s features in Bricks.