Add a new element to the Standard Sliders Image Slide
-
Topic
-
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- You must be logged in to reply to this topic.
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: elements, slider, slider options
The current elements for each Full Size slide in the framework Standard Slider are:
Image Link, Headline, and Description
I would like to add one more element which will be just a checkbox. Below is the code I am using for the style option variable and my attempt to add it to the slider element array.
// modify the framework builder element options function rum_framework_element_mods( $elements ) { // set variable for new style option $style_option = array( 'id' => 'style_option', 'name' => 'Right Align Title', 'desc' => 'Check this box to toggle the title to the right side of the slide', 'type' => 'checkbox' ); // add the new option to the STANDARD SLIDER element array $elements['slider']['elements']['style_option'] = $style_option; return $elements; } add_filter( 'themeblvd_core_elements', 'rum_framework_element_mods' );
I either have the wrong $elements
array elements or I am doing calling the wrong filter “themeblvd_core_elements”.
Can you show me where I am going wrong?
One item I didn’t mention is this function included in a file that is loaded before the framework runs. Similar to how we added new options to builder elements.
include_once( 'includes/run-before-framework.php' ); require_once( get_template_directory() . '/framework/themeblvd.php' );
This approach could be over-complicating things.
Hello,
Unfortunately this isn’t going to work. The array you’re filtering is a configuration array that essentially declares which elements the various slider types support. The elements are pre-defined things that are already setup.
When the slider manager is outputting, it’s checking for these few pre-defined elements before outputting their controls. However, in adding a new element, you’re not really doing anything because the slider manager doesn’t know what these new elements are, and isn’t checking for them. I haven’t built any way in the slider manager for you to add new kinds of options or controls.
Ah, I see now. I was treating it like the Builder API when I have added new fields to the Slogan and Headline elements.
Thank you very much for your thorough explanation.