Initial commit: Atomaste website
This commit is contained in:
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Theme Customizer
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_register' ) ) :
|
||||
/**
|
||||
* Add postMessage support for site title and description for the Theme Customizer.
|
||||
*
|
||||
* @param WP_Customize_Manager $wp_customize Theme Customizer object.
|
||||
*/
|
||||
function rara_business_customize_register( $wp_customize ) {
|
||||
$wp_customize->get_section( 'background_image' )->priority = 40;
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register' );
|
||||
|
||||
$rara_business_panels = array( 'frontpage', 'general', 'appearance' );
|
||||
$rara_business_sections = array( 'info', 'demo-content', 'site-identity', 'footer' );
|
||||
|
||||
$rara_business_sub_sections = array(
|
||||
'frontpage' => array( 'banner', 'portfolio', 'blog' ),
|
||||
'general' => array( 'header', 'seo', 'post-page','misc' ),
|
||||
);
|
||||
|
||||
foreach( $rara_business_panels as $p ){
|
||||
require get_template_directory() . '/inc/customizer/panels/' . $p . '.php';
|
||||
}
|
||||
|
||||
foreach( $rara_business_sections as $section ){
|
||||
require get_template_directory() . '/inc/customizer/sections/' . $section . '.php';
|
||||
}
|
||||
|
||||
foreach( $rara_business_sub_sections as $k => $v ){
|
||||
foreach( $v as $w ){
|
||||
require get_template_directory() . '/inc/customizer/panels/' . $k . '/' . $w . '.php';
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_preview_js' ) ) :
|
||||
/**
|
||||
* Binds JS handlers to make Theme Customizer preview reload changes asynchronously.
|
||||
*/
|
||||
function rara_business_customize_preview_js() {
|
||||
wp_enqueue_script( 'rara-business-customizer', get_template_directory_uri() . '/js/build/customizer.js', array( 'customize-preview' ), '20151215', true );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_preview_init', 'rara_business_customize_preview_js' );
|
||||
|
||||
if ( ! function_exists( 'rara_business_customizer_script' ) ) :
|
||||
/**
|
||||
* Customizer Scripts
|
||||
*/
|
||||
function rara_business_customizer_script(){
|
||||
$array = array(
|
||||
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
||||
'flushit' => __( 'Successfully Flushed!','rara-business' ),
|
||||
'nonce' => wp_create_nonce('ajax-nonce')
|
||||
);
|
||||
wp_enqueue_style( 'rara-business-customize-controls', get_template_directory_uri() . '/inc/css/customize-controls.css', array(), false , 'screen' );
|
||||
wp_enqueue_script( 'rara-business-customize-controls', get_template_directory_uri() . '/inc/js/customize-controls.js', array( 'jquery', 'customize-controls' ), false, true );
|
||||
wp_localize_script( 'rara-business-customize-controls', 'rara_business_cdata', $array );
|
||||
|
||||
wp_localize_script( 'rara-business-repeater', 'rara_business_customize',
|
||||
array(
|
||||
'nonce' => wp_create_nonce( 'rara_business_customize_nonce' )
|
||||
)
|
||||
);
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_controls_enqueue_scripts', 'rara_business_customizer_script' );
|
||||
|
||||
/*
|
||||
* Notifications in customizer
|
||||
*/
|
||||
require get_template_directory() . '/inc/customizer-plugin-recommend/customizer-notice/class-customizer-notice.php';
|
||||
|
||||
require get_template_directory() . '/inc/customizer-plugin-recommend/plugin-install/class-plugin-install-helper.php';
|
||||
|
||||
$config_customizer = array(
|
||||
'recommended_plugins' => array(
|
||||
'raratheme-companion' => array(
|
||||
'recommended' => true,
|
||||
'description' => sprintf(
|
||||
/* translators: %s: plugin name */
|
||||
esc_html__( 'If you want to take full advantage of the features this theme has to offer, please install and activate %s plugin.', 'rara-business' ), '<strong>RaraTheme Companion</strong>'
|
||||
),
|
||||
),
|
||||
),
|
||||
'recommended_plugins_title' => esc_html__( 'Recommended Plugin', 'rara-business' ),
|
||||
'install_button_label' => esc_html__( 'Install and Activate', 'rara-business' ),
|
||||
'activate_button_label' => esc_html__( 'Activate', 'rara-business' ),
|
||||
'deactivate_button_label' => esc_html__( 'Deactivate', 'rara-business' ),
|
||||
);
|
||||
Rara_Business_Customizer_Notice::init( apply_filters( 'rara_business_customizer_notice_array', $config_customizer ) );
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Theme Customizer Default Value.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
function rara_business_default_theme_options() {
|
||||
$default_options = array(
|
||||
|
||||
// Header section
|
||||
'ed_header_contact_details' => true,
|
||||
'header_phone' => '',
|
||||
'header_address' => '',
|
||||
'header_email' => '',
|
||||
'custom_link_icon' => 'fa fa-edit',
|
||||
'custom_link_label' => '',
|
||||
'custom_link' => '',
|
||||
|
||||
// Social media section
|
||||
'ed_header_social_links' => true,
|
||||
'header_social_links' => array(),
|
||||
|
||||
// Seo section
|
||||
'ed_post_update_date' => true,
|
||||
'ed_breadcrumb' => true,
|
||||
'home_text' => __( 'Home', 'rara-business' ),
|
||||
|
||||
// Post/Page section
|
||||
'page_sidebar_layout' => 'right-sidebar',
|
||||
'post_sidebar_layout' => 'right-sidebar',
|
||||
'ed_excerpt' => true,
|
||||
'excerpt_length' => '55',
|
||||
'read_more_text' => __( 'Read More', 'rara-business' ),
|
||||
'post_note_text' => '',
|
||||
'ed_author' => false,
|
||||
'ed_related' => true,
|
||||
'related_post_title' => __( 'You may also like...', 'rara-business' ),
|
||||
'ed_popular_posts' => true,
|
||||
'popular_post_title' => __( 'Popular Posts', 'rara-business' ),
|
||||
'ed_post_date_meta' => false,
|
||||
'ed_post_author_meta' => false,
|
||||
'ed_featured_image' => true,
|
||||
'ed_animation' => true,
|
||||
'ed_prefix_archive' => false,
|
||||
|
||||
// Banner section
|
||||
'ed_banner_section' => 'static_banner',
|
||||
'banner_title' => __( 'Perfectionist at Every Level', 'rara-business' ),
|
||||
'banner_description' => __( 'Believing in the possibility of attaining perfection.', 'rara-business' ),
|
||||
'banner_link_one_label' => __( 'Free Inquiry', 'rara-business' ),
|
||||
'banner_link_one_url' => '#',
|
||||
'banner_link_two_label' => __( 'View Services', 'rara-business' ),
|
||||
'banner_link_two_url' => '#',
|
||||
|
||||
// Portfolio section
|
||||
'ed_portfolio_section' => true,
|
||||
'portfolio_title' => __( 'Our Case Studies', 'rara-business' ),
|
||||
'portfolio_description' => __( 'It looks perfect on all major browsers, tablets and phones. The kind of product you are looking for.', 'rara-business' ),
|
||||
'portfolio_no_of_posts' => '10',
|
||||
|
||||
// Blog section
|
||||
'ed_blog_section' => true,
|
||||
'blog_title' => __( 'Our Blog', 'rara-business' ),
|
||||
'blog_description' => __( 'It looks perfect on all major browsers, tablets and phones. The kind of product you are looking for.', 'rara-business' ),
|
||||
);
|
||||
|
||||
$output = apply_filters( 'rara_business_default_theme_options', $default_options );
|
||||
|
||||
return $output;
|
||||
}
|
||||
@@ -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;
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Theme Sanitization Functions
|
||||
*
|
||||
* @link https://github.com/WPTRT/code-examples/blob/master/customizer/sanitization-callbacks.php
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
|
||||
function rara_business_sanitize_checkbox( $checked ){
|
||||
// Boolean check.
|
||||
return ( ( isset( $checked ) && true == $checked ) ? true : false );
|
||||
}
|
||||
|
||||
function rara_business_sanitize_select( $value ){
|
||||
|
||||
if ( is_array( $value ) ) {
|
||||
foreach ( $value as $key => $subvalue ) {
|
||||
$value[ $key ] = sanitize_text_field( $subvalue );
|
||||
}
|
||||
return $value;
|
||||
}
|
||||
return sanitize_text_field( $value );
|
||||
|
||||
}
|
||||
|
||||
function rara_business_sanitize_radio( $input, $setting ) {
|
||||
// Ensure input is a slug.
|
||||
$input = sanitize_key( $input );
|
||||
// Get list of choices from the control associated with the setting.
|
||||
$choices = $setting->manager->get_control( $setting->id )->choices;
|
||||
// If the input is a valid key, return it; otherwise, return the default.
|
||||
return ( array_key_exists( $input, $choices ) ? $input : $setting->default );
|
||||
}
|
||||
|
||||
function rara_business_sanitize_number_absint( $number, $setting ) {
|
||||
// Ensure $number is an absolute integer (whole number, zero or greater).
|
||||
$number = absint( $number );
|
||||
|
||||
// If the input is an absolute integer, return it; otherwise, return the default
|
||||
return ( $number ? $number : $setting->default );
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Demo Content
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customizer_demo_content' ) ) :
|
||||
/**
|
||||
* Add demo content info
|
||||
*/
|
||||
function rara_business_customizer_demo_content( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section( 'demo_content_section' , array(
|
||||
'title' => __( 'Demo Content Import' , 'rara-business' ),
|
||||
'priority' => 7,
|
||||
));
|
||||
|
||||
$wp_customize->add_setting(
|
||||
'demo_content_instruction',
|
||||
array(
|
||||
'sanitize_callback' => 'wp_kses_post'
|
||||
)
|
||||
);
|
||||
|
||||
/* translators: 1: string, 2: url, 3: string */
|
||||
$demo_content_description = sprintf( '%1$s<a class="documentation" href="%2$s" target="_blank">%3$s</a>', esc_html__( 'Rara Business comes with demo content import feature. You can import the demo content with just one click. For step-by-step video tutorial, ', 'rara-business' ), esc_url( 'https://rarathemes.com/blog/import-demo-content-rara-themes/' ), esc_html__( 'Click here', 'rara-business' ) );
|
||||
|
||||
|
||||
$wp_customize->add_control(
|
||||
new Rara_Business_Note_Control(
|
||||
$wp_customize,
|
||||
'demo_content_instruction',
|
||||
array(
|
||||
'section' => 'demo_content_section',
|
||||
'description' => $demo_content_description
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
$theme_demo_content_desc = '';
|
||||
|
||||
if( ! class_exists( 'RDDI_init' ) ) {
|
||||
$theme_demo_content_desc .= '<span class="sticky_info_row"><label class="row-element">' . __( 'Plugin required', 'rara-business' ) . ': </label><a href="' . esc_url( 'https://wordpress.org/plugins/rara-one-click-demo-import/' ) . '" target="_blank">' . __( 'Rara One Click Demo Import', 'rara-business' ) . '</a></span><br />';
|
||||
}
|
||||
|
||||
$theme_demo_content_desc .= '<span class="sticky_info_row download-link"><label class="row-element">' . __( 'Download Demo Content', 'rara-business' ) . ': </label><a href="' . esc_url( 'https://docs.rarathemes.com/docs/rara-business/theme-installation-activation/how-to-import-demo-content/' ) . '" target="_blank">' . __( 'Click here', 'rara-business' ) . '</a></span><br />';
|
||||
|
||||
$wp_customize->add_setting( 'theme_demo_content_info',array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
));
|
||||
|
||||
// Demo content
|
||||
$wp_customize->add_control( new Rara_Business_Note_Control( $wp_customize ,'theme_demo_content_info',array(
|
||||
'section' => 'demo_content_section',
|
||||
'description' => $theme_demo_content_desc
|
||||
)));
|
||||
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customizer_demo_content' );
|
||||
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
/**
|
||||
* Footer Setting
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
function rara_business_customize_register_footer( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section(
|
||||
'rara_business_footer_settings',
|
||||
array(
|
||||
'title' => __( 'Footer Settings', 'rara-business' ),
|
||||
'priority' => 199,
|
||||
'capability' => 'edit_theme_options',
|
||||
)
|
||||
);
|
||||
|
||||
/** Footer Copyright */
|
||||
$wp_customize->add_setting(
|
||||
'footer_copyright',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
'transport' => 'postMessage'
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->add_control(
|
||||
'footer_copyright',
|
||||
array(
|
||||
'label' => __( 'Footer Copyright Text', 'rara-business' ),
|
||||
'section' => 'rara_business_footer_settings',
|
||||
'type' => 'textarea',
|
||||
)
|
||||
);
|
||||
|
||||
$wp_customize->selective_refresh->add_partial( 'footer_copyright', array(
|
||||
'selector' => '.site-footer .footer-b span.copyright',
|
||||
'render_callback' => 'rara_business_get_footer_copyright',
|
||||
) );
|
||||
|
||||
}
|
||||
add_action( 'customize_register', 'rara_business_customize_register_footer' );
|
||||
@@ -0,0 +1,141 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Theme Info
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customizer_theme_info' ) ) :
|
||||
/**
|
||||
* Add theme info
|
||||
*/
|
||||
function rara_business_customizer_theme_info( $wp_customize ) {
|
||||
|
||||
$wp_customize->add_section( 'theme_info_section', array(
|
||||
'title' => __( 'Demo & Documentation' , 'rara-business' ),
|
||||
'priority' => 6,
|
||||
) );
|
||||
|
||||
/** Important Links */
|
||||
$wp_customize->add_setting( 'theme_info_setting',
|
||||
array(
|
||||
'default' => '',
|
||||
'sanitize_callback' => 'wp_kses_post',
|
||||
)
|
||||
);
|
||||
|
||||
$theme_info = '<p>';
|
||||
|
||||
/* translators: 1: string, 2: preview url, 3: string */
|
||||
$theme_info .= sprintf( '%1$s<a href="%2$s" target="_blank">%3$s</a>', esc_html__( 'Demo Link : ', 'rara-business' ), esc_url( 'https://rarathemesdemo.com/' . RARA_BUSINESS_THEME_TEXTDOMAIN . '/'), esc_html__( 'Click here.', 'rara-business' ) );
|
||||
|
||||
$theme_info .= '</p><p>';
|
||||
|
||||
/* translators: 1: string, 2: documentation url, 3: string */
|
||||
$theme_info .= sprintf( '%1$s<a href="%2$s" target="_blank">%3$s</a>', esc_html__( 'Documentation Link : ', 'rara-business' ), esc_url( 'https://docs.rarathemes.com/docs/rara-business/' ), esc_html__( 'Click here.', 'rara-business' ) );
|
||||
|
||||
$theme_info .= '</p>';
|
||||
|
||||
$wp_customize->add_control( new Rara_Business_Note_Control( $wp_customize,
|
||||
'theme_info_setting',
|
||||
array(
|
||||
'section' => 'theme_info_section',
|
||||
'description' => $theme_info
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customizer_theme_info' );
|
||||
|
||||
if( class_exists( 'WP_Customize_Section' ) ) :
|
||||
/**
|
||||
* Adding Go to Pro Section in Customizer
|
||||
* https://github.com/justintadlock/trt-customizer-pro
|
||||
*/
|
||||
class Rara_Business_Customize_Section_Pro extends WP_Customize_Section {
|
||||
|
||||
/**
|
||||
* The type of customize section being rendered.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'pro-section';
|
||||
|
||||
/**
|
||||
* Custom button text to output.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $pro_text = '';
|
||||
|
||||
/**
|
||||
* Custom pro button URL.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @var string
|
||||
*/
|
||||
public $pro_url = '';
|
||||
|
||||
/**
|
||||
* Add custom parameters to pass to the JS via JSON.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
public function json() {
|
||||
$json = parent::json();
|
||||
|
||||
$json['pro_text'] = $this->pro_text;
|
||||
$json['pro_url'] = esc_url( $this->pro_url );
|
||||
|
||||
return $json;
|
||||
}
|
||||
|
||||
/**
|
||||
* Outputs the Underscore.js template.
|
||||
*
|
||||
* @since 1.0.0
|
||||
* @access public
|
||||
* @return void
|
||||
*/
|
||||
protected function render_template() { ?>
|
||||
<li id="accordion-section-{{ data.id }}" class="accordion-section control-section control-section-{{ data.type }} cannot-expand">
|
||||
<h3 class="accordion-section-title">
|
||||
{{ data.title }}
|
||||
<# if ( data.pro_text && data.pro_url ) { #>
|
||||
<a href="{{ data.pro_url }}" class="button button-secondary alignright" target="_blank">{{ data.pro_text }}</a>
|
||||
<# } #>
|
||||
</h3>
|
||||
</li>
|
||||
<?php }
|
||||
}
|
||||
endif;
|
||||
|
||||
add_action( 'customize_register', 'rara_business_page_sections_pro' );
|
||||
|
||||
function rara_business_page_sections_pro( $manager ) {
|
||||
// Register custom section types.
|
||||
$manager->register_section_type( 'Rara_Business_Customize_Section_Pro' );
|
||||
|
||||
// Register sections.
|
||||
$manager->add_section(
|
||||
new Rara_Business_Customize_Section_Pro(
|
||||
$manager,
|
||||
'rara_business_view_pro',
|
||||
array(
|
||||
'title' => esc_html__( 'Pro Available', 'rara-business' ),
|
||||
'priority' => 5,
|
||||
'pro_text' => esc_html__( 'VIEW PRO THEME', 'rara-business' ),
|
||||
'pro_url' => 'https://rarathemes.com/wordpress-themes/rara-business-pro/'
|
||||
)
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
/**
|
||||
* Site Identitiy Customizer section
|
||||
*
|
||||
* @package Rara_Business
|
||||
*/
|
||||
if ( ! function_exists( 'rara_business_customize_register_site_identity_section' ) ) :
|
||||
/**
|
||||
* Add custom site identity controls
|
||||
*/
|
||||
function rara_business_customize_register_site_identity_section( $wp_customize ) {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
|
||||
/** Add postMessage support for site title and description */
|
||||
$wp_customize->get_setting( 'blogname' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';
|
||||
$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';
|
||||
|
||||
// Selective refresh for blogname
|
||||
$wp_customize->selective_refresh->add_partial( 'blogname', array(
|
||||
'selector' => '.site-title a',
|
||||
'render_callback' => 'rara_business_customize_partial_blogname',
|
||||
) );
|
||||
|
||||
// Selective refresh for blogdescription
|
||||
$wp_customize->selective_refresh->add_partial( 'blogdescription', array(
|
||||
'selector' => '.site-description',
|
||||
'render_callback' => 'rara_business_customize_partial_blogdescription',
|
||||
) );
|
||||
}
|
||||
endif;
|
||||
add_action( 'customize_register', 'rara_business_customize_register_site_identity_section' );
|
||||
@@ -0,0 +1,329 @@
|
||||
<?php
|
||||
/**
|
||||
* Rara Business Customizer selective refresh functions.
|
||||
*
|
||||
* @package Rara_Business
|
||||
*
|
||||
*/
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_partial_blogname' ) ) :
|
||||
/**
|
||||
* Render the site title for the selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_customize_partial_blogname() {
|
||||
$blog_name = get_bloginfo( 'name' );
|
||||
|
||||
if ( $blog_name ){
|
||||
return esc_html( $blog_name );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_customize_partial_blogdescription' ) ) :
|
||||
/**
|
||||
* Render the site description for the selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_customize_partial_blogdescription() {
|
||||
$blog_description = get_bloginfo( 'description' );
|
||||
|
||||
if ( $blog_description ){
|
||||
return esc_html( $blog_description );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render banner title selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_banner_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$banner_title = get_theme_mod( 'banner_title', $default_options['banner_title'] );
|
||||
|
||||
if ( $banner_title ){
|
||||
return esc_html( $banner_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_description_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render banner description selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_banner_description_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$banner_description = get_theme_mod( 'banner_description', $default_options['banner_description'] );
|
||||
|
||||
if ( $banner_description ){
|
||||
return esc_html( $banner_description );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_link_one_label_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render banner link one label selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_banner_link_one_label_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$banner_link_one_label = get_theme_mod( 'banner_link_one_label', $default_options['banner_link_one_label'] );
|
||||
|
||||
if ( $banner_link_one_label ){
|
||||
return esc_html( $banner_link_one_label );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_banner_link_two_label_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render banner link two label selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_banner_link_two_label_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$banner_link_two_label = get_theme_mod( 'banner_link_two_label', $default_options['banner_link_two_label'] );
|
||||
|
||||
if ( $banner_link_two_label ){
|
||||
return esc_html( $banner_link_two_label );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_portfolio_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render portfolio title selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_portfolio_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$portfolio_title = get_theme_mod( 'portfolio_title', $default_options['portfolio_title'] );
|
||||
|
||||
if ( $portfolio_title ){
|
||||
return esc_html( $portfolio_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_portfolio_description_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render portfolio description selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_portfolio_description_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$portfolio_description = get_theme_mod( 'portfolio_description', $default_options['portfolio_description'] );
|
||||
|
||||
if ( $portfolio_description ){
|
||||
return esc_html( $portfolio_description );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_blog_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render blog title selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_blog_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$blog_title = get_theme_mod( 'blog_title', $default_options['blog_title'] );
|
||||
|
||||
if ( $blog_title ){
|
||||
return esc_html( $blog_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_blog_description_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render blog description selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_blog_description_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$blog_description = get_theme_mod( 'blog_description', $default_options['blog_description'] );
|
||||
|
||||
if ( $blog_description ){
|
||||
return esc_html( $blog_description );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_phone_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render header phone number selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_header_phone_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$phone_number = get_theme_mod( 'header_phone', $default_options['header_phone'] );
|
||||
|
||||
if ( $phone_number ){
|
||||
return esc_html( $phone_number );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_address_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render header address number selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_header_address_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$address = get_theme_mod( 'header_address', $default_options['header_address'] );
|
||||
|
||||
if ( $address ){
|
||||
return esc_html( $address );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_email_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render header email number selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_header_email_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$email = get_theme_mod( 'header_email', $default_options['header_email'] );
|
||||
|
||||
if ( $email ){
|
||||
return esc_html( $email );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_header_custom_link_label_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render custom link label selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_header_custom_link_label_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$custom_link_label = get_theme_mod( 'custom_link_label', $default_options['custom_link_label'] );
|
||||
|
||||
if ( $custom_link_label ){
|
||||
return esc_html( $custom_link_label );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_readmore_label_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render readmore label selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_readmore_label_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$readmore_label = get_theme_mod( 'read_more_text', $default_options['read_more_text'] );
|
||||
|
||||
if ( $readmore_label ){
|
||||
return esc_html( $readmore_label );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_related_post_section_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render related post section title for selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_related_post_section_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$related_post_title = get_theme_mod( 'related_post_title', $default_options['related_post_title'] );
|
||||
|
||||
if ( $related_post_title ){
|
||||
return esc_html( $related_post_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
if ( ! function_exists( 'rara_business_popular_post_section_title_selective_refresh' ) ) :
|
||||
/**
|
||||
* Render popular post section title for selective refresh partial.
|
||||
*
|
||||
*/
|
||||
function rara_business_popular_post_section_title_selective_refresh() {
|
||||
/** Load default theme options */
|
||||
$default_options = rara_business_default_theme_options();
|
||||
$popular_post_title = get_theme_mod( 'popular_post_title', $default_options['popular_post_title'] );
|
||||
|
||||
if ( $popular_post_title ){
|
||||
return esc_html( $popular_post_title );
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
endif;
|
||||
|
||||
|
||||
if( ! function_exists( 'rara_business_get_footer_copyright' ) ) :
|
||||
/**
|
||||
* Footer Copyright
|
||||
*/
|
||||
function rara_business_get_footer_copyright(){
|
||||
$copyright = get_theme_mod( 'footer_copyright' );
|
||||
echo '<span class="copyright">';
|
||||
if( $copyright ){
|
||||
echo wp_kses_post( $copyright );
|
||||
}else{
|
||||
esc_html_e( 'Copyright © ', 'rara-business' );
|
||||
echo date_i18n( esc_html__( 'Y', 'rara-business' ) );
|
||||
echo ' <a href="' . esc_url( home_url( '/' ) ) . '">' . esc_html( get_bloginfo( 'name' ) ) . '</a>. ';
|
||||
}
|
||||
echo '</span>';
|
||||
}
|
||||
endif;
|
||||
Reference in New Issue
Block a user