Create Custom Section and Column Shortcodes
How to create custom section and column shortcodes and disable built in one, thanks.
Please give us more details, why do you need to do that? Maybe it will be easier to customize the existing one.
Hi,
i am not sure if my issue is related to this one, but let me explain.
when starting with new page switch to visual editor, and add only text block.
and when i look at source code, i see html coming from section shortcode by default, which i do not need.
i think section should be included in output if really i added it from visual editor.
Hi @pudeco,
Not sure that I understood what are you trying to say.
when starting with new page switch to visual editor, and add only text block. and when i look at source code, i see html coming from section shortcode by default, which i do not need.
Do you mean that when you switch to the Page Builder and add only a text block shortcode it is wrapped into a section (with a row and a column inside) and you do not want the section. The section appears because the Page Builder and all the built-in shortcodes uses a grid system that is almost identical to Bootstrap and when you drag just a text block shortcode it wraps it inside a section, row and column. If all that you need for a page is just text, why don't you just use the default WordPress editor.
i think section should be included in output if really i added it from visual editor.
Not sure what you are saying. As far as I know the sections does appear only when constructing the page with the Page Editor.
Hi @blackmekemeke,
Creating your own section and columns is not simple, it would be better if you could customize the built-in ones to suit your needs. What is that the default ones lack and you need ?
yes, exactly, it is wrapping it inside fw-row and fw-col-12 divs.
text block shortcode was just an example. i am using my custom shortcodes, and custom grids, so was trying a way to get rid of thoose rows.
@pudeco, can you list a simple example of your custom grid, so that I could see if it could be accomplished with the Page Builder.
@rockalife i do not have specific grid system. i am using sass with susy and breakpoint, which gives me flexible grids. i am not having problem with thoose fw-cols and fw-rows. i am not using twitter bootstrap, so for me they are just empty divs
@rockalife by the way, i copied column and row directories to framework customization folder inside my theme, removed everything except view.php. and in view.php removed divs with row and col classes, and solved it this way.
is there any way to overwrite function _theme_filter_prevent_autop ?
@pudeco, do you want to overwrite the function because it adds an extra div ?
I plan to figure out a way to accomplish just that the following week. It was added because the autop filter added some <br/> and wrapping the content into a div seems to solve this. Again, I'll see what I can do, it should come in a later release.
@rockalife, i built my theme using earlier version of unyson, and some features that i added to section and column shortcodes don't work in the unyson v 2.x. I want to add parallax background and some other features to section and now i got what i need by customizing the built in one.
My other question, how to remove 1/6 col shortcode?
how to remove 1/6 col shortcode?
Overwrite the default_item_widths configuration parameter in framework-customizations/extensions/builder/config.php
@rockalife yes, just wanted to get rid of the div with fw-page-builder-content class. if it cant be removed, than i will leave it as it is.
thanks.
just wanted to get rid of the div with fw-page-builder-content class
You can use this filter to change/remove the fw-page-builder-content class
The div was added to prevent the WordPress autop to change/break the html by adding <p> where it is not needed.
@blackmekemeke,
My other question, how to remove 1/6 col shortcode?
I have opened a separate issue and answered, check it out here. You can write if it worked for you there.
@pudeco, I will open a separate issue for
is there any way to overwrite function _theme_filter_prevent_autop
and
just wanted to get rid of the div with fw-page-builder-content class
as soon as will find a solution. I will provide the link here in a comment once that will be done.
For now I am closing this issue.
Modifying the existing builder will mean we have to lose the bootstrap grid system, at times we do not want to lose something we just want to add something extra.
I can see lots of cases where the current grid system would suit just great and other cases where i would need/want to use a flexible box structure of the layout. Modifying the existing builder to adapt it to the flexible box structure would mean renouncing of the bootstrap grid structure, which would not be the case.
So is there a way or a documentation how we can build an "additional" columns shortcode without loosing what unyson has to offer already?
The problem definition is simple. We want to render custom rows (.fw-main-row) inside the "fw-page-builder-content" div. And we want custom rows - that we 've created - to appear in page builder as custom-sections (e.g. testimonials-section).
I guess that this can be created with an "x-section" shortcode. So, whenever we want to have a custom row/section, we must create a new "x-section" shortcode.
The view.php file of "x-section" shortcode may be written (it's just an example to show that we don't want the same architecture with the built-in section shortcode):
<section class="fw-main-row">
<div class="x-section">
<?php echo do_shortcode( $content ); ?>
</div>
</section>
@rockalife @moldcraft Is there any solution for this problem?
@SynapsisIT @assigeo The section and row shortcodes were written a long time ago, in order to give you a solution I must inspect the code, remember how it works and figure out how to implement what you are requesting. So we are almost at the same level, you can inspect and debug the code yourself to figure out a solution. (I have other tasks to do, sorry)