Home
+Go to Appearance > Widgets, and drag items into Home1 to edit this area.
+ +diff --git a/inc/customizer.php b/inc/customizer.php index 2506830..19c9022 100755 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -131,11 +131,6 @@ function huskypress_parentSite_register( $wp_customize ) /**/ - - - - - function huskypress_navoption_register( $wp_customize ) { $wp_customize->add_setting( 'navoption1', //Give it a SERIALIZED name (so all theme settings can live under one db record) @@ -176,7 +171,138 @@ function huskypress_navoption_register( $wp_customize ) ) ); } -add_action( 'customize_register', 'huskypress_navoption_register' ); + add_action( 'customize_register', 'huskypress_navoption_register' ); +function huskypress_layoutoption_register( $wp_customize ) +{ + + /** + * Class to create the layout builder + */ + class Slider_Custom_Control extends WP_Customize_Control + { + /** + * Enqueue the styles and scripts + */ + public function enqueue() + { + wp_enqueue_script( 'layoutbuilder', get_template_directory_uri() . '/js/layoutbuilder.js', array( 'jquery' )); + wp_enqueue_script( 'jquery-ui-slider' ); + wp_enqueue_style('jquery-style', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.2/themes/smoothness/jquery-ui.css'); + } + + /** + * Render the content on the theme customizer page + */ + public function render_content() + { + + ?> +
+ '.$this->label.''; + if(strlen($this->description) > 0) echo ''.$this->description.'
'; + } + } + $wp_customize->add_section( 'layout_builder', + array( + 'title' => __( 'Layout Builder', 'mytheme' ), //Visible title of section + 'priority' => 35, //Determines what order this appears in + 'capability' => 'edit_theme_options', //Capability needed to tweak + 'description' => __('Allows you to customize homepage layout', 'huskypress'), //Descriptive tooltip + ) + ); + $wp_customize->add_setting( 'homepagerows', //Give it a SERIALIZED name (so all theme settings can live under one db record) + array( + 'default' => '2', //Default setting/value to save + 'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'? + 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting. + 'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? + ) + ); + $wp_customize->add_control('homepagerows', array( + 'type' => 'hidden', + 'label' => 'Rows', + 'section' => 'layout_builder', + 'priority' => 9 + ) + ); + //Add row settings/controls + for($i=0;$i<5;$i++){ + $wp_customize->add_setting( 'homepage_'.$i, //Give it a SERIALIZED name (so all theme settings can live under one db record) + array( + 'default' => '12', //Default setting/value to save + 'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'? + 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting. + 'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? + ) + ); + $wp_customize->add_control('homepage_'.$i, array( + 'type' => 'hidden', + 'label' => 'Row '.$i.' Width', + 'section' => 'layout_builder', + 'setting' => 'setting', + 'priority' => ($i+10), + 'class' => 'column' + ) + ); + } + $wp_customize->add_setting( 'slider', //Give it a SERIALIZED name (so all theme settings can live under one db record) + array( + 'default' => '0', //Default setting/value to save + 'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'? + 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting. + 'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? + ) + ); + $wp_customize->add_control( + new Slider_Custom_Control( + $wp_customize, + 'slider', + array( + 'label' => 'Slider', + 'priority' => 1, + 'section' => 'layout_builder' + ) + ) + ); + + + $wp_customize->add_setting( 'headingtest', //Give it a SERIALIZED name (so all theme settings can live under one db record) + array( + 'default' => '', //Default setting/value to save + 'type' => 'theme_mod', //Is this an 'option' or a 'theme_mod'? + 'capability' => 'edit_theme_options', //Optional. Special permissions for accessing this setting. + 'transport' => 'refresh', //What triggers a refresh of the setting? 'refresh' or 'postMessage' (instant)? + ) + ); + $wp_customize->add_control( + new Heading_Custom_Control( + $wp_customize, + 'headingtest', + array( + 'label' => 'Heading Test', + 'description' => 'Test description describing the heading test.', + 'priority' => 1, + 'section' => 'layout_builder' + ) + ) + ); +} +add_action( 'customize_register', 'huskypress_layoutoption_register' ); ?> \ No newline at end of file diff --git a/inc/reg-sidebars.php b/inc/reg-sidebars.php index 80191e5..8111f48 100644 --- a/inc/reg-sidebars.php +++ b/inc/reg-sidebars.php @@ -17,7 +17,7 @@ 'before_title' => '