';
$wrap .= '
';
$wrap .= '%3$s';
$wrap .= '';
return $wrap;
}
/*
* add customizer settings
*/
add_action( 'customize_register', 'business_space_customize_register' );
function business_space_customize_register( $wp_customize ) {
//slider button link
$wp_customize->add_setting( 'slider_button_link' , array(
'default' => "",
'sanitize_callback' => 'esc_url_raw',
));
$wp_customize->add_control('slider_button_link' , array(
'label' => __('Slider Button Link','business-space' ),
'section' => 'slider_section',
'priority' => 13,
'type'=>'text',
) );
// banner image
$wp_customize->add_setting( 'banner_image' ,
array(
'default' => '',
'capability' => 'edit_theme_options',
'sanitize_callback' => 'esc_url_raw',
)
);
$wp_customize->add_control( new WP_Customize_Image_Control( $wp_customize , 'banner_image' ,
array(
'label' => __( 'Banner Image', 'business-space' ),
'description' => __('Upload banner image', 'business-space'),
'settings' => 'banner_image',
'section' => 'theme_header',
))
);
$wp_customize->add_setting('banner_link' , array(
'default' => '#',
'sanitize_callback' => 'esc_url_raw',
));
$wp_customize->add_control('banner_link' , array(
'label' => __('Banner Link', 'business-space' ),
'section' => 'theme_header',
'type'=> 'url',
) );
//breadcrumb
$wp_customize->add_section( 'breadcrumb_section' , array(
'title' => __( 'Header Breadcrumb', 'business-space' ),
'priority' => 3,
'panel' => 'theme_options',
) );
$wp_customize->add_setting( 'breadcrumb_enable' , array(
'default' => false,
'capability' => 'edit_theme_options',
'sanitize_callback' => 'agency_starter_sanitize_checkbox',
));
$wp_customize->add_control('breadcrumb_enable' , array(
'label' => __('Enable | Disable Breadcrumb','business-space' ),
'section' => 'breadcrumb_section',
'type'=> 'checkbox',
));
}
/**
* @package twentysixteen
* @subpackage business-space
* Converts a HEX value to RGB.
*/
function business_space_hex2rgb( $color ) {
$color = trim( $color, '#' );
if ( strlen( $color ) === 3 ) {
$r = hexdec( substr( $color, 0, 1 ) . substr( $color, 0, 1 ) );
$g = hexdec( substr( $color, 1, 1 ) . substr( $color, 1, 1 ) );
$b = hexdec( substr( $color, 2, 1 ) . substr( $color, 2, 1 ) );
} elseif ( strlen( $color ) === 6 ) {
$r = hexdec( substr( $color, 0, 2 ) );
$g = hexdec( substr( $color, 2, 2 ) );
$b = hexdec( substr( $color, 4, 2 ) );
} else {
return array();
}
return array(
'red' => $r,
'green' => $g,
'blue' => $b,
);
}
//load actions
require get_stylesheet_directory() .'/inc/actions.php';
//load child theme colors
require get_stylesheet_directory() .'/inc/dynamic-css.php';
//load post widgets
require get_stylesheet_directory() .'/inc/widget-search.php';
/**
* Theme Breadcrumbs
*/
if( !function_exists('business_space_page_header_breadcrumbs') ):
function business_space_page_header_breadcrumbs() {
global $post;
$homeLink = home_url();
$business_space_page_header_layout = get_theme_mod('business_space_page_header_layout', 'business_space_page_header_layout1');
if($business_space_page_header_layout == 'business_space_page_header_layout1'):
$breadcrumb_class = 'center-text';
else: $breadcrumb_class = 'text-right';
endif;
echo '';
if (is_home() || is_front_page()) :
echo '- '.esc_html__('Home','business-space').'
';
echo '- '; echo single_post_title(); echo '
';
else:
echo '- '.esc_html__('Home','business-space').'
';
if ( is_category() ) {
echo '- ' . esc_html__('Archive by category','business-space').' "' . single_cat_title('', false) . '"
';
} elseif ( is_day() ) {
echo '- '. esc_html(get_the_time('Y')) .'';
echo '
- '. esc_html(get_the_time('F')) .'';
echo '
- '. esc_html(get_the_time('d')) .'
';
} elseif ( is_month() ) {
echo '- ' . esc_html(get_the_time('Y')) . '';
echo '
- '. esc_html(get_the_time('F')) .'
';
} elseif ( is_year() ) {
echo '- '. esc_html(get_the_time('Y')) .'
';
} elseif ( is_single() && !is_attachment() && is_page('single-product') ) {
if ( get_post_type() != 'post' ) {
$cat = get_the_category();
$cat = $cat[0];
echo '- ';
echo esc_html( get_category_parents($cat, TRUE, '') );
echo '
';
echo '- '. wp_title( '',false ) .'
';
} }
elseif ( is_page() && $post->post_parent ) {
$parent_id = $post->post_parent;
$breadcrumbs = array();
while ($parent_id) {
$page = get_page($parent_id);
$breadcrumbs[] = '- ' . get_the_title($page->ID) . '';
$parent_id = $page->post_parent;
}
$breadcrumbs = array_reverse($breadcrumbs);
foreach ($breadcrumbs as $crumb) echo $crumb;
echo '
- '. get_the_title().'
';
}
elseif( is_search() )
{
echo '- '. get_search_query() .'
';
}
elseif( is_404() )
{
echo '- '.esc_html__('Error 404','business-space').'
';
}
else {
echo '- '. esc_html( get_the_title() ) .'
';
}
endif;
echo '
';
}
endif;
/**
* Theme Breadcrumbs Url
*/
function business_space_page_url() {
$page_url = 'http';
if ( key_exists("HTTPS", $_SERVER) && ( $_SERVER["HTTPS"] == "on" ) ){
$page_url .= "s";
}
$page_url .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$page_url .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$page_url .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $page_url;
}