How to disable wrapper section for specific shortcode?
Hi team,
Do we have any way to disable wrapper section for specific shortcode ? Currently, We have 2 type of shortcode : column and section, can we have another type to process in the Corrector ?
Thanks
I found a config to disable for whole Page Builder extension : "disalbe_correction". It's good if we have the same for each short-code :)
Hi @maiakhoa,
I understand what are you saying, but can you tell me more about your use case, what kind of shortcode do you want to create, how should it look in the page builder (in the backend): is it something custom like the section or column shortcodes, or is it ordinary like the rest all the shortcodes from the Content elements tab. Please also provide some code for me to understand what kind of html do you want the shortcode to generate in the frontend.
Hi @rockalife , Currently, I'm using bootstrap for the theme, so I have a slider shortcode and I don't want it's wrapped by Section and Row. It will have a padding of "Container" class. I can handle it in the Section shortcode if I can have the name of that short-code.
<section>
<div class="container"> //Gen by Section shortcode
<div class"row> //Gen by Row shortcode
<div class="column"> //Gen by Column shortcode
Slider Code
</div>
</div>
</div>
</section>
The thing I want as below :
<section>
Slider Code
</section>
I understood, currently this is not possible, could you rewrite the css for your slider div and give it some negative margin so it would stretch outside of the column and the column's padding would not affect it ?
ok thank @rockalife
Hi ThemeFuse,
I think I have the same kind of problematic.
If I'm not wrong when I add a shortcode, it's always wrapped inside a section. Why doing this?
At least could this behavior be optional.
If we want the section wrapped, we just have to put our shortcode inside a section block…
My idea to solve this is to override the section shortcode with an option to wrap it or not:
With wrap attr:
<section>//Gen by Section shortcode
<div class="container"> //Gen by Section shortcode
<div class="row> //Gen by Row shortcode
<div class="column"> //Gen by Column shortcode
My shortcode code (can be a text block for instance)
</div>
</div>
</div>
</section>
Without wrap attr:
<div class="row> //Gen by Row shortcode
<div class="column"> //Gen by Column shortcode
My shortcode code (can be a text block for instance)
</div>
</div>
The stupid think is that the user will have to nest his shortcode in a section to remove this section.
Am I wrong? Is it possible to do it an other way? Would it be possible to not render this section code if the the shortcode is not inside a section?
I think that the same happen with row and column.
Thanks.
@flody :+1: if anything is outside the section or row , it should render without the wrappers.
All current themes that run on Unyson use this behavior and will break the design/html if we will change it. So there should be a settings parameter to enable/disable it (by default enabled).
P.S. I have no idea how it works and if it will be possible to change/fix this issue, I just wanted to say about the settings parameter.
yes , param would be fine , default enabled to take care of legacy
:+1: . It should be supported param to disable
Currently there is a filter, and you can try to debug and check two arrays and decide what to return (this seems a little complicated, but it's a solution until that config parameter will be added)
function _filter_theme_fw_ext_page_builder_item_correction_complete(
$corrected_items,
$corrector_instance,
$initial_items
) {
// debug
{
ob_start();
fw_print($initial_items, $corrected_items);
FW_Flash_Messages::add(fw_rand_md5(), ob_get_clean());
}
return $corrected_items;
}
add_filter(
'fw_ext_page-builder_items_correction_complete',
'_filter_theme_fw_ext_page_builder_item_correction_complete',
10,
3
);
https://github.com/ThemeFuse/Unyson/issues/799
### If you want to completely remove fw wrapper from your custom specific shortcode. add this on your shortcode config.php file
your-theme/framework-customizations/extensions/shortcodes/shortcodes/{my-shortcode-name}/config.php
**`'disable_correction' => true,`**
It will remove the fw default fw-container div and fw-row div.
$cfg['page_builder'] = array(
'disable_correction' => true,
'title' => __( 'My shortcode', 'fw' ),
'description' => __( 'desc', 'fw' ),
'tab' => __( 'My Element', 'fw' ),
);
Next step : past below code on the same file (config.php) and it will remove fw default main wrapper div class="fw-page-builder-content"
add_filter ( 'fw_ext_page_builder_output_content_wrapper', function(){
return false;
} );