Custom Dynamic Data Tags in Bricks

It is possible in Bricks to output the value returned by any function via

{echo:functionName}

whilst passing arguments if needed.

Sometimes you may want to add your own items to the "Select dynamic data" list since it is more convenient/easier.

This Pro tutorial provides one way to do this. We shall register a "Parent link" dynamic data tag which when selected sets the hyperlink URL to the parent post/Page of the current post/loop item and if a parent is not present, to #.

Prerequisite

Bricks child theme must be the active theme.

Step 1

Copy

/wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php

to

/wp-content/themes/bricks-child/providers.php

Replace

$classname = 'Bricks\Integrations\Dynamic_Data\Providers\Provider_' . str_replace( ' ', '_', ucwords( str_replace( '-', ' ', $provider ) ) );

with

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