I would love it if there were an option setting that let you pick media, for use by things like background images.
Plugin Author
GDY
(@grandy)
Hey aredridel,
Right now it is possible to add a option field that can be used for the module background. In the example-files folder (inside the plugin folder) is a example module that has a option field for the background color. But right now it is only possible to add text or select option fields …
I have plans for a link and image option field that let you pick that contents with the link/media window.
Right now im focused on the documentation (cooming soon) and a utility plugin for easier installation and module management (also cooming soon).
After that there are coming new features like image links and these new option fields 😉
Plugin Author
GDY
(@grandy)
Here is a snippet how you can add module backgrounds with the current options:
add_action( ‘gdymc_modulesettings’, function ( $module ) {
optionInput( ‘background’, array(
‘type’ => ‘select’,
‘options’ => array(
‘white’ => __( ‘White’, ‘Domain’ ),
‘bright’ => __( ‘Bright’, ‘Domain’ ),
‘dark’ => __( ‘Dark’, ‘Domain’ ),
‘highlight’ => __( ‘Highlight’, ‘Domain’ ),
),
‘default’ => ‘white’,
‘label’ => __( ‘Module background’, ‘Domain’ ),
), $module->id );
}, 5, 1 );
add_filter( ‘gdymc_module_class’, function( $classes ) {
$layout = optionGet( ‘background’ );
$classes[] = ‘background_’ . $layout;
return $classes;
} );
Place this in your themes functions.php to add this option to all GDYMC modules. This adds a class to the module container so you can set your background in your stylesheet like this:
.background_bright { background: url(https://www.toptal.com/designers/subtlepatterns/patterns/sports.png) repeat; }