This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Tagged: ,

Error calling themeblvd_add_builder_element

  • Creator
    Topic
  • #11468
    srumery
    Participant

    I am following the guide you put together for adding a new element to the builder using the API which can be found here: http://dev.themeblvd.com/tutorial/add-remove-builder-elements/

    It references the function themeblvd_add_builder_element but every time I call it, I get the following error:

    Fatal error: Call to undefined function themeblvd_add_builder_element()

    I searched through the Theme Blvd Layout Builder plugin code to see if there was a typo or something but nothing obvious turns up. I even tried using the code straight off the page in the developer docs and it still fails.

    themeblvd_add_builder_element( 'my_new_element', 'My New Element', 'none', $options, 'display_my_new_element' );

    How can I get this to work?

    Version Information:
    WordPress: 3.6
    Jump Start: 1.1.2
    Theme Blvd Layout Builder: 1.2.0

    • This topic was modified 7 years, 9 months ago by srumery. Reason: change to for one section
Viewing 7 replies - 1 through 7 (of 7 total)
  • Author
    Replies
  • #11470
    Jason Bobich
    Keymaster

    Hi,

    I just double checked everything on my end and there’s no issues over here. Where are you putting your code exactly? Is it going in your child theme’s functions.php after the framework is included at the top?

    #11478
    srumery
    Participant

    I was putting it in a plugin so that I could use it across a few child themes. That was the intent but that approach may be causing the problem. I’ll add the code as an include file in one of my child themes for now.

    If I am able to it as a plugin, what can I wrap around my code so it gets fired off at the right time?

    #11481
    Jason Bobich
    Keymaster

    So, for this it’s important to understand the loading process WordPress goes through with it’s files and action hooks.

    Order of included files:

    1. Plugin files
    2. Child theme’s functions.php
    3. Parent theme’s functions.php

    Here are all of the action hook loading points:

    http://codex.wordpress.org/Plugin_API/Action_Reference

    For this, you’ll need to put it in a function that is hooked to after_setup_theme.

    #11482
    srumery
    Participant

    UPDATE: I added the code to an include file that is called from the child theme functions.php AFTER the call to the framework and it worked! This is great, thank you! 🙂

    I would prefer this functionality be set in a plugin to make it more portable for other child themes. Can I call my custom builder function from the after_setup_theme hook like your other plugins similar to this?

    add_action( 'after_setup_theme', 'themeblvd_favicon_init' );
    #11483
    srumery
    Participant

    Ha! Your post beat mine by 12 seconds. Thank you for your guidance and attention to detail. I love this framework!!

    Onward!

    #11487
    Jason Bobich
    Keymaster

    Yeah, so you can definitely do that. But just make sure you’re name-spacing your own functions like —

    srumery_do_whatever() {
         // ...
        themeblvd_add_builder_element( ... );
    }
    add_action( 'after_setup_theme', 'srumery_do_whatever' );
    #11497
    srumery
    Participant

    I’ve got it all wrapped in a nice little plugin now. Brilliant!

    Thank you, Jason.

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.