did some sniff sniff

This commit is contained in:
2025-07-14 21:47:29 -07:00
parent c6bb1b7c7b
commit 0e9321b01a
44 changed files with 2557 additions and 2259 deletions

View File

@@ -1,14 +1,14 @@
<?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
@@ -17,19 +17,19 @@ if ( ! function_exists( 'sophia_after_dark_enable_top_header_active_callback' )
*
* @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;
}
}
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
@@ -38,40 +38,40 @@ if ( ! function_exists( 'sophia_after_dark_enable_top_header_trending_active_cal
*
* @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;
}
}
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;
}
}
/**
* 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
@@ -80,19 +80,19 @@ if ( ! function_exists( 'sophia_after_dark_section_slider_option_active_callback
*
* @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;
}
}
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
@@ -101,19 +101,19 @@ if ( ! function_exists( 'sophia_after_dark_section_top_featured_posts_option_act
*
* @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;
}
}
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
@@ -122,19 +122,19 @@ if ( ! function_exists( 'sophia_after_dark_enable_footer_widget_area_active_call
*
* @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;
}
}
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
@@ -143,20 +143,20 @@ if ( ! function_exists( 'sophia_after_dark_enable_footer_menu_active_callback' )
*
* @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;
}
}
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
@@ -165,12 +165,12 @@ if ( ! function_exists( 'sophia_after_dark_enable_pnf_latest_posts_active_callba
*
* @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;
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

@@ -8,21 +8,21 @@
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 Section ------------------------------------------------*/
/**
* Social Icons
*/
$wp_customize->add_section( 'sophia_after_dark_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' => '',
'title' => esc_html__( 'Social Icons', 'sophia-after-dark' ),
'panel' => 'sophia_after_dark_additional_panel',
'capability' => 'edit_theme_options',
'priority' => 5,
'theme_supports' => '',
)
);
@@ -30,10 +30,11 @@ function sophia_after_dark_customize_additinal_panels_sections_register( $wp_cus
* Repeater field for social icons
*/
$wp_customize->add_setting(
'sophia_after_dark_social_icons',
'sophia_after_dark_social_icons',
array(
'capability' => 'edit_theme_options',
'default' => json_encode( array(
'capability' => 'edit_theme_options',
'default' => json_encode(
array(
array(
'social_icon' => 'fa fa-twitter',
'social_url' => '#',
@@ -41,73 +42,77 @@ function sophia_after_dark_customize_additinal_panels_sections_register( $wp_cus
array(
'social_icon' => 'fa fa-pinterest',
'social_url' => '#',
)
),
)
),
'sanitize_callback' => 'wp_kses_post'
'sanitize_callback' => 'wp_kses_post',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Repeater(
$wp_customize,
$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' )
'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' )
'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' )
'type' => 'url',
'label' => esc_html__( 'Social Link URL', 'sophia-after-dark' ),
'description' => __( 'Enter social media url.', 'sophia-after-dark' ),
),
)
)
)
);
/*------------------------------------------------ Breadcrumbs Section ------------------------------------------------*
/*
------------------------------------------------ Breadcrumbs Section ------------------------------------------------*
/**
* Breadcrumbs
*/
$wp_customize->add_section( 'sophia_after_dark_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' => '',
'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',
$wp_customize->add_setting(
'sophia_after_dark_enable_breadcrumb_option',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
'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',
$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,
'label' => __( 'Enable Breadcrumbs', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_breadcrumbs',
'settings' => 'sophia_after_dark_enable_breadcrumb_option',
'priority' => 5,
)
)
);
}
}

View File

@@ -8,19 +8,19 @@
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' ) ) {
/**
* 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.
*
@@ -28,29 +28,29 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
* @var string
*/
public $type = 'sad-toggle';
public $tooltip = '';
public function to_json() {
parent::to_json();
if ( isset( $this->default ) ) {
$this->json['default'] = $this->default;
} else{
} 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 ) { #>
@@ -70,13 +70,13 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
}
}
} //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 {
/**
@@ -86,30 +86,30 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
* @var string
*/
public $type = 'sad-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() {
?>
@@ -141,14 +141,14 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
}
}
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------*/
if ( ! class_exists( 'sophia_after_dark_Control_Repeater' ) ) {
/**
* Repeater control
*/
*/
class Sophia_After_Dark_Control_Repeater extends WP_Customize_Control {
/**
* The control type.
*
@@ -156,11 +156,11 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
* @var string
*/
public $type = 'sad-repeater';
public $sophia_after_dark_box_label = '';
public $sophia_after_dark_box_add_control = '';
/**
* The fields that each container row will contain.
*
@@ -168,26 +168,26 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
* @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->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() );
$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 ) { ?>
@@ -201,121 +201,120 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
</ul>
<input type="hidden" <?php $this->link(); ?> class="sad-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="<?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 sad-repeater-add-control-field"><?php echo esc_html( $this->sophia_after_dark_box_add_control ); ?></button>
<?php
<?php
}
private function sophia_after_dark_get_fields() {
$fields = $this->fields;
$values = json_decode( $this->value() );
if ( is_array( $values ) ) {
foreach( $values as $value ) {
?>
foreach ( $values as $value ) {
?>
<li class="sad-repeater-field-control">
<h3 class="sad-repeater-field-title"><?php echo esc_html( $this->sophia_after_dark_box_label ); ?></h3>
<div class="sad-repeater-fields">
<?php
<?php
foreach ( $fields as $key => $field ) {
$class = isset( $field['class'] ) ? $field['class'] : '';
?>
<div class="sad-repeater-field sad-repeater-type-<?php echo esc_attr( $field['type'] ).' '.esc_attr( $class ); ?>">
$class = isset( $field['class'] ) ? $field['class'] : '';
?>
<div class="sad-repeater-field sad-repeater-type-<?php echo esc_attr( $field['type'] ) . ' ' . esc_attr( $class ); ?>">
<?php
$label = isset( $field['label'] ) ? $field['label'] : '';
<?php
$label = isset( $field['label'] ) ? $field['label'] : '';
$description = isset( $field['description'] ) ? $field['description'] : '';
if ( $field['type'] != 'checkbox' ) {
?>
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
<?php
}
$new_value = isset( $value->$key ) ? $value->$key : '';
$default = isset( $field['default'] ) ? $field['default'] : '';
$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 ).'"/>';
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>';
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 ).'"/>';
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_fork_awesome_icon_array = sophia_after_dark_fork_awesome_icon_array();
echo '<div class="sad-repeater-selected-icon"><i class="'.esc_attr( $new_value ).'"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="sad-repeater-icon-list sad-clearfix">';
echo '<div class="sad-repeater-selected-icon"><i class="' . esc_attr( $new_value ) . '"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="sad-repeater-icon-list sad-clearfix">';
foreach ( $sophia_after_dark_fork_awesome_icon_array as $sophia_after_dark_fork_awesome_icon ) {
$icon_class = $new_value == $sophia_after_dark_fork_awesome_icon ? 'icon-active' : '';
echo '<li class='.esc_attr( $icon_class ).'><i class="'.esc_attr( $sophia_after_dark_fork_awesome_icon ).'"></i></li>';
echo '<li class=' . esc_attr( $icon_class ) . '><i class="' . esc_attr( $sophia_after_dark_fork_awesome_icon ) . '"></i></li>';
}
echo '</ul><input data-default="'.esc_attr( $default ).'" type="hidden" value="'.esc_attr( $new_value ).'" data-name="'.esc_attr( $key ).'"/>';
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_fork_awesome_social_icon_array = sophia_after_dark_fork_awesome_social_icon_array();
echo '<div class="sad-repeater-selected-icon"><i class="'.esc_attr( $new_value ).'"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="sad-repeater-icon-list sad-clearfix">';
echo '<div class="sad-repeater-selected-icon"><i class="' . esc_attr( $new_value ) . '"></i><span><i class="fa fa-angle-down"></i></span></div><ul class="sad-repeater-icon-list sad-clearfix">';
foreach ( $sophia_after_dark_fork_awesome_social_icon_array as $sophia_after_dark_fork_awesome_icon ) {
$icon_class = $new_value == $sophia_after_dark_fork_awesome_icon ? 'icon-active' : '';
echo '<li class='.esc_attr( $icon_class ).'><i class="'.esc_attr( $sophia_after_dark_fork_awesome_icon ).'"></i></li>';
echo '<li class=' . esc_attr( $icon_class ) . '><i class="' . esc_attr( $sophia_after_dark_fork_awesome_icon ) . '"></i></li>';
}
echo '</ul><input data-default="'.esc_attr( $default ).'" type="hidden" value="'.esc_attr( $new_value ).'" data-name="'.esc_attr( $key ).'"/>';
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 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 ).'"';
$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(
$dropdown = wp_dropdown_pages(
array(
'name' => esc_attr( $key ),
'echo' => '',
'show_option_none' => esc_html( $show_option_none ),
'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 )
'selected' => esc_attr( $new_value ),
)
);
if ( empty( $dropdown ) ) {
$dropdown = sprintf( '<select id="%1$s" name="%1$s">', esc_attr( $key ) );
$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>';
}
@@ -324,44 +323,44 @@ if ( ! function_exists( 'sophia_after_dark_register_custom_controls' ) ) :
$dropdown = str_replace( '<select', '<select ' . $select_field, $dropdown );
echo $dropdown;
break;
/**
* Upload field
*/
case 'upload':
$image_class = "";
$image_class = '';
$upload_btn_label = esc_html__( 'Select Image', 'sophia-after-dark' );
$remove_btn_label = esc_html__( 'Remove', 'sophia-after-dark' );
if ( $new_value ) {
if ( $new_value ) {
$image_class = ' hidden';
}
echo '<div class="sad-fields-wrap"><div class="attachment-media-view"><div class="placeholder'. esc_attr( $image_class ).'">';
echo '<div class="sad-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 sad-clearfix"><button type="button" class="button sad-delete-button align-left">'. esc_html( $remove_btn_label ) .'</button><button type="button" class="button sad-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>';
echo '</div><div class="thumbnail thumbnail-image"><img src="' . esc_url( $new_value ) . '" style="max-width:100%;"/></div><div class="actions sad-clearfix"><button type="button" class="button sad-delete-button align-left">' . esc_html( $remove_btn_label ) . '</button><button type="button" class="button sad-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
}
?>
<?php
}
?>
<div class="sad-clearfix sad-repeater-footer">
<div class="alignright">
<a class="sad-repeater-field-remove" href="#remove"><?php esc_html_e( 'Delete', 'sophia-after-dark' ) ?></a> |
<a class="sad-repeater-field-close" href="#close"><?php esc_html_e( 'Close', 'sophia-after-dark' ) ?></a>
<a class="sad-repeater-field-remove" href="#remove"><?php esc_html_e( 'Delete', 'sophia-after-dark' ); ?></a> |
<a class="sad-repeater-field-close" href="#close"><?php esc_html_e( 'Close', 'sophia-after-dark' ); ?></a>
</div>
</div>
</div>
</li>
<?php
<?php
}
}
}
}
}
}// Ends sophia_after_dark_register_custom_controls
}//end sophia_after_dark_register_custom_controls()
endif;
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------*/
/*-----------------------------------------------------------------------------------------------------------------------------------------------------------*/

View File

@@ -9,45 +9,47 @@
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',
$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' => '',
'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',
$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',
$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'
'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',
),
)
)
@@ -56,20 +58,23 @@ function sophia_after_dark_customize_design_panels_sections_register( $wp_custom
/*
* Radio Image field for arvhive/blog style.
*/
$wp_customize->add_setting( 'sophia_after_dark_archive_style',
$wp_customize->add_setting(
'sophia_after_dark_archive_style',
array(
'default' => 'sad-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',
$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(
'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(
'sad-archive--block-grid-style' => get_template_directory_uri() . '/assets/images/archive-block-grid.png',
'sad-archive--masonry-style' => get_template_directory_uri() . '/assets/images/archive-masonry.png',
),
@@ -80,82 +85,90 @@ function sophia_after_dark_customize_design_panels_sections_register( $wp_custom
/*
* Text field for archive read more button.
*/
$wp_customize->add_setting( 'sophia_after_dark_archive_read_more',
$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'
'default' => esc_html__( 'Discover', 'sophia-after-dark' ),
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control( 'sophia_after_dark_archive_read_more',
$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,
'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',
$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'
'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',
$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,
'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',
$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' => '',
'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',
$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',
$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'
'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',
),
)
)
@@ -164,21 +177,24 @@ function sophia_after_dark_customize_design_panels_sections_register( $wp_custom
/*
* Toggle field for Enable/Disable related posts.
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_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'
'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',
$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,
'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,
)
)
);
@@ -187,37 +203,41 @@ function sophia_after_dark_customize_design_panels_sections_register( $wp_custom
/**
* Page Setting
*/
$wp_customize->add_section( 'sophia_after_dark_section_page_settings',
$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' => '',
'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',
$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',
$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'
'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',
),
)
)
@@ -227,34 +247,38 @@ function sophia_after_dark_customize_design_panels_sections_register( $wp_custom
/**
* 404 Page Settings
*/
$wp_customize->add_section( 'sophia_after_dark_section_pnf_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' )
'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',
$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'
'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',
$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,
'label' => __( 'Enable Latest Posts', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_pnf_settings',
'settings' => 'sophia_after_dark_enable_pnf_latest_posts',
'priority' => 40,
)
)
);
@@ -262,42 +286,46 @@ function sophia_after_dark_customize_design_panels_sections_register( $wp_custom
/**
* Text field for latest posts section title
*/
$wp_customize->add_setting( 'sophia_after_dark_pnf_latest_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'
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control( 'sophia_after_dark_pnf_latest_title',
$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',
'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',
$wp_customize->add_setting(
'sophia_after_dark_pnf_latest_post_count',
array(
'capability' => 'edit_theme_options',
'default' => 3,
'capability' => 'edit_theme_options',
'default' => 3,
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control( 'sophia_after_dark_pnf_latest_post_count',
$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',
'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

@@ -9,68 +9,74 @@
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',
$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' => '',
'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',
$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'
'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',
$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,
'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',
$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',
$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'
'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',
),
)
)
@@ -80,77 +86,84 @@ function sophia_after_dark_customize_footer_panels_sections_register( $wp_custom
/**
* Bottom footer
*/
$wp_customize->add_section( 'sophia_after_dark_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' => '',
'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',
$wp_customize->add_setting(
'sophia_after_dark_enable_footer_menu',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
'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',
$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,
'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',
$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'
'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',
$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',
'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',
$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'
'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',
$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',
'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

@@ -9,7 +9,6 @@
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 ) {
@@ -17,83 +16,90 @@ function sophia_after_dark_customize_slider_panels_sections_register( $wp_custom
/**
* Slider Settings
*/
$wp_customize->add_section( 'sophia_after_dark_section_slider',
$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' )
'title' => __( 'Slider Settings', 'sophia-after-dark' ),
)
);
/**
* Toggle field for slider option
*
*/
$wp_customize->add_setting( 'sophia_after_dark_section_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'
'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',
$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,
'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',
$wp_customize->add_setting(
'sophia_after_dark_section_slider_cat',
array(
'capability' => 'edit_theme_options',
'default' => '',
'capability' => 'edit_theme_options',
'default' => '',
'sanitize_callback' => 'sophia_after_dark_sanitize_select',
)
);
$wp_customize->add_control( 'sophia_after_dark_section_slider_cat',
)
);
$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',
'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',
$wp_customize->add_setting(
'sophia_after_dark_slider_bg_image',
array(
'capability' => 'edit_theme_options',
'default' => '',
'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',
$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'
'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',
)
)
);
@@ -102,83 +108,90 @@ function sophia_after_dark_customize_slider_panels_sections_register( $wp_custom
/**
* Featured Slider Settings
*/
$wp_customize->add_section( 'sophia_after_dark_section_top_featured_post',
$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' ),
'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',
$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'
'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',
$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,
'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
* Text field for Featured Posts Title
*/
$wp_customize->add_setting( 'sophia_after_dark_top_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'
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control( 'sophia_after_dark_top_featured_posts_title',
$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',
'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',
$wp_customize->add_setting(
'sophia_after_dark_top_featured_post_order',
array(
'capability' => 'edit_theme_options',
'default' => 'default',
'capability' => 'edit_theme_options',
'default' => 'default',
'sanitize_callback' => 'sophia_after_dark_sanitize_select',
)
);
$wp_customize->add_control( 'sophia_after_dark_top_featured_post_order',
$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' ),
'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',
'active_callback' => 'sophia_after_dark_section_top_featured_posts_option_active_callback',
)
);
}
}

View File

@@ -9,117 +9,130 @@
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',
$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' )
'title' => __( 'Site Settings', 'sophia-after-dark' ),
)
);
/**
* Toggle field for Enable/Disable wow animation.
*
* Toggle field for Enable/Disable wow animation.
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_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'
'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',
$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,
'label' => __( 'Enable Wow Animation', 'sophia-after-dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_enable_wow_animation',
'priority' => 10,
)
)
);
$wp_customize->add_control(new WP_Customize_Image_control(
$wp_customize, 'sophia_after_dark_home_og_image', array(
'label' => __('Home Page Open Graph Image', 'sophia_after_dark'),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_home_og_image',
'priority' => 15,
$wp_customize->add_control(
new WP_Customize_Image_control(
$wp_customize,
'sophia_after_dark_home_og_image',
array(
'label' => __( 'Home Page Open Graph Image', 'sophia_after_dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_home_og_image',
'priority' => 15,
)
)
)
);
$users = get_users();
$users = get_users();
$user_choices = array();
foreach ($users as $user) {
$user_choices[$user->ID] = $user->display_name;
foreach ( $users as $user ) {
$user_choices[ $user->ID ] = $user->display_name;
}
$wp_customize->add_control('sophia_after_dark_home_og_user', array(
'label' => __('Select User for Open Graph Tags', 'sophia_after_dark'),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_home_og_user',
'type' => 'select',
'choices' => $user_choices,
'priority' => 20,
)
$wp_customize->add_control(
'sophia_after_dark_home_og_user',
array(
'label' => __( 'Select User for Open Graph Tags', 'sophia_after_dark' ),
'section' => 'sophia_after_dark_section_site',
'settings' => 'sophia_after_dark_home_og_user',
'type' => 'select',
'choices' => $user_choices,
'priority' => 20,
)
);
/**
* Radio image field for Archive Sidebar
*
* @since 1.0.0
*/
$wp_customize->add_setting( 'sophia_after_dark_site_layout',
$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',
$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' => 25,
'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'
'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' => 25,
'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',
$wp_customize->add_setting(
'sophia_after_dark_enable_widgets_editor',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
'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',
$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' => 25,
'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' => 25,
)
)
);
}
}

View File

@@ -9,7 +9,6 @@
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 ) {
@@ -17,228 +16,241 @@ function sophia_after_dark_customize_header_panels_sections_register( $wp_custom
/**
* Top Header Section
*/
$wp_customize->add_section( 'sophia_after_dark_section_top_header',
$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' )
'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',
$wp_customize->add_setting(
'sophia_after_dark_enable_top_header',
array(
'capability' => 'edit_theme_options',
'default' => true,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
'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',
$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,
'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',
$wp_customize->add_setting(
'sophia_after_dark_enable_trending',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox',
)
);
$wp_customize->add_control( new Sophia_After_Dark_Control_Toggle(
$wp_customize, 'sophia_after_dark_enable_trending',
$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',
'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',
$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'
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox',
)
);
$wp_customize->add_control( 'sophia_after_dark_enable_trending_tag_before_icon',
$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',
'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',
$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'
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control( 'sophia_after_dark_trending_label',
$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',
'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',
$wp_customize->add_setting(
'sophia_after_dark_trending_tags_orderby',
array(
'capability' => 'edit_theme_options',
'default' => '',
'capability' => 'edit_theme_options',
'default' => '',
'sanitize_callback' => 'sophia_after_dark_sanitize_select',
)
);
$wp_customize->add_control( 'sophia_after_dark_trending_tags_orderby',
$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' ),
'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',
'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',
$wp_customize->add_setting(
'sophia_after_dark_trending_tags_count',
array(
'capability' => 'edit_theme_options',
'default' => '5',
'sanitize_callback' => 'absint',
'capability' => 'edit_theme_options',
'default' => '5',
'sanitize_callback' => 'absint',
)
);
$wp_customize->add_control( 'sophia_after_dark_trending_tags_count',
$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',
'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',
$wp_customize->add_setting(
'sophia_after_dark_enable_live_now',
array(
'capability' => 'edit_theme_options',
'default' => false,
'sanitize_callback' => 'sophia_after_dark_sanitize_checkbox'
'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',
$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',
'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',
$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'
'sanitize_callback' => 'sanitize_text_field',
)
);
$wp_customize->add_control( 'sophia_after_dark_live_now_label',
$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',
'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',
$wp_customize->add_setting(
'sophia_after_dark_live_now_link',
array(
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw'
'sanitize_callback' => 'esc_url_raw',
)
);
$wp_customize->add_control( 'sophia_after_dark_live_now_link',
$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"
)
'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',
),
)
);
@@ -246,82 +258,89 @@ function sophia_after_dark_customize_header_panels_sections_register( $wp_custom
/**
* Header Extra Options
*/
$wp_customize->add_section( 'sophia_after_dark_section_header_extra',
$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' )
'title' => __( 'Extra Options', 'sophia-after-dark' ),
)
);
/**
* Toggle field for Enable/Disable sticky menu.
*
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_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'
'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',
$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,
'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',
$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'
'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',
$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,
'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.
*
* Toggle field for Enable/Disable search icon.
*/
$wp_customize->add_setting( 'sophia_after_dark_enable_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'
'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',
$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,
'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

@@ -9,78 +9,83 @@ 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',
$wp_customize->add_panel(
'sophia_after_dark_general_panel',
array(
'priority' => 10,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'General Settings', 'sophia-after-dark' ),
'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',
$wp_customize->add_panel(
'sophia_after_dark_header_panel',
array(
'priority' => 15,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Header Settings', 'sophia-after-dark' ),
'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',
$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' ),
'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',
$wp_customize->add_panel(
'sophia_after_dark_design_panel',
array(
'priority' => 35,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Design Settings', 'sophia-after-dark' ),
'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',
$wp_customize->add_panel(
'sophia_after_dark_additional_panel',
array(
'priority' => 40,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Additional Features', 'sophia-after-dark' ),
'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',
$wp_customize->add_panel(
'sophia_after_dark_footer_panel',
array(
'priority' => 45,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Footer Settings', 'sophia-after-dark' ),
'priority' => 45,
'capability' => 'edit_theme_options',
'theme_supports' => '',
'title' => __( 'Footer Settings', 'sophia-after-dark' ),
)
);
}
}

View File

@@ -16,24 +16,45 @@ 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' );
$wp_customize->add_setting('sophia_after_dark_home_og_image', array('default' => '','sanitize_callback' => 'esc_url_raw','type' => 'option',));
$wp_customize->add_setting('sophia_after_dark_home_og_user', array('default' => 1,'sanitize_callback' => 'absint','type' => 'option',));
$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' );
$wp_customize->add_setting(
'sophia_after_dark_home_og_image',
array(
'default' => '',
'sanitize_callback' => 'esc_url_raw',
'type' => 'option',
)
);
$wp_customize->add_setting(
'sophia_after_dark_home_og_user',
array(
'default' => 1,
'sanitize_callback' => 'absint',
'type' => 'option',
)
);
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',
) );
$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',
)
);
}
/**
@@ -87,7 +108,7 @@ add_action( 'customize_controls_enqueue_scripts', 'sophia_after_dark_customize_b
/**
* Add Kirki required file for custom fields
*/
#require get_template_directory() . '/inc/customizer/sad-customizer-additional-open-graph.php';
// require get_template_directory() . '/inc/customizer/sad-customizer-additional-open-graph.php';
require get_template_directory() . '/inc/customizer/sad-customizer-custom-classes.php';
require get_template_directory() . '/inc/customizer/sad-customizer-panels.php';
@@ -99,4 +120,4 @@ require get_template_directory() . '/inc/customizer/sad-customizer-header-panel-
require get_template_directory() . '/inc/customizer/sad-customizer-front-panel-options.php';
require get_template_directory() . '/inc/customizer/sad-customizer-additional-panel-options.php';
require get_template_directory() . '/inc/customizer/sad-customizer-design-panel-options.php';
require get_template_directory() . '/inc/customizer/sad-customizer-footer-panel-options.php';
require get_template_directory() . '/inc/customizer/sad-customizer-footer-panel-options.php';

View File

@@ -1,14 +1,14 @@
<?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
@@ -43,5 +43,5 @@ if ( ! function_exists( 'sophia_after_dark_sanitize_select' ) ) :
// If the input is a valid key, return it; otherwise, return the default.
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
}
endif;
endif;