Creating custom page settings inputs

Hi fellow developers,

Disclaimer
I’ve been looking in the documentation and on this forum for a few hours now and can’t find anything related to the subject. If the answer is somewhere out there, sorry for starting a new topic.

Situation
I am currently working on a Bricks project where we do some custom Bricks development. One of the things is that every single page needs some specific options (options that are normally sitewide, like fav Icon, cookiebanner content,…)

Question
I would like to put them under page settings. Can this be done? If so: Is there any good documentation out there?

Thanks in advance!
Kind regards.

Okay I got a bit further:

  • I can make custom tabs with controls in them. Figuring out how I can use the date it returns.
    Problem is: I’m doing all this based on a deep dive in the theme. I copy stuff and test it out. So far so good. Now I’m figuring out how to put it in the child theme or a separated plugin!

Part of my topic is answered, but if someone still has a better idea on how to get this done or can point to the right documentation: Feel free to share!

Hey @PandaGerrie

Interested to see where this deep dive leads / the end result. :+1:

But can I ask why decided not to use an options/settings page via ACF or metabox which provides the same functionality?

I posted this on the FB group but for anyone that stumbles upon this thread in the future, the filter you’re looking for is ‘builder/settings/page/controls_data’ and below is a sample of how you can add your own controls to the page controls.

add_filter('builder/settings/page/controls_data', function ($data) {
    $data['controlGroups']['landing-page-options'] = array(
        'title' => 'Landing Page Options',
    );

    $data['controls']['testField'] = array(
        'group' => 'landing-page-options',
        'type' => 'text',
        'label' => 'My Test Field',
    );

    return $data;

});

Note that you can replace “page” with “template” in the filter to add options there. This filter was found in includes/settings/base.php

3 Likes

Hi,
Sorry didn’t see this message.

We wanted to do it inside the Bricks builder, because its part of a tool for our clients to create landingpages and display them on their custom urls, all from 1 wordpress hosting.

Because the clients have no knowledge about this, all the clients see is a custom dashboard where they can make, edit and publish pages, but none of it is working within the Wordpress environment and UI. The only reason we place Wordpress in between there is to use the Bricks pagebuilder for designing and developing the pages.

So thats why this time we didn’t want to be relying on ACF or core / basic WP stuff.

Thanks, perfect for future reference!

We ended up doing it with a custom widget, for multiple reasons. For anyone interested: this is an example of how it works now → How to add tracking, pixel and cookiebanner – Pandapage

1 Like