Skip to content

Instantly share code, notes, and snippets.

@braginteractive
Last active May 12, 2017 16:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save braginteractive/1f6c15e236fdaac1e3d90bb86db337f9 to your computer and use it in GitHub Desktop.
Save braginteractive/1f6c15e236fdaac1e3d90bb86db337f9 to your computer and use it in GitHub Desktop.
Hero Banner settings for WordPress Customizer
<?php
if ( class_exists( 'Kirki' ) ) {
/**
* Add the theme configuration
*/
Kirki::add_config( 'strappress_theme', array(
'option_type' => 'theme_mod',
'capability' => 'edit_theme_options',
) );
Kirki::add_panel( 'homepage', array(
'priority' => 10,
'title' => __( 'Homepage', 'strappress' ),
'description' => __( 'Homepage Panel', 'strappress' ),
) );
/* Homepage Hero Section */
Kirki::add_section( 'homepage_hero', array(
'title' => __( 'Homepage Hero' ),
'description' => __( 'Homepage Settings' ),
'panel' => 'homepage', // Not typically needed.
'priority' => 160,
'capability' => 'edit_theme_options',
'theme_supports' => '', // Rarely needed.
) );
/* Homepage Hero Text */
Kirki::add_field( 'strappress_theme', array(
'type' => 'text',
'settings' => 'hero_text',
'label' => __( 'Hero Text', 'strappress' ),
'section' => 'homepage_hero',
'default' => esc_attr__( 'This is a default value', 'strappress' ),
'priority' => 10,
) );
/* Homepage Hero Image */
Kirki::add_field( 'strappress_theme', array(
'type' => 'image',
'settings' => 'hero_image',
'label' => __( 'Hero Image', 'strappress' ),
'description' => __( 'This is the hero image upload', 'strappress' ),
'section' => 'homepage_hero',
'default' => '',
'priority' => 10,
) );
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment