What is the 'element condition' for 'frontpage' - using Bricks in-page conditions?

I don’t believe there is one, but see image here first so you know what I’m talking about…

But I have standard bricks header template (working great) which include the site nav and everything but also a hero banner that gets applied across the whole site (because it’s in the header, right) but for the homepage I want to hide it. Simples.

But I can’t seem to get any kind of condition to hide the block on the homepage, for instance if set the Current URL is ‘/’ the condition seems to fail or rather succeeds in stopping the hero banner appearing on every page on the site. If I reset the Current URL to isnot ‘/’ that gets ignored and the banner gets applied to all pages.

Ideally, it would be great to have a ‘frontpage’ selector in these conditions that would make this super-easy/logical for everyone (let’s call that a feature request) UNLESS there is some way achieving this simple condition that has eluded me so far.

I have even tried adding a ‘homepage’ category term to the static page being used for the homepage but that also doesn’t work either a ‘contains’ or doesn’t contain is == or != so it appears that the in-page conditions aren’t working on static homepages - unless I’m wrong?

Any help would be much appreciated with this. Obviously I realise I could create a new header just for the homepage using the Bricks Header condition system but it seems daft I can’t get the in-page element conditions to achive the same.

Many thanks - in advance.

Q.

Hey @Quantos,

you can use the dynamic echo tag and the is_front_page function (see documentation):

Don’t forget to allow the function to be used with the echo tag (see academy article):

add_filter( 'bricks/code/echo_function_names', function() {
    return [
        'is_front_page',
    ];
} );

Best,

André

1 Like

Brilliant - thanks Andre… although I’m not ‘real’ developer so I’ll see if I can persuade the Bricks Boys to add that as a proper built-in function for the conditions too… but will add that for now many thanks.

Q.

That is really good to know André. I’ll keep this in mind :+1: