init commit

This commit is contained in:
2023-07-04 11:21:47 -07:00
commit ce48e96737
105 changed files with 28651 additions and 0 deletions

View File

@@ -0,0 +1,176 @@
<?php
/**
* Define callback functions for active_callback.
*
* @package Sophia After Dark
* @since 1.0.0
*/
if ( ! function_exists( 'sophia_after_dark_enable_top_header_active_callback' ) ) :
/**
* Check if top header option is enabled.
*
* @since 1.0.0
*
* @param WP_Customize_Control $control WP_Customize_Control instance.
*
* @return bool Whether the control is active to the current preview.
*/
function sophia_after_dark_enable_top_header_active_callback( $control ) {
if ( false !== $control->manager->get_setting( 'sophia_after_dark_enable_top_header' )->value() ) {
return true;
} else {
return false;
}
}
endif;
if ( ! function_exists( 'sophia_after_dark_enable_top_header_trending_active_callback' ) ) :
/**
* Check if top header option and trending section option is enabled.
*
* @since 1.0.0
*
* @param WP_Customize_Control $control WP_Customize_Control instance.
*
* @return bool Whether the control is active to the current preview.
*/
function sophia_after_dark_enable_top_header_trending_active_callback( $control ) {
if ( false !== $control->manager->get_setting( 'sophia_after_dark_enable_top_header' )->value() && false !== $control->manager->get_setting( 'sophia_after_dark_enable_trending' )->value() ) {
return true;
} else {
return false;
}
}
endif;
if ( ! function_exists( 'sophia_after_dark_enable_top_header_live_now_active_callback' ) ) :
/**
* Check if top header option and trending section option is enabled.
*
* @since 1.0.0
*
* @param WP_Customize_Control $control WP_Customize_Control instance.
*
* @return bool Whether the control is active to the current preview.
*/
function sophia_after_dark_enable_top_header_live_now_active_callback( $control ) {
if ( false !== $control->manager->get_setting( 'sophia_after_dark_enable_top_header' )->value() && false !== $control->manager->get_setting( 'sophia_after_dark_enable_live_now' )->value() ) {
return true;
} else {
return false;
}
}
endif;
if ( ! function_exists( 'sophia_after_dark_section_slider_option_active_callback' ) ) :
/**
* Check if slider option is enabled.
*
* @since 1.0.0
*
* @param WP_Customize_Control $control WP_Customize_Control instance.
*
* @return bool Whether the control is active to the current preview.
*/
function sophia_after_dark_section_slider_option_active_callback( $control ) {
if ( false !== $control->manager->get_setting( 'sophia_after_dark_section_slider_option' )->value() ) {
return true;
} else {
return false;
}
}
endif;
if ( ! function_exists( 'sophia_after_dark_section_top_featured_posts_option_active_callback' ) ) :
/**
* Check if top featured posts option is enabled.
*
* @since 1.0.0
*
* @param WP_Customize_Control $control WP_Customize_Control instance.
*
* @return bool Whether the control is active to the current preview.
*/
function sophia_after_dark_section_top_featured_posts_option_active_callback( $control ) {
if ( false !== $control->manager->get_setting( 'sophia_after_dark_section_top_featured_posts_option' )->value() ) {
return true;
} else {
return false;
}
}
endif;
if ( ! function_exists( 'sophia_after_dark_enable_footer_widget_area_active_callback' ) ) :
/**
* Check if foooter menu option is enabled.
*
* @since 1.0.0
*
* @param WP_Customize_Control $control WP_Customize_Control instance.
*
* @return bool Whether the control is active to the current preview.
*/
function sophia_after_dark_enable_footer_widget_area_active_callback( $control ) {
if ( false !== $control->manager->get_setting( 'sophia_after_dark_enable_footer_widget_area' )->value() ) {
return true;
} else {
return false;
}
}
endif;
if ( ! function_exists( 'sophia_after_dark_enable_footer_menu_active_callback' ) ) :
/**
* Check if foooter menu option is enabled.
*
* @since 1.0.0
*
* @param WP_Customize_Control $control WP_Customize_Control instance.
*
* @return bool Whether the control is active to the current preview.
*/
function sophia_after_dark_enable_footer_menu_active_callback( $control ) {
if ( false !== $control->manager->get_setting( 'sophia_after_dark_enable_footer_menu' )->value() ) {
return true;
} else {
return false;
}
}
endif;
if ( ! function_exists( 'sophia_after_dark_enable_pnf_latest_posts_active_callback' ) ) :
/**
* Check if pnf latest posts option is enabled.
*
* @since 1.0.0
*
* @param WP_Customize_Control $control WP_Customize_Control instance.
*
* @return bool Whether the control is active to the current preview.
*/
function sophia_after_dark_enable_pnf_latest_posts_active_callback( $control ) {
if ( false !== $control->manager->get_setting( 'sophia_after_dark_enable_pnf_latest_posts' )->value() ) {
return true;
} else {
return false;
}
}
endif;

View File

@@ -0,0 +1,113 @@
<?php
/**
* Sophia After Dark manage the Customizer options of additional panel.
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_customize_additinal_panels_sections_register' );
/**
* Add Additional panels in the theme customize
*
*/
function sophia_after_dark_customize_additinal_panels_sections_register( $wp_customize ) {
/*------------------------------------------------ Social Icons Section ------------------------------------------------*/
/**
* Social Icons
*/
$wp_customize->add_section( 'sophia_after_dark_section_social_icons',
array(
'title' => esc_html__( 'Social Icons', 'sophia-after-dark' ),
'panel' => 'sophia_after_dark_additional_panel',
'capability' => 'edit_theme_options',
'priority' => 5,
'theme_supports' => '',
)
);
/**
* Repeater field for social icons
*/
$wp_customize->add_setting(
'sophia_after_dark_social_icons',
array(
'capability' => 'edit_theme_options',
'default' => json_encode( array(
array(
'social_icon' => 'fa fa-twitter',
'social_url' => '#',
),
array(
'social_icon' => 'fa fa-pinterest',
'social_url' => '#',
)
)
),
'sanitize_callback' => 'wp_kses_post'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Repeater(
$wp_customize,
'sophia_after_dark_social_icons',
array(
'label' => __( 'Social Media', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_social_icons',
'settings' => 'sophia_after_dark_social_icons',
'priority' => 5,
'sophia_after_dark_box_label_text' => __( 'Social Media Icons','sophia-after-dark' ),
'sophia_after_dark_box_add_control_text' => __( 'Add Icon','sophia-after-dark' )
),
array(
'social_icon' => array(
'type' => 'social_icon',
'label' => esc_html__( 'Social Icon', 'sophia-after-dark' ),
'description' => __( 'Choose social media icon.', 'sophia-after-dark' )
),
'social_url' => array(
'type' => 'url',
'label' => esc_html__( 'Social Link URL', 'sophia-after-dark' ),
'description' => __( 'Enter social media url.', 'sophia-after-dark' )
),
)
)
);
/*------------------------------------------------ Breadcrumbs Section ------------------------------------------------*
/**
* Breadcrumbs
*/
$wp_customize->add_section( 'sophia_after_dark_section_breadcrumbs',
array(
'title' => esc_html__( 'Breadcrumbs', 'sophia-after-dark' ),
'panel' => 'sophia_after_dark_additional_panel',
'capability' => 'edit_theme_options',
'priority' => 10,
'theme_supports' => '',
)
);
/**
* Toggle field for Enable/Disable breadcrumbs.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_breadcrumb_option',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_breadcrumb_option',
array(
'label' => __( 'Enable Breadcrumbs', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_breadcrumbs',
'settings' => 'sophia_after_dark_enable_breadcrumb_option',
'priority' => 5,
)
)
);
}

View File

@@ -0,0 +1,367 @@
<?php
/**
* Sophia After Dark include the Customizer custom classes of customizer fields.
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_register_custom_controls' );
if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
/**
* Register Custom Controls
*
* @since 1.0.0
*/
function sophia_after_dark_register_custom_controls( $wp_customize ) {
if ( ! class_exists( 'sophia_after_dark_Control_Toggle' ) ) {
/**
* Toggle control (modified checkbox)
*/
class Sophia_After_Dark_Control_Toggle extends WP_Customize_Control {
/**
* The control type.
*
* @access public
* @var string
*/
public $type = 'mt-toggle';
public $tooltip = '';
public function to_json() {
parent::to_json();
if ( isset( $this->default ) ) {
$this->json['default'] = $this->default;
} else{
$this->json['default'] = $this->setting->default;
}
$this->json['value'] = $this->value();
$this->json['link'] = $this->get_link();
$this->json['id'] = $this->id;
$this->json['tooltip'] = $this->tooltip;
$this->json['inputAttrs'] = '';
foreach ( $this->input_attrs as $attr => $value ) {
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
}
}
protected function content_template() {
?>
<# if ( data.tooltip ) { #>
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
<# } #>
<label for="toggle_{{ data.id }}">
<span class="customize-control-title">
{{{ data.label }}}
</span>
<# if ( data.description ) { #>
<span class="description customize-control-description">{{{ data.description }}}</span>
<# } #>
<input {{{ data.inputAttrs }}} name="toggle_{{ data.id }}" id="toggle_{{ data.id }}" type="checkbox" value="{{ data.value }}" {{{ data.link }}}<# if ( '1' == data.value ) { #> checked<# } #> hidden />
<span class="switch"></span>
</label>
<?php
}
}
} //Ends sophia_after_dark_Control_Toggle
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------*/
if ( ! class_exists( 'sophia_after_dark_Control_Radio_Image' ) ) {
/**
* Radio Image control (modified radio).
*/
class Sophia_After_Dark_Control_Radio_Image extends WP_Customize_Control {
/**
* The control type.
*
* @access public
* @var string
*/
public $type = 'mt-radio-image';
public $tooltip = '';
public function to_json() {
parent::to_json();
if ( isset( $this->default ) ) {
$this->json['default'] = $this->default;
} else {
$this->json['default'] = $this->setting->default;
}
$this->json['value'] = $this->value();
$this->json['link'] = $this->get_link();
$this->json['id'] = $this->id;
$this->json['tooltip'] = $this->tooltip;
$this->json['choices'] = $this->choices;
$this->json['inputAttrs'] = '';
foreach ( $this->input_attrs as $attr => $value ) {
$this->json['inputAttrs'] .= $attr . '="' . esc_attr( $value ) . '" ';
}
}
protected function content_template() {
?>
<# if ( data.tooltip ) { #>
<a href="#" class="tooltip hint--left" data-hint="{{ data.tooltip }}"><span class='dashicons dashicons-info'></span></a>
<# } #>
<label class="customizer-text">
<# if ( data.label ) { #><span class="customize-control-title">{{{ data.label }}}</span><# } #>
<# if ( data.description ) { #><span class="description customize-control-description">{{{ data.description }}}</span><# } #>
</label>
<div id="input_{{ data.id }}" class="image">
<# for ( key in data.choices ) { #>
<# dataAlt = ( _.isObject( data.choices[ key ] ) && ! _.isUndefined( data.choices[ key ].alt ) ) ? data.choices[ key ].alt : '' #>
<input {{{ data.inputAttrs }}} class="image-select" type="radio" value="{{ key }}" name="_customize-radio-{{ data.id }}" id="{{ data.id }}{{ key }}" {{{ data.link }}}<# if ( data.value === key ) { #> checked="checked"<# } #> data-alt="{{ dataAlt }}">
<label for="{{ data.id }}{{ key }}" {{{ data.labelStyle }}} class="{{{ data.id + key }}}">
<# if ( _.isObject( data.choices[ key ] ) ) { #>
<img src="{{ data.choices[ key ].src }}" alt="{{ data.choices[ key ].alt }}">
<span class="image-label"><span class="inner">{{ data.choices[ key ].alt }}</span></span>
<# } else { #>
<img src="{{ data.choices[ key ] }}">
<# } #>
<span class="image-clickable"></span>
</label>
</input>
<# } #>
</div>
<?php
}
}
}
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------*/
if ( ! class_exists( 'sophia_after_dark_Control_Repeater' ) ) {
/**
* Repeater control
*/
class Sophia_After_Dark_Control_Repeater extends WP_Customize_Control {
/**
* The control type.
*
* @access public
* @var string
*/
public $type = 'mt-repeater';
public $sophia_after_dark_box_label = '';
public $sophia_after_dark_box_add_control = '';
/**
* The fields that each container row will contain.
*
* @access public
* @var array
*/
public $fields = array();
/**
* Repeater drag and drop controller
*
* @since 1.0.0
*/
public function __construct( $manager, $id, $args = array(), $fields = array() ) {
$this->fields = $fields;
$this->sophia_after_dark_box_label = $args['sophia_after_dark_box_label_text'] ;
$this->sophia_after_dark_box_add_control = $args['sophia_after_dark_box_add_control_text'];
parent::__construct( $manager, $id, $args );
}
protected function render_content() {
$values = json_decode( $this->value() );
$repeater_id = $this->id;
$field_count = count( $values );
?>
<span class="customize-control-title"><?php echo esc_html( $this->label ); ?></span>
<?php if ( $this->description ) { ?>
<span class="description customize-control-description">
<?php echo wp_kses_post( $this->description ); ?>
</span>
<?php } ?>
<ul class="mt-repeater-field-control-wrap">
<?php $this->sophia_after_dark_get_fields(); ?>
</ul>
<input type="hidden" <?php $this->link(); ?> class="mt-repeater-collector" value="<?php echo esc_attr( $this->value() ); ?>" />
<input type="hidden" name="<?php echo esc_attr( $repeater_id ).'_count'; ?>" class="field-count" value="<?php echo absint( $field_count ); ?>">
<input type="hidden" name="field_limit" class="field-limit" value="6">
<button type="button" class="button mt-repeater-add-control-field"><?php echo esc_html( $this->sophia_after_dark_box_add_control ); ?></button>
<?php
}
private function sophia_after_dark_get_fields() {
$fields = $this->fields;
$values = json_decode( $this->value() );
if ( is_array( $values ) ) {
foreach( $values as $value ) {
?>
<li class="mt-repeater-field-control">
<h3 class="mt-repeater-field-title"><?php echo esc_html( $this->sophia_after_dark_box_label ); ?></h3>
<div class="mt-repeater-fields">
<?php
foreach ( $fields as $key => $field ) {
$class = isset( $field['class'] ) ? $field['class'] : '';
?>
<div class="mt-repeater-field mt-repeater-type-<?php echo esc_attr( $field['type'] ).' '.esc_attr( $class ); ?>">
<?php
$label = isset( $field['label'] ) ? $field['label'] : '';
$description = isset( $field['description'] ) ? $field['description'] : '';
if ( $field['type'] != 'checkbox' ) {
?>
<span class="customize-control-title"><?php echo esc_html( $label ); ?></span>
<span class="description customize-control-description"><?php echo esc_html( $description ); ?></span>
<?php
}
$new_value = isset( $value->$key ) ? $value->$key : '';
$default = isset( $field['default'] ) ? $field['default'] : '';
switch ( $field['type'] ) {
/**
* Text field
*/
case 'text':
echo '<input data-default="'.esc_attr( $default ).'" data-name="'.esc_attr( $key ).'" type="text" value="'.esc_attr( $new_value ).'"/>';
break;
/**
* Textarea field
*/
case 'textarea':
echo '<textarea data-default="'.esc_attr( $default ).'" data-name="'.esc_attr( $key ).'">'.esc_attr( $new_value ).'</textarea>';
break;
/**
* URL field
*/
case 'url':
echo '<input data-default="'.esc_attr( $default ).'" data-name="'.esc_attr( $key ).'" type="text" value="'.esc_url( $new_value ).'"/>';
break;
/**
* Icon field
*/
case 'icon':
$sophia_after_dark_font_awesome_icon_array = sophia_after_dark_font_awesome_icon_array();
echo '<div class="mt-repeater-selected-icon"><i class="'.esc_attr( $new_value ).'"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="mt-repeater-icon-list mt-clearfix">';
foreach ( $sophia_after_dark_font_awesome_icon_array as $sophia_after_dark_font_awesome_icon ) {
$icon_class = $new_value == $sophia_after_dark_font_awesome_icon ? 'icon-active' : '';
echo '<li class='.esc_attr( $icon_class ).'><i class="'.esc_attr( $sophia_after_dark_font_awesome_icon ).'"></i></li>';
}
echo '</ul><input data-default="'.esc_attr( $default ).'" type="hidden" value="'.esc_attr( $new_value ).'" data-name="'.esc_attr( $key ).'"/>';
break;
/**
* Social Icon field
*/
case 'social_icon':
$sophia_after_dark_font_awesome_social_icon_array = sophia_after_dark_font_awesome_social_icon_array();
echo '<div class="mt-repeater-selected-icon"><i class="'.esc_attr( $new_value ).'"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="mt-repeater-icon-list mt-clearfix">';
foreach ( $sophia_after_dark_font_awesome_social_icon_array as $sophia_after_dark_font_awesome_icon ) {
$icon_class = $new_value == $sophia_after_dark_font_awesome_icon ? 'icon-active' : '';
echo '<li class='.esc_attr( $icon_class ).'><i class="'.esc_attr( $sophia_after_dark_font_awesome_icon ).'"></i></li>';
}
echo '</ul><input data-default="'.esc_attr( $default ).'" type="hidden" value="'.esc_attr( $new_value ).'" data-name="'.esc_attr( $key ).'"/>';
break;
/**
* Select field
*/
case 'select':
$options = $field['options'];
echo '<select data-default="'.esc_attr( $default ).'" data-name="'.esc_attr( $key ).'">';
foreach ( $options as $option => $val )
{
printf( '<option value="%1$s" %2$s>%3$s</option>', esc_attr( $option ), selected( $new_value, $option, false ), esc_html( $val ) );
}
echo '</select>';
break;
/**
* Dropdown field
*/
case 'dropdown_pages':
$show_option_none = esc_html__( '&mdash; Select a page &mdash;', 'sophia-after-dark' );
$select_field ='data-default="'.esc_attr( $default ).'" data-name="'.esc_attr( $key ).'"';
$option_none_value = '';
$dropdown = wp_dropdown_pages(
array(
'name' => esc_attr( $key ),
'echo' => '',
'show_option_none' => esc_html( $show_option_none ),
'option_none_value' => esc_attr( $option_none_value ),
'selected' => esc_attr( $new_value )
)
);
if ( empty( $dropdown ) ) {
$dropdown = sprintf( '<select id="%1$s" name="%1$s">', esc_attr( $key ) );
$dropdown .= sprintf( '<option value="%1$s">%2$s</option>', esc_attr( $option_none_value ), esc_html( $show_option_none ) );
$dropdown .= '</select>';
}
// Hackily add in the data link parameter.
$dropdown = str_replace( '<select', '<select ' . $select_field, $dropdown );
echo $dropdown;
break;
/**
* Upload field
*/
case 'upload':
$image_class = "";
$upload_btn_label = esc_html__( 'Select Image', 'sophia-after-dark' );
$remove_btn_label = esc_html__( 'Remove', 'sophia-after-dark' );
if ( $new_value ) {
$image_class = ' hidden';
}
echo '<div class="mt-fields-wrap"><div class="attachment-media-view"><div class="placeholder'. esc_attr( $image_class ).'">';
esc_html_e( 'No image selected', 'sophia-after-dark' );
echo '</div><div class="thumbnail thumbnail-image"><img src="'.esc_url( $new_value ).'" style="max-width:100%;"/></div><div class="actions mt-clearfix"><button type="button" class="button mt-delete-button align-left">'. esc_html( $remove_btn_label ) .'</button><button type="button" class="button mt-upload-button alignright">'. esc_html( $upload_btn_label ) .'</button><input data-default="'.esc_attr( $default ).'" class="upload-id" data-name="'.esc_attr( $key ).'" type="hidden" value="'.esc_attr( $new_value ).'"/></div></div></div>';
break;
default:
break;
}
?>
</div>
<?php
}
?>
<div class="mt-clearfix mt-repeater-footer">
<div class="alignright">
<a class="mt-repeater-field-remove" href="#remove"><?php esc_html_e( 'Delete', 'sophia-after-dark' ) ?></a> |
<a class="mt-repeater-field-close" href="#close"><?php esc_html_e( 'Close', 'sophia-after-dark' ) ?></a>
</div>
</div><!-- .mt-repeater-footer -->
</div><!-- .mt-repeater-fields-->
</li>
<?php
}
}
}
}
}
}// Ends sophia_after_dark_register_custom_controls
endif;
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------*/

View File

@@ -0,0 +1,303 @@
<?php
/**
* Sophia After Dark manage the Customizer options of design settings panel.
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_customize_design_panels_sections_register' );
/**
* Add Additional panels in the theme customizer
*
*/
function sophia_after_dark_customize_design_panels_sections_register( $wp_customize ) {
/*------------------------------------------------ Archive Section ------------------------------------------------------------*/
/**
* Archive Settings
*/
$wp_customize->add_section( 'sophia_after_dark_section_archive_settings',
array(
'title' => esc_html__( 'Archive Settings', 'sophia-after-dark' ),
'panel' => 'sophia_after_dark_design_panel',
'capability' => 'edit_theme_options',
'priority' => 5,
'theme_supports' => '',
)
);
/*
* Radio Image field for archive/blog sidebar layout.
*/
$wp_customize->add_setting( 'sophia_after_dark_archive_sidebar_layout',
array(
'default' => 'no-sidebar',
'sanitize_callback' => 'sanitize_key',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
$wp_customize, 'sophia_after_dark_archive_sidebar_layout',
array(
'label' => esc_html__( 'Archive/Blog Sidebar Layout', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_archive_settings',
'settings' => 'sophia_after_dark_archive_sidebar_layout',
'priority' => 10,
'choices' => array(
'left-sidebar' => get_template_directory_uri() . '/assets/images/left-sidebar.png',
'right-sidebar' => get_template_directory_uri() . '/assets/images/right-sidebar.png',
'no-sidebar' => get_template_directory_uri() . '/assets/images/no-sidebar.png',
'no-sidebar-center' => get_template_directory_uri() . '/assets/images/no-sidebar-center.png'
),
)
)
);
/*
* Radio Image field for arvhive/blog style.
*/
$wp_customize->add_setting( 'sophia_after_dark_archive_style',
array(
'default' => 'mt-archive--masonry-style',
'sanitize_callback' => 'sanitize_key',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
$wp_customize, 'sophia_after_dark_archive_style',
array(
'label' => esc_html__( 'Archive/Blog Style', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_archive_settings',
'settings' => 'sophia_after_dark_archive_style',
'priority' => 10,
'choices' => array(
'mt-archive--block-grid-style' => get_template_directory_uri() . '/assets/images/archive-block-grid.png',
'mt-archive--masonry-style' => get_template_directory_uri() . '/assets/images/archive-masonry.png',
),
)
)
);
/*
* Text field for archive read more button.
*/
$wp_customize->add_setting( 'sophia_after_dark_archive_read_more',
array(
'capability' => 'edit_theme_options',
'default' => esc_html__( 'Discover', 'sophia-after-dark' ),
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control( 'sophia_after_dark_archive_read_more',
array(
'type' => 'text',
'label' => esc_html__( 'Read More Button', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_archive_settings',
'settings' => 'sophia_after_dark_archive_read_more',
'priority' => 15,
)
);
/**
* Toggle field for Enable/Disable title prefix at category pages.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_archive_title_prefix',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_archive_title_prefix',
array(
'label' => __( 'Enable Title Prefix', 'sophia-after-dark' ),
'description' => esc_html__( 'Show/Hide title prefix in archive pages.', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_archive_settings',
'settings' => 'sophia_after_dark_enable_archive_title_prefix',
'priority' => 20,
)
)
);
/*------------------------------------------------------- Post Section ------------------------------------------------------------*/
/**
* Post Settings
*/
$wp_customize->add_section( 'sophia_after_dark_section_post_settings',
array(
'title' => esc_html__( 'Post Settings', 'sophia-after-dark' ),
'panel' => 'sophia_after_dark_design_panel',
'capability' => 'edit_theme_options',
'priority' => 10,
'theme_supports' => '',
)
);
/*
* Radio Image field for single posts sidebar layout.
*/
$wp_customize->add_setting( 'sophia_after_dark_posts_sidebar_layout',
array(
'default' => 'right-sidebar',
'sanitize_callback' => 'sanitize_key',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
$wp_customize, 'sophia_after_dark_posts_sidebar_layout',
array(
'label' => esc_html__( 'Posts Sidebar Layout', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_post_settings',
'settings' => 'sophia_after_dark_posts_sidebar_layout',
'priority' => 5,
'choices' => array(
'left-sidebar' => get_template_directory_uri() . '/assets/images/left-sidebar.png',
'right-sidebar' => get_template_directory_uri() . '/assets/images/right-sidebar.png',
'no-sidebar' => get_template_directory_uri() . '/assets/images/no-sidebar.png',
'no-sidebar-center' => get_template_directory_uri() . '/assets/images/no-sidebar-center.png'
),
)
)
);
/*
* Toggle field for Enable/Disable related posts.
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_related_posts',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_related_posts',
array(
'label' => esc_html__( 'Enable Related Posts', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_post_settings',
'settings' => 'sophia_after_dark_enable_related_posts',
'priority' => 15,
)
)
);
/*------------------------------------------------------- Post Section ------------------------------------------------------------*/
/**
* Page Setting
*/
$wp_customize->add_section( 'sophia_after_dark_section_page_settings',
array(
'title' => esc_html__( 'Page Settings', 'sophia-after-dark' ),
'panel' => 'sophia_after_dark_design_panel',
'capability' => 'edit_theme_options',
'priority' => 15,
'theme_supports' => '',
)
);
/*
* Radio Image field for single page sidebar layout.
*/
$wp_customize->add_setting( 'sophia_after_dark_pages_sidebar_layout',
array(
'default' => 'right-sidebar',
'sanitize_callback' => 'sanitize_key',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
$wp_customize, 'sophia_after_dark_pages_sidebar_layout',
array(
'label' => esc_html__( 'Pages Sidebar Layout', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_page_settings',
'settings' => 'sophia_after_dark_pages_sidebar_layout',
'priority' => 5,
'choices' => array(
'left-sidebar' => get_template_directory_uri() . '/assets/images/left-sidebar.png',
'right-sidebar' => get_template_directory_uri() . '/assets/images/right-sidebar.png',
'no-sidebar' => get_template_directory_uri() . '/assets/images/no-sidebar.png',
'no-sidebar-center' => get_template_directory_uri() . '/assets/images/no-sidebar-center.png'
),
)
)
);
/*-------------------------------------------------------------------- 404 Page Settings Section ----------------------------------------------------------------*/
/**
* 404 Page Settings
*/
$wp_customize->add_section( 'sophia_after_dark_section_pnf_settings',
array(
'priority' => 20,
'panel' => 'sophia_after_dark_design_panel',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( '404 Page Settings', 'sophia-after-dark' )
)
);
/**
* Toggle field for Enable/Disable latest posts section at 404 page
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_pnf_latest_posts',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_pnf_latest_posts',
array(
'label' => __( 'Enable Latest Posts', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_pnf_settings',
'settings' => 'sophia_after_dark_enable_pnf_latest_posts',
'priority' => 40,
)
)
);
/**
* Text field for latest posts section title
*/
$wp_customize->add_setting( 'sophia_after_dark_pnf_latest_title',
array(
'capability' => 'edit_theme_options',
'default' => esc_html__( 'You May Like', 'sophia-after-dark' ),
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control( 'sophia_after_dark_pnf_latest_title',
array(
'type' => 'text',
'label' => esc_html__( 'Section Title', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_pnf_settings',
'priority' => 45,
'active_callback' => 'sophia_after_dark_enable_pnf_latest_posts_active_callback',
)
);
/**
* Text field for latest posts count
*/
$wp_customize->add_setting( 'sophia_after_dark_pnf_latest_post_count',
array(
'capability' => 'edit_theme_options',
'default' => 3,
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control( 'sophia_after_dark_pnf_latest_post_count',
array(
'type' => 'number',
'label' => esc_html__( 'Post count', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_pnf_settings',
'priority' => 50,
'active_callback' => 'sophia_after_dark_enable_pnf_latest_posts_active_callback',
)
);
}

View File

@@ -0,0 +1,156 @@
<?php
/**
* Sophia After Dark manage the Customizer options of footer settings panel.
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_customize_footer_panels_sections_register' );
/**
* Add Additional panels in the theme customizer
*
*/
function sophia_after_dark_customize_footer_panels_sections_register( $wp_customize ) {
/*------------------------------------------------------- Footer Widget Area Section --------------------------------------------------------------------------*/
/**
* Footer Widget Area
*/
$wp_customize->add_section( 'sophia_after_dark_section_footer_widget_area',
array(
'title' => esc_html__( 'Footer Widget Area', 'sophia-after-dark' ),
'panel' => 'sophia_after_dark_footer_panel',
'capability' => 'edit_theme_options',
'priority' => 5,
'theme_supports' => '',
)
);
/**
* Toggle field for Enable/Disable footer widget area.
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_footer_widget_area',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_footer_widget_area',
array(
'label' => esc_html__( 'Enable Footer Widget Area', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_footer_widget_area',
'settings' => 'sophia_after_dark_enable_footer_widget_area',
'priority' => 5,
)
)
);
/**
* Radio Image field for Widget Area layout
*/
$wp_customize->add_setting( 'sophia_after_dark_widget_area_layout',
array(
'default' => 'column-three',
'sanitize_callback' => 'sanitize_key',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
$wp_customize, 'sophia_after_dark_widget_area_layout',
array(
'label' => esc_html__( 'Widget Area Layout', 'sophia-after-dark' ),
'description' => __( 'Choose widget layout from available layouts', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_footer_widget_area',
'settings' => 'sophia_after_dark_widget_area_layout',
'priority' => 15,
'active_callback' => 'sophia_after_dark_enable_footer_widget_area_active_callback',
'choices' => array(
'column-four' => get_template_directory_uri() . '/assets/images/footer-4.png',
'column-three' => get_template_directory_uri() . '/assets/images/footer-3.png',
'column-two' => get_template_directory_uri() . '/assets/images/footer-2.png',
'column-one' => get_template_directory_uri() . '/assets/images/footer-1.png'
),
)
)
);
/*------------------------------------------------------- Bottom Footer Section --------------------------------------------------------------------------*/
/**
* Bottom footer
*/
$wp_customize->add_section( 'sophia_after_dark_section_bottom_footer',
array(
'title' => esc_html__( 'Bottom Footer', 'sophia-after-dark' ),
'panel' => 'sophia_after_dark_footer_panel',
'capability' => 'edit_theme_options',
'priority' => 10,
'theme_supports' => '',
)
);
/**
* Toggle field for Enable/Disable footer menu.
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_footer_menu',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_footer_menu',
array(
'label' => esc_html__( 'Enable Footer Menu', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_bottom_footer',
'settings' => 'sophia_after_dark_enable_footer_menu',
'priority' => 5,
)
)
);
/**
* Text filed for copyright
*/
$wp_customize->add_setting( 'sophia_after_dark_footer_copyright',
array(
'capability' => 'edit_theme_options',
'default' => esc_html__( '&copy;1969 Sophia After Dark', 'sophia-after-dark' ),
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control( 'sophia_after_dark_footer_copyright',
array(
'type' => 'text',
'label' => esc_html__( 'Copyright Text', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_bottom_footer',
'priority' => 25,
'active_callback' => 'sophia_after_dark_enable_footer_menu_active_callback',
)
);
/**
* Text filed for disclaimer
*/
$wp_customize->add_setting( 'sophia_after_dark_footer_disclaimer',
array(
'capability' => 'edit_theme_options',
'default' => esc_html__( 'All trademarks are property of their respective owners', 'sophia-after-dark' ),
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control( 'sophia_after_dark_footer_disclaimer',
array(
'type' => 'text',
'label' => esc_html__( 'Disclaimer Text', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_bottom_footer',
'priority' => 25,
'active_callback' => 'sophia_after_dark_enable_footer_menu_active_callback',
)
);
}

View File

@@ -0,0 +1,184 @@
<?php
/**
* Customizer fields for front slider section
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_customize_slider_panels_sections_register' );
/**
* Add panels in the theme customizer
*
*/
function sophia_after_dark_customize_slider_panels_sections_register( $wp_customize ) {
/*--------------------------------------------------------- Slider Section ------------------------------------------------ */
/**
* Slider Settings
*/
$wp_customize->add_section( 'sophia_after_dark_section_slider',
array(
'priority' => 10,
'panel' => 'sophia_after_dark_front_section_panel',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Slider Settings', 'sophia-after-dark' )
)
);
/**
* Toggle field for slider option
*
*/
$wp_customize->add_setting( 'sophia_after_dark_section_slider_option',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_section_slider_option',
array(
'label' => __( 'Enable Slider Section', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_slider',
'settings' => 'sophia_after_dark_section_slider_option',
'priority' => 5,
)
)
);
/**
* Select field for slider cat select
*
*/
$wp_customize->add_setting( 'sophia_after_dark_section_slider_cat',
array(
'capability' => 'edit_theme_options',
'default' => '',
'sanitize_callback' => 'sophia_after_dark_sanitize_select',
)
);
$wp_customize->add_control( 'sophia_after_dark_section_slider_cat',
array(
'type' => 'select',
'label' => esc_html__( 'Slider category', 'sophia-after-dark' ),
'description' => esc_html__( 'Choose default post category', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_slider',
'default' => '',
'priority' => 30,
'choices' => sophia_after_dark_select_categories_list(),
'active_callback' => 'sophia_after_dark_section_slider_option_active_callback',
)
);
/**
* Image field for background image in slider section
*/
$wp_customize->add_setting( 'sophia_after_dark_slider_bg_image',
array(
'capability' => 'edit_theme_options',
'default' => '',
'sanitize_callback' => 'esc_url_raw',
)
);
$wp_customize->add_control( new WP_Customize_Image_Control(
$wp_customize, 'sophia_after_dark_slider_bg_image',
array(
'label' => __( 'Slider Section Background Image', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_slider',
'settings' => 'sophia_after_dark_slider_bg_image',
'priority' => 40,
'active_callback' => 'sophia_after_dark_section_slider_option_active_callback'
)
)
);
/*--------------------------------------------------------- Featured Posts Section ------------------------------------------------ */
/**
* Featured Slider Settings
*/
$wp_customize->add_section( 'sophia_after_dark_section_top_featured_post',
array(
'priority' => 20,
'panel' => 'sophia_after_dark_front_section_panel',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => esc_html__( 'Featured Posts Settings', 'sophia-after-dark' ),
)
);
/**
* Toggle field for featured slider option
*
*/
$wp_customize->add_setting( 'sophia_after_dark_section_top_featured_posts_option',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_section_top_featured_posts_option',
array(
'label' => esc_html__( 'Enable Featured Posts Section', 'sophia-after-dark' ),
'description' => 'This section is displayed after the slider content at the right side minimizing the slider width.',
'section' => 'sophia_after_dark_section_top_featured_post',
'settings' => 'sophia_after_dark_section_top_featured_posts_option',
'priority' => 5,
)
)
);
/**
* Text field for Featured Posts Title
*/
$wp_customize->add_setting( 'sophia_after_dark_top_featured_posts_title',
array(
'capability' => 'edit_theme_options',
'default' => esc_html__( 'Featured News', 'sophia-after-dark' ),
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control( 'sophia_after_dark_top_featured_posts_title',
array(
'type' => 'text',
'label' => esc_html__( 'Featured News', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_featured_post',
'priority' => 10,
'active_callback' => 'sophia_after_dark_section_top_featured_posts_option_active_callback',
)
);
/**
* Select field for featured posts type.
*/
$wp_customize->add_setting( 'sophia_after_dark_top_featured_post_order',
array(
'capability' => 'edit_theme_options',
'default' => 'default',
'sanitize_callback' => 'sophia_after_dark_sanitize_select',
)
);
$wp_customize->add_control( 'sophia_after_dark_top_featured_post_order',
array(
'type' => 'select',
'label' => esc_html__( 'Featured Post Order', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_featured_post',
'priority' => 15,
'choices' => array(
'default' => __( 'Latest Posts', 'sophia-after-dark' ),
'random' => __( 'Random Posts', 'sophia-after-dark' ),
),
'active_callback' => 'sophia_after_dark_section_top_featured_posts_option_active_callback',
)
);
}

View File

@@ -0,0 +1,125 @@
<?php
/**
* Sophia After Dark manage the Customizer options of general panel.
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_customize_general_panels_sections_register' );
/**
* Add panels in the theme customizer
*
*/
function sophia_after_dark_customize_general_panels_sections_register( $wp_customize ) {
/*------------------------------------------- Site Settings Section -----------------------------------------------*/
/**
* Site Settings Section
*/
$wp_customize->add_section( 'sophia_after_dark_section_site',
array(
'priority' => 40,
'panel' => 'sophia_after_dark_general_panel',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Site Settings', 'sophia-after-dark' )
)
);
/**
* Toggle field for Enable/Disable preloader.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_preloader',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_preloader',
array(
'label' => __( 'Enable Preloader', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_enable_preloader',
'priority' => 5,
)
)
);
/**
* Toggle field for Enable/Disable wow animation.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_wow_animation',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_wow_animation',
array(
'label' => __( 'Enable Wow Animation', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_enable_wow_animation',
'priority' => 10,
)
)
);
/**
* Radio image field for Archive Sidebar
*
* @since 1.0.0
*/
$wp_customize->add_setting( 'sophia_after_dark_site_layout',
array(
'default' => 'site-layout--wide',
'sanitize_callback' => 'sanitize_key',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Radio_Image(
$wp_customize, 'sophia_after_dark_site_layout',
array(
'label' => __( 'Site Layout', 'sophia-after-dark' ),
'description' => __( 'Choose site layout from available layouts', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_site_layout',
'priority' => 15,
'choices' => array(
'site-layout--wide' => get_template_directory_uri() . '/assets/images/full-width.png',
'site-layout--boxed' => get_template_directory_uri() . '/assets/images/boxed-layout.png'
),
)
)
);
/**
* Toggle field for block based widget editor.
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_widgets_editor',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_widgets_editor',
array(
'label' => __( 'Enable Widgets Editor', 'sophia-after-dark' ),
'description' => __( 'Enable/disable Block-based Widgets Editor(since WordPress 5.8).', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_enable_widgets_editor',
'priority' => 15,
)
)
);
}

View File

@@ -0,0 +1,327 @@
<?php
/**
* Sophia After Dark manage the Customizer options of header panel.
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_customize_header_panels_sections_register' );
/**
* Add panels in the theme customizer
*
*/
function sophia_after_dark_customize_header_panels_sections_register( $wp_customize ) {
/*------------------------------------------ Top Header Section ----------------------------------------*/
/**
* Top Header Section
*/
$wp_customize->add_section( 'sophia_after_dark_section_top_header',
array(
'priority' => 10,
'panel' => 'sophia_after_dark_header_panel',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Top Header Settings', 'sophia-after-dark' )
)
);
/**
* Toggle field for Enable/Disable Top Header section
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_top_header',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_top_header',
array(
'label' => __( 'Enable Top Header', 'sophia-after-dark' ),
'description' => esc_html__( 'Show/Hide top header section.', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'settings' => 'sophia_after_dark_enable_top_header',
'priority' => 10,
)
)
);
/**
* Toggle field for Enable/Disable trending section.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_trending',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_trending',
array(
'label' => esc_html__( 'Enable Trending Section', 'sophia-after-dark' ),
'description' => esc_html__( 'Trending section shows the popular tags.', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'settings' => 'sophia_after_dark_enable_trending',
'priority' => 10,
'active_callback' => 'sophia_after_dark_enable_top_header_active_callback',
)
)
);
/**
* checkox for before icon in tags.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_trending_tag_before_icon',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( 'sophia_after_dark_enable_trending_tag_before_icon',
array(
'type' => 'checkbox',
'label' => esc_html__( 'Add Icon Before Tag', 'sophia-after-dark' ),
'description' => esc_html__( 'Show/Hide Hash Icon before tag.', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'priority' => 20,
'active_callback' => 'sophia_after_dark_enable_top_header_trending_active_callback',
)
);
/**
* Text field for trending label.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_trending_label',
array(
'capability' => 'edit_theme_options',
'default' => esc_html__( 'Trending Now', 'sophia-after-dark' ),
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control( 'sophia_after_dark_trending_label',
array(
'type' => 'text',
'label' => esc_html__( 'Trending Label', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'priority' => 25,
'active_callback' => 'sophia_after_dark_enable_top_header_trending_active_callback',
)
);
/**
* Select field of trending tags orderby.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_trending_tags_orderby',
array(
'capability' => 'edit_theme_options',
'default' => '',
'sanitize_callback' => 'sophia_after_dark_sanitize_select',
)
);
$wp_customize->add_control( 'sophia_after_dark_trending_tags_orderby',
array(
'type' => 'select',
'label' => esc_html__( 'Tags Orderby', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'default' => '',
'priority' => 30,
'choices' => array(
'' => esc_html__( 'Default', 'sophia-after-dark' ),
'count' => esc_html__( 'Count', 'sophia-after-dark' ),
),
'active_callback' => 'sophia_after_dark_enable_top_header_trending_active_callback',
)
);
/**
* Number field of trending tags count.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_trending_tags_count',
array(
'capability' => 'edit_theme_options',
'default' => '5',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control( 'sophia_after_dark_trending_tags_count',
array(
'type' => 'number',
'label' => esc_html__( 'Tags Count', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'priority' => 35,
'active_callback' => 'sophia_after_dark_enable_top_header_trending_active_callback',
)
);
/**
* Toggle field for Enable/Disable live now button.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_live_now',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_live_now',
array(
'label' => esc_html__( 'Enable Live Now Button', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'settings' => 'sophia_after_dark_enable_live_now',
'priority' => 40,
'active_callback' => 'sophia_after_dark_enable_top_header_active_callback',
)
)
);
/**
* Text field for live now button label.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_live_now_label',
array(
'capability' => 'edit_theme_options',
'default' => esc_html__( 'Live Now', 'sophia-after-dark' ),
'sanitize_callback' => 'sanitize_text_field'
)
);
$wp_customize->add_control( 'sophia_after_dark_live_now_label',
array(
'type' => 'text',
'label' => esc_html__( 'Button Label', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'settings' => 'sophia_after_dark_live_now_label',
'priority' => 45,
'active_callback' => 'sophia_after_dark_enable_top_header_live_now_active_callback',
)
);
/**
* Text field for live now button link.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_live_now_link',
array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw'
)
);
$wp_customize->add_control( 'sophia_after_dark_live_now_link',
array(
'type' => 'text',
'label' => esc_html__( 'Button Link', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_top_header',
'settings' => 'sophia_after_dark_live_now_link',
'priority' => 50,
'active_callback' => 'sophia_after_dark_enable_top_header_live_now_active_callback',
'input_attrs' => array(
'placeholder' => "https://www.youtube.com/channel/UCnGp3UHMB4DH8W_KmSmrCEw"
)
)
);
/*------------------------------------------ Header: Extra Options ----------------------------------------*/
/**
* Header Extra Options
*/
$wp_customize->add_section( 'sophia_after_dark_section_header_extra',
array(
'priority' => 30,
'panel' => 'sophia_after_dark_header_panel',
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Extra Options', 'sophia-after-dark' )
)
);
/**
* Toggle field for Enable/Disable sticky menu.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_sticky_menu',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_sticky_menu',
array(
'label' => esc_html__( 'Enable Sticky Menu', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_header_extra',
'settings' => 'sophia_after_dark_enable_sticky_menu',
'priority' => 5,
)
)
);
/**
* Toggle field for Enable/Disable social icons.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_header_social_icons',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_header_social_icons',
array(
'label' => esc_html__( 'Enable Social Icons', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_header_extra',
'settings' => 'sophia_after_dark_enable_header_social_icons',
'priority' => 10,
)
)
);
/**
* Toggle field for Enable/Disable search icon.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_search_icon',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_search_icon',
array(
'label' => esc_html__( 'Enable Search Icon', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_header_extra',
'settings' => 'sophia_after_dark_enable_search_icon',
'priority' => 15,
)
)
);
}

View File

@@ -0,0 +1,86 @@
<?php
/**
* Sophia After Dark manage the Customizer panels
*
* @package Sophia After Dark
* @since 1.0.0
*/
add_action( 'customize_register', 'sophia_after_dark_customize_panels_register' );
/**
* Add panels in the theme customizer
*
*/
function sophia_after_dark_customize_panels_register( $wp_customize ) {
/**
* General Settings Panel
*/
$wp_customize->add_panel( 'sophia_after_dark_general_panel',
array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'General Settings', 'sophia-after-dark' ),
)
);
/**
* Header Settings Panel
*/
$wp_customize->add_panel( 'sophia_after_dark_header_panel',
array(
'priority' => 15,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Header Settings', 'sophia-after-dark' ),
)
);
/**
* Front Settings Panel
*/
$wp_customize->add_panel( 'sophia_after_dark_front_section_panel',
array(
'priority' => 20,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Front Sections', 'sophia-after-dark' ),
)
);
/**
* Design Settings Panel
*/
$wp_customize->add_panel( 'sophia_after_dark_design_panel',
array(
'priority' => 35,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Design Settings', 'sophia-after-dark' ),
)
);
/**
* Additional Features Panel
*/
$wp_customize->add_panel( 'sophia_after_dark_additional_panel',
array(
'priority' => 40,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Additional Features', 'sophia-after-dark' ),
)
);
/**
* Footer Settings Panel
*/
$wp_customize->add_panel( 'sophia_after_dark_footer_panel',
array(
'priority' => 45,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Footer Settings', 'sophia-after-dark' ),
)
);
}

View File

@@ -0,0 +1,103 @@
<?php
/**
* Sophia After Dark Theme Customizer
*
* @package Sophia After Dark
* @since 1.0.0
*/
/**
* Add postMessage support for site title and description for the Theme Customizer.
*
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
*/
function sophia_after_dark_customize_register( $wp_customize ) {
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
$wp_customize->get_section( 'title_tagline' )->panel = 'sophia_after_dark_general_panel';
$wp_customize->get_section( 'title_tagline' )->priority = '5'; $wp_customize->get_section( 'background_image' )->panel = 'sophia_after_dark_general_panel';
$wp_customize->get_section( 'background_image' )->priority = '15';
$wp_customize->get_section( 'static_front_page' )->panel = 'sophia_after_dark_general_panel';
$wp_customize->get_section( 'static_front_page' )->priority = '20';
$wp_customize->get_section( 'header_image' )->panel = 'sophia_after_dark_header_panel';
$wp_customize->get_section( 'header_image' )->priority = '5';
$wp_customize->get_section( 'header_image' )->description = __( 'Header Image for only Innerpages', 'sophia-after-dark' );
if ( isset( $wp_customize->selective_refresh ) ) {
$wp_customize->selective_refresh->add_partial( 'blogname', array(
'selector' => '.site-title a',
'render_callback' => 'sophia_after_dark_customize_partial_blogname',
) );
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
'selector' => '.site-description',
'render_callback' => 'sophia_after_dark_customize_partial_blogdescription',
) );
}
/**
* Load customizer custom classes.
*/
$wp_customize->register_control_type( 'sophia_after_dark_Control_Toggle' );
$wp_customize->register_control_type( 'sophia_after_dark_Control_Radio_Image' );
}
add_action( 'customize_register', 'sophia_after_dark_customize_register' );
/**
* Render the site title for the selective refresh partial.
*
* @return void
*/
function sophia_after_dark_customize_partial_blogname() {
bloginfo( 'name' );
}
/**
* Render the site tagline for the selective refresh partial.
*
* @return void
*/
function sophia_after_dark_customize_partial_blogdescription() {
bloginfo( 'description' );
}
/**
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
*/
function sophia_after_dark_customize_preview_js() {
wp_enqueue_script( 'sophia-after-dark-customizer', get_template_directory_uri() . '/assets/js/customizer.js', array( 'customize-preview' ), '20151215', true );
}
add_action( 'customize_preview_init', 'sophia_after_dark_customize_preview_js' );
/*----------------------------------------------------------------------------------------------------------------------------------------*/
/**
* Enqueue required scripts/styles for customizer panel
*
* @since 1.0.0
*/
function sophia_after_dark_customize_backend_scripts() {
global $sophia_after_dark_theme_version;
wp_enqueue_style( 'sophia-after-dark--admin-customizer-style', get_template_directory_uri() . '/assets/css/mt-customizer-styles.css', array(), esc_attr( esc_attr( $sophia_after_dark_theme_version ) ) );
wp_enqueue_style( 'jquery-ui', esc_url( get_template_directory_uri() . '/assets/css/jquery-ui.css' ) );
wp_enqueue_style( 'font-awesome-customize', get_template_directory_uri() . '/assets/library/font-awesome/css/font-awesome.min.css', array(), '4.7.0' );
wp_enqueue_script( 'sophia-after-dark--admin-customizer-script', get_template_directory_uri() . '/assets/js/mt-customizer-controls.js', array( 'jquery', 'customize-controls' ), esc_attr( $sophia_after_dark_theme_version ), true );
}
add_action( 'customize_controls_enqueue_scripts', 'sophia_after_dark_customize_backend_scripts', 10 );
/**
* Add Kirki required file for custom fields
*/
require get_template_directory() . '/inc/customizer/mt-customizer-custom-classes.php';
require get_template_directory() . '/inc/customizer/mt-customizer-panels.php';
require get_template_directory() . '/inc/customizer/mt-sanitize.php';
require get_template_directory() . '/inc/customizer/mt-callback.php';
require get_template_directory() . '/inc/customizer/mt-customizer-general-panel-options.php';
require get_template_directory() . '/inc/customizer/mt-customizer-header-panel-options.php';
require get_template_directory() . '/inc/customizer/mt-customizer-front-panel-options.php';
require get_template_directory() . '/inc/customizer/mt-customizer-additional-panel-options.php';
require get_template_directory() . '/inc/customizer/mt-customizer-design-panel-options.php';
require get_template_directory() . '/inc/customizer/mt-customizer-footer-panel-options.php';

View File

@@ -0,0 +1,47 @@
<?php
/**
* Sanitize customizer field
*
* @package Sophia After Dark
* @since 1.0.0
*/
if ( ! function_exists( 'sophia_after_dark_sanitize_checkbox' ) ) :
/**
* Sanitize checkbox.
*
* @since 1.0.0
*
* @param bool $checked Whether the checkbox is checked.
* @return bool Whether the checkbox is checked.
*/
function sophia_after_dark_sanitize_checkbox( $checked ) {
return ( ( isset( $checked ) && true === $checked ) ? true : false );
}
endif;
if ( ! function_exists( 'sophia_after_dark_sanitize_select' ) ) :
/**
* Sanitize select.
*
* @since 1.0.0
*
* @param mixed $input The value to sanitize.
* @param WP_Customize_Setting $setting WP_Customize_Setting instance.
* @return mixed Sanitized value.
*/
function sophia_after_dark_sanitize_select( $input, $setting ) {
// Ensure input is a slug.
$input = sanitize_key( $input );
// Get list of choices from the control associated with the setting.
$choices = $setting->manager->get_control( $setting->id )->choices;
// If the input is a valid key, return it; otherwise, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
endif;