ThemeFuse / Unyson

A WordPress framework that facilitates the development of WP themes
http://unyson.io
921 stars 216 forks source link

Adding custom class to existing modules of Page Builder #694

Closed mbtocalli closed 9 years ago

mbtocalli commented 9 years ago

Hi, I/m starting to deep into Unyson framework. I just want to know if it is possible to add custom metaboxes to existing shortcodes. For instance, the SECTION shortcode/module allows me to use an image as a background, but can't choose to set the background-size to cover or background-attachment to fixed in order to get a stylished section. Another important metabox to add to all shortcodes/modules will be custom classes, this way, style customization will be possible with CSS.

ghost commented 9 years ago

I just want to know if it is possible to add custom metaboxes to existing shortcodes. For instance, the SECTION shortcode/module allows me to use an image as a background, but can't choose to set the background-size to cover or background-attachment to fixed in order to get a stylished section.

You can overwrite this options file in

{theme}/framework-customizations/extensions/shortcodes/shortcodes/section/options.php

and add/change any option you want. But you will also need to overwrite this view because it expects those options values in the $atts variable, if some option will not exist, the view will not work properly (php notice: array key does not exist).

http://manual.unyson.io/en/latest/extension/shortcodes/index.html#contents

Another important metabox to add to all shortcodes/modules will be custom classes, this way, style customization will be possible with CSS.

So you want the user without programming skills to add css classes for every shortcode and to write css for them?

I recommend to use only options and generate css from their values.

mbtocalli commented 9 years ago

Hi! thanks for your response. I don't want the final user without programming skills write css, instead, I think it could be useful to let them add (or select) preexisting classes. This classes could be explained in the same metabox description or even in a separate tutorial. Every premium themes has shortcodes that the user MUST read the tutorial before use them.

ghost commented 9 years ago

Good luck