Lego2012
9/26/2016 - 10:11 PM

DWB EZ-Rows

DWB EZ-Rows

<?php
// Do NOT include the opening php tag

// Wrap each EZ home row in a separate div so they can get a full-width background color/image. The divs are injected via JS (jQuery). They will be applied only if the related row exists. The classes can be changed to whatever you want. Goes to Dynamik Custom - JS.

//* Goes to Dynamik Custom - Functions. Only if you want to use Kirki, else you won´t need it

//* Kirki Customizer configuration
add_filter( 'kirki/config', 'jr_kirki_config' );
function jr_kirki_config() {

	if ( class_exists('Kirki') && is_front_page() ) {

		$args = array( 'stylesheet_id' => 'dynamik_minified_stylesheet', );
 		
		return $args;
 
	}

}

//* Kirki Customizer options
if (class_exists('Kirki')) {

	//* Create EZ Home Slider section
	add_action( 'customize_register', 'jr_ez_home_slider_section' );
	function jr_ez_home_slider_section( $wp_customize ) {
 
		$wp_customize->add_section( 'ez_home_slider_section', array(
			'title'    => __( 'EZ Home Slider', 'dyanmik-gen' ),
			'priority' => 200
		) );
 
	}

	//* Create EZ Home Slider background setting
	add_filter( 'kirki/controls', 'jr_ez_home_slider_bg' );
	function jr_ez_home_slider_bg ( $controls ) {
 
		$controls[] = array(
		'type'         => 'background',
		'setting'      => 'ez_home_slider_bg_setting',
		'label'        => __( 'Background', 'dynamik-gen' ),
		'section'      => 'ez_home_slider_section',
		'default'      => array(
		'color'    => '#ffffff',
		'image'    => null,
		'repeat'   => 'repeat',
		'size'     => 'inherit',
		'attach'   => 'inherit',
		'position' => 'left-top',
		'opacity'  => false,
		),
		'priority' => 10,
		'output' => '#ez-home-slider-container-wrap',
		);
 		return $controls;

	}

	//* Create EZ Home Top section
	add_action( 'customize_register', 'jr_ez_home_top_section' );
	function jr_ez_home_top_section( $wp_customize ) {
 
		$wp_customize->add_section( 'ez_home_top_section', array(
			'title'    => __( 'EZ Home Top', 'dyanmik-gen' ),
			'priority' => 210
		) );
 
	}

	//* Create EZ Home Top background setting
	add_filter( 'kirki/controls', 'jr_ez_home_top_bg' );
	function jr_ez_home_top_bg ( $controls ) {
 
		$controls[] = array(
		'type'         => 'background',
		'setting'      => 'ez_home_top_bg_setting',
		'label'        => __( 'Background', 'dynamik-gen' ),
		'section'      => 'ez_home_top_section',
		'default'      => array(
		'color'    => '#ffffff',
		'image'    => null,
		'repeat'   => 'repeat',
		'size'     => 'inherit',
		'attach'   => 'inherit',
		'position' => 'left-top',
		'opacity'  => false,
		),
		'priority' => 10,
		'output' => '.full-width-top',/* was #ez-home-top-container before */
		);
 		return $controls;

	}

	//* Create EZ Home Middle section
	add_action( 'customize_register', 'jr_ez_home_middle_section' );
	function jr_ez_home_middle_section( $wp_customize ) {
 
		$wp_customize->add_section( 'ez_home_middle_section', array(
			'title'    => __( 'EZ Home Middle', 'dyanmik-gen' ),
			'priority' => 220
		) );
 
	}

	//* Create EZ Home Middle background setting
	add_filter( 'kirki/controls', 'jr_ez_home_middle_bg' );
	function jr_ez_home_middle_bg ( $controls ) {
 
		$controls[] = array(
		'type'         => 'background',
		'setting'      => 'ez_home_middle_bg_setting',
		'label'        => __( 'Background', 'dynamik-gen' ),
		'section'      => 'ez_home_middle_section',
		'default'      => array(
		'color'    => '#ffffff',
		'image'    => null,
		'repeat'   => 'repeat',
		'size'     => 'inherit',
		'attach'   => 'inherit',
		'position' => 'left-top',
		'opacity'  => false,
		),
		'priority' => 10,
		'output' => '.full-width-middle',/* was #ez-home-middle-container before */
		);
 		return $controls;

	}

	//* Create EZ Home Bottom section
	add_action( 'customize_register', 'jr_ez_home_bottom_section' );
	function jr_ez_home_bottom_section( $wp_customize ) {
 
		$wp_customize->add_section( 'ez_home_bottom_section', array(
			'title'    => __( 'EZ Home Bottom', 'dyanmik-gen' ),
			'priority' => 230
		) );
 
	}

	//* Create EZ Home Bottom background setting
	add_filter( 'kirki/controls', 'jr_ez_home_bottom_bg' );
	function jr_ez_home_bottom_bg ( $controls ) {
 
		$controls[] = array(
		'type'         => 'background',
		'setting'      => 'ez_home_bottom_bg_setting',
		'label'        => __( 'Background', 'dynamik-gen' ),
		'section'      => 'ez_home_bottom_section',
		'default'      => array(
		'color'    => '#ffffff',
		'image'    => null,
		'repeat'   => 'repeat',
		'size'     => 'inherit',
		'attach'   => 'inherit',
		'position' => 'left-top',
		'opacity'  => false,
		),
		'priority' => 10,
		'output' => '.full-width-bottom', /* was #ez-home-bottom-container before */
		);
 		return $controls;

	}	
	
		//* Create Above EZ Home widget section
	add_action( 'customize_register', 'sg_above_ez_home_section' );
	function sg_above_ez_home_section( $wp_customize ) {
 
		$wp_customize->add_section( 'above_ez_home_section', array(
			'title'    => __( 'Above EZ Home', 'dyanmik-gen' ),
			'priority' => 190
		) );
 
	}

	//* Create Above EZ Home widget background setting
	add_filter( 'kirki/controls', 'above_ez_home_bg' );
	function above_ez_home_bg ( $controls ) {
 
		$controls[] = array(
		'type'         => 'background',
		'setting'      => 'above_ez_home_bg_setting',
		'label'        => __( 'Background', 'dynamik-gen' ),
		'section'      => 'above_ez_home_section',
		'default'      => array(
		'color'    => '#ffffff',
		'image'    => null,
		'repeat'   => 'repeat',
		'size'     => 'inherit',
		'attach'   => 'inherit',
		'position' => 'left-top',
		'opacity'  => false,
		),
		'priority' => 10,
		'output' => '.above-ez-home-full-width',
		);
 		return $controls;

	}
	


	//* Create Below EZ Home widget section
	add_action( 'customize_register', 'sg_below_ez_home_section' );
	function sg_below_ez_home_section( $wp_customize ) {
 
		$wp_customize->add_section( 'below_ez_home_section', array(
			'title'    => __( 'Below EZ Home', 'dynamik-gen' ),
			'priority' => 240
		) );
 
	}

	//* Create Below EZ Home widget background setting
	add_filter( 'kirki/controls', 'below_ez_home_bg' );
	function below_ez_home_bg ( $controls ) {
 
		$controls[] = array(
		'type'         => 'background',
		'setting'      => 'below_ez_home_bg_setting',
		'label'        => __( 'Background', 'dynamik-gen' ),
		'section'      => 'below_ez_home_section',
		'default'      => array(
		'color'    => '#ffffff',
		'image'    => null,
		'repeat'   => 'repeat',
		'size'     => 'inherit',
		'attach'   => 'inherit',
		'position' => 'left-top',
		'opacity'  => false,
		),
		'priority' => 10,
		'output' => '.below-ez-home-full-width',
		);
 		return $controls;

	}
	
		//* Create Before Footer widget section
	add_action( 'customize_register', 'sg_before_footer_section' );
	function sg_before_footer_section( $wp_customize ) {
 
		$wp_customize->add_section( 'before_footer_section', array(
			'title'    => __( 'Before Footer', 'dynamik-gen' ),
			'priority' => 250
		) );
 
	}

	//* Create Before Footer widget background setting
	add_filter( 'kirki/controls', 'before_footer_bg' );
	function before_footer_bg ( $controls ) {
 
		$controls[] = array(
		'type'         => 'background',
		'setting'      => 'before_footer_bg_setting',
		'label'        => __( 'Background', 'dynamik-gen' ),
		'section'      => 'before_footer_section',
		'default'      => array(
		'color'    => '#ffffff',
		'image'    => null,
		'repeat'   => 'repeat',
		'size'     => 'inherit',
		'attach'   => 'inherit',
		'position' => 'left-top',
		'opacity'  => false,
		),
		'priority' => 10,
		'output' => '.before-footer-full-width',
		);
 		return $controls;

	}

	
}