Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,105 @@
|
||||
<?php
|
||||
/**
|
||||
* Appearance Setting Panel
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_appearance_settings_panel' ) ) :
|
||||
/**
|
||||
* Add appearance settings panel
|
||||
*/
|
||||
function rara_business_customize_register_appearance_settings_panel( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_panel( 'appearance_settings_panel', array(
|
||||
'title' => __( 'Appearance Settings', 'rara-business' ),
|
||||
'priority' => 60,
|
||||
'capability' => 'edit_theme_options',
|
||||
) );
|
||||
|
||||
/** Typography */
|
||||
$wp_customize->add_section(
|
||||
'typography_settings',
|
||||
array(
|
||||
'title' => __( 'Typography', 'rara-business' ),
|
||||
'priority' => 70,
|
||||
'panel' => 'appearance_settings',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'ed_localgoogle_fonts',
|
||||
array(
|
||||
'default' => false,
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'ed_localgoogle_fonts',
|
||||
array(
|
||||
'label' => __( 'Load Google Fonts Locally', 'rara-business' ),
|
||||
'section' => 'typography_settings',
|
||||
'type' => 'checkbox',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'ed_preload_local_fonts',
|
||||
array(
|
||||
'default' => false,
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'ed_preload_local_fonts',
|
||||
array(
|
||||
'label' => __( 'Preload Local Fonts', 'rara-business' ),
|
||||
'section' => 'typography_settings',
|
||||
'type' => 'checkbox',
|
||||
'active_callback' => 'rara_business_flush_fonts_callback'
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'flush_google_fonts',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'flush_google_fonts',
|
||||
array(
|
||||
'label' => __( 'Flush Local Fonts Cache', 'rara-business' ),
|
||||
'description' => __( 'Click the button to reset the local fonts cache.', 'rara-business' ),
|
||||
'type' => 'button',
|
||||
'settings' => array(),
|
||||
'section' => 'typography_settings',
|
||||
'input_attrs' => array(
|
||||
'value' => __( 'Flush Local Fonts Cache', 'rara-business' ),
|
||||
'class' => 'button button-primary flush-it',
|
||||
),
|
||||
'active_callback' => 'rara_business_flush_fonts_callback'
|
||||
)
|
||||
);
|
||||
|
||||
// Move default section to apperance settings panel
|
||||
$wp_customize->get_section( 'background_image' )->panel = 'appearance_settings_panel';
|
||||
$wp_customize->get_section( 'colors' )->panel = 'appearance_settings_panel';
|
||||
$wp_customize->get_section( 'typography_settings' )->panel = 'appearance_settings_panel';
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_appearance_settings_panel' );
|
||||
|
||||
function rara_business_flush_fonts_callback( $control ){
|
||||
$ed_localgoogle_fonts = $control->manager->get_setting( 'ed_localgoogle_fonts' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
if ( $control_id == 'flush_google_fonts' && $ed_localgoogle_fonts ) return true;
|
||||
if ( $control_id == 'ed_preload_local_fonts' && $ed_localgoogle_fonts ) return true;
|
||||
return false;
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
/**
|
||||
* Front Page Panel
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_frontpage_panel' ) ) :
|
||||
/**
|
||||
* Add frontpage panel
|
||||
*/
|
||||
function rara_business_customize_register_frontpage_panel( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_panel( 'frontpage_panel', array(
|
||||
'title' => __( 'Frontpage Settings', 'rara-business' ),
|
||||
'priority' => 60,
|
||||
'capability' => 'edit_theme_options',
|
||||
) );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_frontpage_panel' );
|
||||
@@ -0,0 +1,227 @@
|
||||
<?php
|
||||
/**
|
||||
* Banner Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_banner_section' ) ) :
|
||||
/**
|
||||
* Add banner section controls
|
||||
*/
|
||||
function rara_business_customize_register_banner_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
$wp_customize->get_section( 'header_image' )->panel = 'frontpage_panel';
|
||||
$wp_customize->get_section( 'header_image' )->title = __( 'Banner Section', 'rara-business' );
|
||||
$wp_customize->get_section( 'header_image' )->priority = 10;
|
||||
$wp_customize->get_control( 'header_image' )->active_callback = 'rara_business_banner_ac';
|
||||
$wp_customize->get_control( 'header_video' )->active_callback = 'rara_business_banner_ac';
|
||||
$wp_customize->get_control( 'external_header_video' )->active_callback = 'rara_business_banner_ac';
|
||||
$wp_customize->get_section( 'header_image' )->description = '';
|
||||
$wp_customize->get_setting( 'header_image' )->transport = 'refresh';
|
||||
$wp_customize->get_setting( 'header_video' )->transport = 'refresh';
|
||||
$wp_customize->get_setting( 'external_header_video' )->transport = 'refresh';
|
||||
|
||||
/** Banner Options */
|
||||
$wp_customize->add_setting(
|
||||
'ed_banner_section',
|
||||
array(
|
||||
'default' => $default_options['ed_banner_section'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_select'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Select_Control(
|
||||
$wp_customize,
|
||||
'ed_banner_section',
|
||||
array(
|
||||
'label' => __( 'Banner Options', 'rara-business' ),
|
||||
'description' => __( 'Choose banner as static image/video.', 'rara-business' ),
|
||||
'section' => 'header_image',
|
||||
'choices' => array(
|
||||
'no_banner' => __( 'Disable Banner Section', 'rara-business' ),
|
||||
'static_banner' => __( 'Static/Video Banner', 'rara-business' ),
|
||||
),
|
||||
'priority' => 5
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Banner title */
|
||||
$wp_customize->add_setting(
|
||||
'banner_title',
|
||||
array(
|
||||
'default' => $default_options['banner_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_title',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Banner Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// banner title selective refresh
|
||||
$wp_customize->selective_refresh->add_partial( 'banner_title', array(
|
||||
'selector' => '.banner .text-holder h2.title',
|
||||
'render_callback' => 'rara_business_banner_title_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Banner description */
|
||||
$wp_customize->add_setting(
|
||||
'banner_description',
|
||||
array(
|
||||
'default' => $default_options['banner_description'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_description',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Banner Description', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Banner description selective refresh
|
||||
$wp_customize->selective_refresh->add_partial( 'banner_description', array(
|
||||
'selector' => '.banner .text-holder p',
|
||||
'render_callback' => 'rara_business_banner_description_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Banner link one label */
|
||||
$wp_customize->add_setting(
|
||||
'banner_link_one_label',
|
||||
array(
|
||||
'default' => $default_options['banner_link_one_label'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_link_one_label',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Link One Label', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for banner link one label
|
||||
$wp_customize->selective_refresh->add_partial( 'banner_link_one_label', array(
|
||||
'selector' => '.banner .btn-holder a.btn-free-inquiry',
|
||||
'render_callback' => 'rara_business_banner_link_one_label_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Banner link one url */
|
||||
$wp_customize->add_setting(
|
||||
'banner_link_one_url',
|
||||
array(
|
||||
'default' => $default_options['banner_link_one_url'],
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_link_one_url',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Link One Url', 'rara-business' ),
|
||||
'type' => 'url',
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
/** Banner link two label */
|
||||
$wp_customize->add_setting(
|
||||
'banner_link_two_label',
|
||||
array(
|
||||
'default' => $default_options['banner_link_two_label'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_link_two_label',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Link Two Label', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for banner link two label.
|
||||
$wp_customize->selective_refresh->add_partial( 'banner_link_two_label', array(
|
||||
'selector' => '.banner .btn-holder a.btn-view-service',
|
||||
'render_callback' => 'rara_business_banner_link_two_label_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Banner link two url */
|
||||
$wp_customize->add_setting(
|
||||
'banner_link_two_url',
|
||||
array(
|
||||
'default' => $default_options['banner_link_two_url'],
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'banner_link_two_url',
|
||||
array(
|
||||
'section' => 'header_image',
|
||||
'label' => __( 'Link Two Url', 'rara-business' ),
|
||||
'type' => 'url',
|
||||
'active_callback' => 'rara_business_banner_ac'
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_banner_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_banner_ac( $control ){
|
||||
$banner = $control->manager->get_setting( 'ed_banner_section' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
// static banner controls
|
||||
if ( $control_id == 'header_image' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'header_video' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'external_header_video' && $banner == 'static_banner' ) return true;
|
||||
|
||||
// banner title and description controls
|
||||
if ( $control_id == 'banner_title' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'banner_description' && $banner == 'static_banner' ) return true;
|
||||
|
||||
// Link button controls
|
||||
if ( $control_id == 'banner_link_one_label' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'banner_link_one_url' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'banner_link_two_label' && $banner == 'static_banner' ) return true;
|
||||
if ( $control_id == 'banner_link_two_url' && $banner == 'static_banner' ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,119 @@
|
||||
<?php
|
||||
/**
|
||||
* Blog Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_blog_section' ) ) :
|
||||
/**
|
||||
* Add blog section controls
|
||||
*/
|
||||
function rara_business_customize_register_blog_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Blog Sectopm */
|
||||
$wp_customize->add_section(
|
||||
'blog_section',
|
||||
array(
|
||||
'title' => __( 'Blog Section', 'rara-business' ),
|
||||
'priority' => 77,
|
||||
'panel' => 'frontpage_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Blog Options */
|
||||
$wp_customize->add_setting(
|
||||
'ed_blog_section',
|
||||
array(
|
||||
'default' => $default_options['ed_blog_section'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_blog_section',
|
||||
array(
|
||||
'label' => __( 'Enable Blog Section', 'rara-business' ),
|
||||
'description' => __( 'Enable to show blog section.', 'rara-business' ),
|
||||
'section' => 'blog_section',
|
||||
'priority' => 5
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Blog title */
|
||||
$wp_customize->add_setting(
|
||||
'blog_title',
|
||||
array(
|
||||
'default' => $default_options['blog_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'blog_title',
|
||||
array(
|
||||
'section' => 'blog_section',
|
||||
'label' => __( 'Blog Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_blog_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for blog title.
|
||||
$wp_customize->selective_refresh->add_partial( 'blog_title', array(
|
||||
'selector' => '.blog-section .widget_text h2.widget-title',
|
||||
'render_callback' => 'rara_business_blog_title_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Blog description */
|
||||
$wp_customize->add_setting(
|
||||
'blog_description',
|
||||
array(
|
||||
'default' => $default_options['blog_description'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'blog_description',
|
||||
array(
|
||||
'section' => 'blog_section',
|
||||
'label' => __( 'Blog Description', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_blog_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for blog description.
|
||||
$wp_customize->selective_refresh->add_partial( 'blog_description', array(
|
||||
'selector' => '.blog-section .textwidget p',
|
||||
'render_callback' => 'rara_business_blog_description_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_blog_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_blog_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_blog_ac( $control ){
|
||||
$show_blog = $control->manager->get_setting( 'ed_blog_section' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
// Blog title, description and number of posts controls
|
||||
if ( $control_id == 'blog_title' && $show_blog ) return true;
|
||||
if ( $control_id == 'blog_description' && $show_blog ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
/**
|
||||
* Portfolio Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_portfolio_section' ) ) :
|
||||
/**
|
||||
* Add portfolio section controls
|
||||
*/
|
||||
function rara_business_customize_register_portfolio_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Portfolio Section */
|
||||
$wp_customize->add_section(
|
||||
'portfolio_section',
|
||||
array(
|
||||
'title' => __( 'Portfolio Section', 'rara-business' ),
|
||||
'priority' => 77,
|
||||
'panel' => 'frontpage_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Portfolio Options */
|
||||
$wp_customize->add_setting(
|
||||
'ed_portfolio_section',
|
||||
array(
|
||||
'default' => $default_options['ed_portfolio_section'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_portfolio_section',
|
||||
array(
|
||||
'label' => __( 'Enable Portfolio Section', 'rara-business' ),
|
||||
'description' => __( 'Enable to show portfolio section.', 'rara-business' ),
|
||||
'section' => 'portfolio_section',
|
||||
'priority' => 5
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if ( rara_business_is_rara_theme_companion_activated() ) {
|
||||
/** Portfolio title */
|
||||
$wp_customize->add_setting(
|
||||
'portfolio_title',
|
||||
array(
|
||||
'default' => $default_options['portfolio_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'portfolio_title',
|
||||
array(
|
||||
'section' => 'portfolio_section',
|
||||
'label' => __( 'Portfolio Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_portfolio_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for portfolio title.
|
||||
$wp_customize->selective_refresh->add_partial( 'portfolio_title', array(
|
||||
'selector' => '.portfolio .widget_text h2.widget-title',
|
||||
'render_callback' => 'rara_business_portfolio_title_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Portfolio description */
|
||||
$wp_customize->add_setting(
|
||||
'portfolio_description',
|
||||
array(
|
||||
'default' => $default_options['portfolio_description'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'portfolio_description',
|
||||
array(
|
||||
'section' => 'portfolio_section',
|
||||
'label' => __( 'Portfolio Description', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_portfolio_ac'
|
||||
)
|
||||
);
|
||||
|
||||
// Selective refresh for portfolio description.
|
||||
$wp_customize->selective_refresh->add_partial( 'portfolio_description', array(
|
||||
'selector' => '.portfolio .textwidget p',
|
||||
'render_callback' => 'rara_business_portfolio_description_selective_refresh',
|
||||
'container_inclusive' => false,
|
||||
'fallback_refresh' => true,
|
||||
) );
|
||||
|
||||
/** Number Of Portfolio Posts */
|
||||
$wp_customize->add_setting(
|
||||
'portfolio_no_of_posts',
|
||||
array(
|
||||
'default' => $default_options['portfolio_no_of_posts'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_select'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Select_Control(
|
||||
$wp_customize,
|
||||
'portfolio_no_of_posts',
|
||||
array(
|
||||
'label' => __( 'Number of Posts', 'rara-business' ),
|
||||
'description' => __( 'Choose number of portfolio posts to be displayed.', 'rara-business' ),
|
||||
'section' => 'portfolio_section',
|
||||
'choices' => array(
|
||||
'5' => __( '5', 'rara-business' ),
|
||||
'10' => __( '10', 'rara-business' ),
|
||||
),
|
||||
'active_callback' => 'rara_business_portfolio_ac'
|
||||
)
|
||||
)
|
||||
);
|
||||
} else {
|
||||
/** Activate RaraTheme Companion Plugin Note */
|
||||
$wp_customize->add_setting(
|
||||
'portfolio_note',
|
||||
array(
|
||||
'sanitize_callback' => 'wp_kses_post'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Note_Control(
|
||||
$wp_customize,
|
||||
'portfolio_note',
|
||||
array(
|
||||
'section' => 'portfolio_section',
|
||||
/* translators: 1: link start, 2: link close */
|
||||
'description' => sprintf( __( 'Please install and activate the recommended plugin %1$sRaraTheme Companion%2$s.', 'rara-business' ), '<a href="' . esc_url( admin_url( 'themes.php?page=tgmpa-install-plugins' ) ) . '" target="_blank">', '</a>' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_portfolio_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_portfolio_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_portfolio_ac( $control ){
|
||||
$show_portfolio = $control->manager->get_setting( 'ed_portfolio_section' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
// Portfolio title, description and number of posts controls
|
||||
if ( $control_id == 'portfolio_title' && $show_portfolio ) return true;
|
||||
if ( $control_id == 'portfolio_description' && $show_portfolio ) return true;
|
||||
if ( $control_id == 'portfolio_no_of_posts' && $show_portfolio ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,22 @@
|
||||
<?php
|
||||
/**
|
||||
* General Setting Panel
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_general_settings_panel' ) ) :
|
||||
/**
|
||||
* Add general settings panel
|
||||
*/
|
||||
function rara_business_customize_register_general_settings_panel( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_panel( 'general_settings_panel', array(
|
||||
'title' => __( 'General Settings', 'rara-business' ),
|
||||
'priority' => 60,
|
||||
'capability' => 'edit_theme_options',
|
||||
) );
|
||||
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_general_settings_panel' );
|
||||
@@ -0,0 +1,272 @@
|
||||
<?php
|
||||
/**
|
||||
* Header Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_header_section' ) ) :
|
||||
/**
|
||||
* Add header section controls
|
||||
*/
|
||||
function rara_business_customize_register_header_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Header Section */
|
||||
$wp_customize->add_section(
|
||||
'header_section',
|
||||
array(
|
||||
'title' => __( 'Header Section', 'rara-business' ),
|
||||
'priority' => 10,
|
||||
'panel' => 'general_settings_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Enable header top section */
|
||||
$wp_customize->add_setting(
|
||||
'ed_header_contact_details',
|
||||
array(
|
||||
'default' => $default_options['ed_header_contact_details'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_header_contact_details',
|
||||
array(
|
||||
'section' => 'header_section',
|
||||
'label' => __( 'Enable Header Contact Details', 'rara-business' ),
|
||||
'description' => __( 'Enable to show contact details in header top section.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Phone number */
|
||||
$wp_customize->add_setting(
|
||||
'header_phone',
|
||||
array(
|
||||
'default' => $default_options['header_phone'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'header_phone', array(
|
||||
'selector' => '.header-t .phone a.tel-link',
|
||||
'render_callback' => 'rara_business_header_phone_selective_refresh',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
'header_phone',
|
||||
array(
|
||||
'label' => __( 'Phone Number', 'rara-business' ),
|
||||
'description' => __( 'Add phone no. in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'text',
|
||||
'active_callback' => 'rara_business_header_top_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
/** Address */
|
||||
$wp_customize->add_setting(
|
||||
'header_address',
|
||||
array(
|
||||
'default' => $default_options['header_address'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'header_address', array(
|
||||
'selector' => '.header-t .address address',
|
||||
'render_callback' => 'rara_business_header_address_selective_refresh',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
'header_address',
|
||||
array(
|
||||
'label' => __( 'Address', 'rara-business' ),
|
||||
'description' => __( 'Add address in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'text',
|
||||
'active_callback' => 'rara_business_header_top_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
/** Email */
|
||||
$wp_customize->add_setting(
|
||||
'header_email',
|
||||
array(
|
||||
'default' => $default_options['header_email'],
|
||||
'sanitize_callback' => 'sanitize_email',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'header_email', array(
|
||||
'selector' => '.header-t .email a.email-link',
|
||||
'render_callback' => 'rara_business_header_email_selective_refresh',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
'header_email',
|
||||
array(
|
||||
'label' => __( 'Email', 'rara-business' ),
|
||||
'description' => __( 'Add email in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'text',
|
||||
'active_callback' => 'rara_business_header_top_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
/** Enable Social Links */
|
||||
$wp_customize->add_setting(
|
||||
'ed_header_social_links',
|
||||
array(
|
||||
'default' => $default_options['ed_header_social_links'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_header_social_links',
|
||||
array(
|
||||
'section' => 'header_section',
|
||||
'label' => __( 'Enable Social Links', 'rara-business' ),
|
||||
'description' => __( 'Enable to show social links at header.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_setting(
|
||||
new Rara_Business_Repeater_Setting(
|
||||
$wp_customize,
|
||||
'header_social_links',
|
||||
array(
|
||||
'default' => $default_options['header_social_links'],
|
||||
'sanitize_callback' => array( 'Rara_Business_Repeater_Setting', 'sanitize_repeater_setting' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Control_Repeater(
|
||||
$wp_customize,
|
||||
'header_social_links',
|
||||
array(
|
||||
'section' => 'header_section',
|
||||
'label' => __( 'Social Links', 'rara-business' ),
|
||||
'fields' => array(
|
||||
'font' => array(
|
||||
'type' => 'font',
|
||||
'label' => __( 'Font Awesome Icon', 'rara-business' ),
|
||||
'description' => __( 'Example: fa-bell', 'rara-business' ),
|
||||
),
|
||||
'link' => array(
|
||||
'type' => 'url',
|
||||
'label' => __( 'Link', 'rara-business' ),
|
||||
'description' => __( 'Example: http://facebook.com', 'rara-business' ),
|
||||
)
|
||||
),
|
||||
'row_label' => array(
|
||||
'type' => 'field',
|
||||
'value' => __( 'links', 'rara-business' ),
|
||||
'field' => 'link'
|
||||
),
|
||||
'choices' => array(
|
||||
'limit' => 10
|
||||
),
|
||||
'active_callback' => 'rara_business_header_top_section_ac',
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Custom Link Icon */
|
||||
$wp_customize->add_setting(
|
||||
'custom_link_icon',
|
||||
array(
|
||||
'default' => $default_options['custom_link_icon'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'custom_link_icon',
|
||||
array(
|
||||
'type' => 'font',
|
||||
'label' => __( 'Custom Link Icon', 'rara-business' ),
|
||||
'description' => __( 'Insert Icon eg. fa fa-edit.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
)
|
||||
);
|
||||
|
||||
/** Custom Link label */
|
||||
$wp_customize->add_setting(
|
||||
'custom_link_label',
|
||||
array(
|
||||
'default' => $default_options['custom_link_label'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'custom_link_label', array(
|
||||
'selector' => '.main-header .right .btn-buy',
|
||||
'render_callback' => 'rara_business_header_custom_link_label_selective_refresh',
|
||||
) );
|
||||
|
||||
$wp_customize->add_control(
|
||||
'custom_link_label',
|
||||
array(
|
||||
'label' => __( 'Custom Link Label', 'rara-business' ),
|
||||
'description' => __( 'Add cutom link button label in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'text',
|
||||
)
|
||||
);
|
||||
|
||||
/** Custom Link */
|
||||
$wp_customize->add_setting(
|
||||
'custom_link',
|
||||
array(
|
||||
'default' => $default_options['custom_link'],
|
||||
'sanitize_callback' => 'esc_url_raw',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'custom_link',
|
||||
array(
|
||||
'label' => __( 'Custom link', 'rara-business' ),
|
||||
'description' => __( 'Add custom link in header.', 'rara-business' ),
|
||||
'section' => 'header_section',
|
||||
'type' => 'url',
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_header_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_top_section_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_header_top_section_ac( $control ){
|
||||
$ed_header_top = $control->manager->get_setting( 'ed_header_contact_details' )->value();
|
||||
$social_media_control = $control->manager->get_setting( 'ed_header_social_links' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
// Phone number, Address, Email and Custom Link controls
|
||||
if ( $control_id == 'header_phone' && $ed_header_top ) return true;
|
||||
if ( $control_id == 'header_address' && $ed_header_top ) return true;
|
||||
if ( $control_id == 'header_email' && $ed_header_top ) return true;
|
||||
if ( $control_id == 'header_social_links' && $social_media_control ) return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
/**
|
||||
* Misc Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_misc_section' ) ) :
|
||||
/**
|
||||
* Add social media section controls
|
||||
*/
|
||||
function rara_business_customize_register_misc_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Misc Settings */
|
||||
$wp_customize->add_section(
|
||||
'misc_settings',
|
||||
array(
|
||||
'title' => __( 'Misc Settings', 'rara-business' ),
|
||||
'priority' => 50,
|
||||
'panel' => 'general_settings_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Show Animation */
|
||||
$wp_customize->add_setting(
|
||||
'ed_animation',
|
||||
array(
|
||||
'default' => $default_options['ed_animation'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_animation',
|
||||
array(
|
||||
'section' => 'misc_settings',
|
||||
'label' => __( 'Enable Animation', 'rara-business' ),
|
||||
'description' => __( 'Enable/Disable Animation on the theme', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Misc Settings Ends */
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_misc_section' );
|
||||
@@ -0,0 +1,384 @@
|
||||
<?php
|
||||
/**
|
||||
* Post and Page Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_post_page_section' ) ) :
|
||||
/**
|
||||
* Add social media section controls
|
||||
*/
|
||||
function rara_business_customize_register_post_page_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Posts(Blog) & Pages Settings */
|
||||
$wp_customize->add_section(
|
||||
'post_page_settings',
|
||||
array(
|
||||
'title' => __( 'Posts(Blog) & Pages Settings', 'rara-business' ),
|
||||
'priority' => 40,
|
||||
'panel' => 'general_settings_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Page Sidebar layout */
|
||||
$wp_customize->add_setting(
|
||||
'page_sidebar_layout',
|
||||
array(
|
||||
'default' => $default_options['page_sidebar_layout'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_radio'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Radio_Image_Control(
|
||||
$wp_customize,
|
||||
'page_sidebar_layout',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Page Sidebar Layout', 'rara-business' ),
|
||||
'description' => __( 'This is the general sidebar layout for pages. You can override the sidebar layout for individual page in repective page.', 'rara-business' ),
|
||||
'choices' => array(
|
||||
'no-sidebar' => get_template_directory_uri() . '/images/no-sidebar.png',
|
||||
'left-sidebar' => get_template_directory_uri() . '/images/left-sidebar.png',
|
||||
'right-sidebar' => get_template_directory_uri() . '/images/right-sidebar.png',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Post Sidebar layout */
|
||||
$wp_customize->add_setting(
|
||||
'post_sidebar_layout',
|
||||
array(
|
||||
'default' => $default_options['post_sidebar_layout'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_radio'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Radio_Image_Control(
|
||||
$wp_customize,
|
||||
'post_sidebar_layout',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Post Sidebar Layout', 'rara-business' ),
|
||||
'description' => __( 'This is the general sidebar layout for posts. You can override the sidebar layout for individual post in repective post.', 'rara-business' ),
|
||||
'choices' => array(
|
||||
'no-sidebar' => get_template_directory_uri() . '/images/no-sidebar.png',
|
||||
'left-sidebar' => get_template_directory_uri() . '/images/left-sidebar.png',
|
||||
'right-sidebar' => get_template_directory_uri() . '/images/right-sidebar.png',
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Blog Excerpt */
|
||||
$wp_customize->add_setting(
|
||||
'ed_excerpt',
|
||||
array(
|
||||
'default' => $default_options['ed_excerpt'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_excerpt',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Enable Blog Excerpt', 'rara-business' ),
|
||||
'description' => __( 'Enable to show excerpt or disable to show full post content.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Excerpt Length */
|
||||
$wp_customize->add_setting(
|
||||
'excerpt_length',
|
||||
array(
|
||||
'default' => $default_options['excerpt_length'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_number_absint'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Slider_Control(
|
||||
$wp_customize,
|
||||
'excerpt_length',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Excerpt Length', 'rara-business' ),
|
||||
'description' => __( 'Automatically generated excerpt length (in words).', 'rara-business' ),
|
||||
'choices' => array(
|
||||
'min' => 10,
|
||||
'max' => 100,
|
||||
'step' => 5,
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Read More Text */
|
||||
$wp_customize->add_setting(
|
||||
'read_more_text',
|
||||
array(
|
||||
'default' => $default_options['read_more_text'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'read_more_text',
|
||||
array(
|
||||
'type' => 'text',
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Read More Text', 'rara-business' ),
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'read_more_text', array(
|
||||
'selector' => '.entry-footer a.btn-readmore',
|
||||
'render_callback' => 'rara_business_readmore_label_selective_refresh',
|
||||
) );
|
||||
|
||||
/** Hide Posted Date */
|
||||
$wp_customize->add_setting(
|
||||
'ed_post_date_meta',
|
||||
array(
|
||||
'default' => $default_options['ed_post_date_meta'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_post_date_meta',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Hide Posted Date Meta', 'rara-business' ),
|
||||
'description' => __( 'Enable to hide posted date.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Hide Posted Date */
|
||||
$wp_customize->add_setting(
|
||||
'ed_post_author_meta',
|
||||
array(
|
||||
'default' => $default_options['ed_post_author_meta'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_post_author_meta',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Hide Author Meta', 'rara-business' ),
|
||||
'description' => __( 'Enable to hide author meta.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Prefix Archive Page */
|
||||
$wp_customize->add_setting(
|
||||
'ed_prefix_archive',
|
||||
array(
|
||||
'default' => $default_options['ed_prefix_archive'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_prefix_archive',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Hide Prefix in Archive Page', 'rara-business' ),
|
||||
'description' => __( 'Enable to hide prefix in archive page.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Note */
|
||||
$wp_customize->add_setting(
|
||||
'post_note_text',
|
||||
array(
|
||||
'default' => $default_options['post_note_text'],
|
||||
'sanitize_callback' => 'wp_kses_post'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Note_Control(
|
||||
$wp_customize,
|
||||
'post_note_text',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'description' => __( '<hr/>These options affect your individual posts.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Hide Author */
|
||||
$wp_customize->add_setting(
|
||||
'ed_author',
|
||||
array(
|
||||
'default' => $default_options['ed_author'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_author',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Hide Author', 'rara-business' ),
|
||||
'description' => __( 'Enable to hide author section.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Show Related Posts */
|
||||
$wp_customize->add_setting(
|
||||
'ed_related',
|
||||
array(
|
||||
'default' => $default_options['ed_related'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_related',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Show Related Posts', 'rara-business' ),
|
||||
'description' => __( 'Enable to show related posts in single page.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Related Posts section title */
|
||||
$wp_customize->add_setting(
|
||||
'related_post_title',
|
||||
array(
|
||||
'default' => $default_options['related_post_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'related_post_title',
|
||||
array(
|
||||
'type' => 'text',
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Related Posts Section Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_page_post_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'related_post_title', array(
|
||||
'selector' => '.related-post h2.section-title',
|
||||
'render_callback' => 'rara_business_related_post_section_title_selective_refresh',
|
||||
) );
|
||||
|
||||
|
||||
/** Show Popular Posts */
|
||||
$wp_customize->add_setting(
|
||||
'ed_popular_posts',
|
||||
array(
|
||||
'default' => $default_options['ed_popular_posts'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_popular_posts',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Show Popular Posts', 'rara-business' ),
|
||||
'description' => __( 'Enable to show popular posts in single page.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Popular Posts section title */
|
||||
$wp_customize->add_setting(
|
||||
'popular_post_title',
|
||||
array(
|
||||
'default' => $default_options['popular_post_title'],
|
||||
'sanitize_callback' => 'sanitize_text_field',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'popular_post_title',
|
||||
array(
|
||||
'type' => 'text',
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Popular Posts Section Title', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_page_post_section_ac'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'popular_post_title', array(
|
||||
'selector' => '.popular-post h2.section-title',
|
||||
'render_callback' => 'rara_business_popular_post_section_title_selective_refresh',
|
||||
) );
|
||||
|
||||
/** Show Featured Image */
|
||||
$wp_customize->add_setting(
|
||||
'ed_featured_image',
|
||||
array(
|
||||
'default' => $default_options['ed_featured_image'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_featured_image',
|
||||
array(
|
||||
'section' => 'post_page_settings',
|
||||
'label' => __( 'Show Featured Image', 'rara-business' ),
|
||||
'description' => __( 'Enable to show featured image in post detail (single page).', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Posts(Blog) & Pages Settings Ends */
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_post_page_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_page_post_section_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_page_post_section_ac( $control ) {
|
||||
$ed_related_post = $control->manager->get_setting( 'ed_related' )->value();
|
||||
$ed_popular_post = $control->manager->get_setting( 'ed_popular_posts' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
if ( $control_id == 'related_post_title' && $ed_related_post ) return true;
|
||||
if ( $control_id == 'popular_post_title' && $ed_popular_post ) return true;
|
||||
}
|
||||
endif;
|
||||
@@ -0,0 +1,102 @@
|
||||
<?php
|
||||
/**
|
||||
* SEO Section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register_seo_section' ) ) :
|
||||
/**
|
||||
* Add seo section controls
|
||||
*/
|
||||
function rara_business_customize_register_seo_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** SEO Settings */
|
||||
$wp_customize->add_section(
|
||||
'seo_settings',
|
||||
array(
|
||||
'title' => __( 'SEO Settings', 'rara-business' ),
|
||||
'priority' => 30,
|
||||
'panel' => 'general_settings_panel',
|
||||
)
|
||||
);
|
||||
|
||||
/** Enable updated date */
|
||||
$wp_customize->add_setting(
|
||||
'ed_post_update_date',
|
||||
array(
|
||||
'default' => $default_options['ed_post_update_date'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_post_update_date',
|
||||
array(
|
||||
'section' => 'seo_settings',
|
||||
'label' => __( 'Enable Last Update Post Date', 'rara-business' ),
|
||||
'description' => __( 'Enable to show last updated post date on listing as well as in single post.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Enable Breadcrumb */
|
||||
$wp_customize->add_setting(
|
||||
'ed_breadcrumb',
|
||||
array(
|
||||
'default' => $default_options['ed_breadcrumb'],
|
||||
'sanitize_callback' => 'rara_business_sanitize_checkbox'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Toggle_Control(
|
||||
$wp_customize,
|
||||
'ed_breadcrumb',
|
||||
array(
|
||||
'section' => 'seo_settings',
|
||||
'label' => __( 'Enable Breadcrumb', 'rara-business' ),
|
||||
'description' => __( 'Enable to show breadcrumb in inner pages.', 'rara-business' ),
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
/** Breadcrumb Home Text */
|
||||
$wp_customize->add_setting(
|
||||
'home_text',
|
||||
array(
|
||||
'default' => $default_options['home_text'],
|
||||
'sanitize_callback' => 'sanitize_text_field'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'home_text',
|
||||
array(
|
||||
'type' => 'text',
|
||||
'section' => 'seo_settings',
|
||||
'label' => __( 'Breadcrumb Home Text', 'rara-business' ),
|
||||
'active_callback' => 'rara_business_breadcrumb_ac',
|
||||
)
|
||||
);
|
||||
|
||||
/** SEO Settings Ends */
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_seo_section' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_breadcrumb_ac' ) ) :
|
||||
/**
|
||||
* Active Callback
|
||||
*/
|
||||
function rara_business_breadcrumb_ac( $control ) {
|
||||
$breadcrumb_control = $control->manager->get_setting( 'ed_breadcrumb' )->value();
|
||||
$control_id = $control->id;
|
||||
|
||||
if ( $control_id == 'home_text' && $breadcrumb_control ) return true;
|
||||
}
|
||||
endif;
|
||||
Reference in New Issue
Block a user