Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- class Modular_Customizer_Output {
- public $output = array();
- public function __construct() {
- add_action( 'wp_enqueue_scripts', array( $this, 'my_styles_method' ) );
- add_filter( 'customize_dynamic_setting_args', array( $this, 'modular_add_output' ), 10, 2 );
- }
- public function modular_add_output( $settings_args, $setting_id ) {
- $output_css = '';
- $output = $settings_args['output'];
- if ( ! empty( $output ) ) {
- $element = $output[0]['element'];
- $property = $output[0]['property'];
- $value = get_theme_mod( $setting_id );
- $output_css .= $element . '{ ' . $property . ': ' . $value . '}';
- $this->output = $output_css;
- }
- }
- function my_styles_method() {
- wp_add_inline_style( 'modular-style', $this->output );
- }
- }
- new Modular_Customizer_Output();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement