Home Forums Theone WordPress Theme How to extend Pagebuilder with custom modules / custom post type?

This topic contains 3 replies, has 2 voices, and was last updated by  jonramvi 2 years, 6 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #7177

    jonramvi
    Participant

    What is the correct way to extend your pagebuilder with a custom module? I have a custom post type which I will create my own view for, but I need to be able to add it to the page.

    #7178

    jonramvi
    Participant

    That is, it it possible without writing files to the parent theme? That would be helpful when it comes to upgrading.

    Now I first add the module to the Pagebuilder module’s array:

    function add_calender_to_pagebuilder($modules) {
        $modules['ramvi_calendar'] = __('Calendar','ux');
        return $modules;
    }
    add_filter('ux_pb_config_fields', 'add_calender_to_pagebuilder');

    Then I add a file with the same name (ramvi_calendar) to theone\functions\pagebuilder\modules directory.

    #7183

    BWSM
    Keymaster

    That is, it it possible without writing files to the parent theme? That would be helpful when it comes to upgrading.

    There is not easy way.
    —————
    You need add the new module name to array in pagebuilder-modules.php. I suggest you replace a module that you don’t need.

    • This reply was modified 2 years, 6 months ago by  BWSM.
    • This reply was modified 2 years, 6 months ago by  BWSM.
    #7195

    jonramvi
    Participant

    There is not easy way.

    Is there a hard way?
    My guess is no. Here’s a way of allowing developers to add modules without editing the parent theme:
    In the ux_pb_modules function you use apply_filters which allow me to add my module. But in your ux_pb_require_modules function you don’t allow for dynamic imports. It’s hardcoded to importing from the parent theme. Instead, create an array of the import paths (almost like in the ux_pb_modules function) and use apply filter. I can then find my module and edit it’s path.

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.