This thread is over two years old and may be outdated. Please create a new thread if you need help, or email us if you have an active Premium license.

How to Bundle Prebuilt Layouts in Page Builder 2.5+?

8 years ago · Last reply by Andrew Misplon 8 years ago

The documentation for bundling prebuilt layouts (https://siteorigin.com/docs/page-builder/bundling-prebuilt/) refers to v2.4.x.

Version 2.5 has import / export functionality for layouts but it is unclear how to bundle these with a theme.
I’ve tried out the new Layout Viewer theme on Github but this is overkill for what I want to do.

How do I set up bundled layouts so my users can use them without needing to import each time?

This is our free support forum. Replies can take several days.

Need fast email support? Get SiteOrigin Premium

Replies

5
  1. Andrew Misplon Staff 8 years, 6 months ago

    Hi Julian

    Thanks for the bump. Will get those docs updated ASAP. The new method will look something like this:

    https://github.com/robhope/fullsingle/blob/master/functions/function-layouts.php
    https://github.com/robhope/fullsingle/blob/master/layouts/flyleaf/flyleaf.php

    Let me know if that helps.

  2. Julian Weaver 8 years, 6 months ago

    The old documentation for functions.php still works:

    function mytheme_prebuilt_layouts($layouts){ 
        ...[see code below]
        return $layouts;
        }
    add_filter('siteorigin_panels_prebuilt_layouts','mytheme_prebuilt_layouts');

    Unfortunately you need to decode the json and extract the array from the resulting object:

    function mytheme_prebuilt_layouts($layouts){
        $layouts['<name>'] = array(
            'name' => __('Two Column', 'theme'),    // Required
            'description' => __('Two Column Template', 'theme')    // Optional
        );
        $arr = json_decode('<exported json here>');
        $layouts['<nane>']['widgets'] = $arr->widgets;
     return $layouts;
    }
    add_filter('siteorigin_panels_prebuilt_layouts','mytheme_prebuilt_layouts');

    NB: this is just an example, you’d probably want to decode the json once offline and insert the array instead.

  3. Julian Weaver 8 years, 6 months ago

    @andrew, thanks for the code. I posted before seeing your reply. I’ll try that now.

  4. Julian Weaver 8 years, 6 months ago

    @Andrew Thanks, that works.

    For anyone copy/pasting @andrew’s code:

    the layouts directory should go at the top level of your themes directory, not in your theme
    Change the path set in $layout_dir in function_layouts.php to move it into your theme dir.

  5. Andrew Misplon Staff 8 years, 6 months ago

    Thanks for adding the notes. Glad to hear you’ve made progress. Sorry for the hassle.

Replies on this thread are closed.

Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Have a different question or issue?

Start New Thread