array(
'url' => '%s/assets/images/home_page_header.jpg',
'thumbnail_url' => '%s/assets/images/home_page_header.jpg',
'description' => __('Homepage Header Image', 'business-express'),
),
'default-image' => array(
'url' => '%s/assets/images/page_header.jpg',
'thumbnail_url' => '%s/assets/images/page_header.jpg',
'description' => __('Default Header Image', 'business-express'),
),
));
add_theme_support('custom-header', apply_filters('business_express_custom_header_args', array(
'default-image' => get_template_directory_uri() . "/assets/images/page_header.jpg",
'width' => 1920,
'height' => 800,
'flex-height' => true,
'flex-width' => true,
'header-text' => false,
)));
add_theme_support('custom-logo', array('height' => 70));
register_nav_menus(array(
'primary' => __('Primary Menu', 'business-express'),
));
}
add_action('after_setup_theme', 'business_express_setup');
/**
* Add customizer controls
*/
function business_express_customize_register_action($wp_customize) {
$wp_customize->add_setting('business_express_homepage_header',
array('sanitize_callback' => 'esc_url_raw', 'default' => get_template_directory_uri() . "/assets/images/home_page_header.jpg"));
$wp_customize->add_control(new WP_Customize_Image_Control($wp_customize, 'business_express_homepage_header',
array(
'label' => __('Home page header', 'business-express'),
'section' => 'header_image',
'settings' => 'business_express_homepage_header',
'priority' => 10,
)));
$wp_customize->add_section( 'business_express_header', array(
'title' => __( 'Header Options', 'business-express' ),
'priority' => 20,
) );
$wp_customize->add_setting( 'business_express_phone', array(
'default' => '#',
'sanitize_callback' => 'esc_html',
));
$wp_customize->add_control( 'business_express_phone', array(
'label' => __('Phone', 'business-express'),
'section' => 'business_express_header',
'priority' => 1,
));
$wp_customize->add_setting( 'business_express_email', array(
'default' => '#',
'sanitize_callback' => 'esc_html',
) );
$wp_customize->add_control( 'business_express_email', array(
'label' => __('Email', 'business-express'),
'section' => 'business_express_header',
'priority' => 1,
) );
$business_express_contact = array(
'facebook' => __('Facebook url', 'business-express'),
'twitter' => __('Twitter url', 'business-express'),
'google-plus' => __('GooglePlus url', 'business-express'),
'youtube' => __('Youtube url', 'business-express'),
'skype' => __('Skype url', 'business-express'),
'behance' => __('Behance url', 'business-express')
);
foreach ($business_express_contact as $name => $label) {
$wp_customize->add_setting( 'business_express_'.$name, array(
'default' => '#',
'sanitize_callback' => 'esc_url',
) );
$wp_customize->add_control( 'business_express_'.$name, array(
'label' => $label,
'section' => 'business_express_header',
'priority' => 1,
) );
}
}
add_action('customize_register', 'business_express_customize_register_action');
/**
* Register sidebar
*/
function business_express_widgets_init() {
register_sidebar(array(
'name' => __('Sidebar widget area', 'business-express'),
'id' => 'sidebar-1',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
));
}
add_action('widgets_init', 'business_express_widgets_init');
/**
* Replaces "[...]" (appended to automatically generated excerpts) with ... and
* a 'Read more' link.
* @return string '... Read more'
*/
function business_express_excerpt_more($more) {
return '… ' . __('Read more', 'business-express') . '';
}
add_filter('excerpt_more', 'business_express_excerpt_more');
/**
* Gets logo as text or image, depending on user
*
* @param boolean $footer Use in footer
* @return string Logo html
*/
function business_express_logo($footer = false) {
$show_text = (!function_exists('the_custom_logo') || !has_custom_logo());
if (!$show_text) {
return get_custom_logo();
}
$acontent = get_bloginfo('name');
if ($footer) {
return '';
}
return '' . $acontent . '';
}
/**
* Enqueue scripts and styles.
*/
function business_express_scripts() {
wp_enqueue_style('business_express_fonts', 'http://fonts.googleapis.com/css?family=Lato:300,400,700,900|Open+Sans:400,300,600,700|Source+Sans+Pro:200,normal,300,600,700');
wp_enqueue_style('business_express_style', get_stylesheet_uri());
wp_enqueue_style('business_express_font-awesome', get_template_directory_uri() . '/assets/font-awesome/font-awesome.min.css');
wp_enqueue_script('business_express_ddmenu', get_template_directory_uri() . '/assets/js/drop_menu_selection.js', array('jquery-effects-slide'), false, true);
wp_enqueue_script('comment-reply');
}
add_action('wp_enqueue_scripts', 'business_express_scripts');
/**
* Footer copyright
* @return string The footer copyright text.
*/
function business_express_copyright() {
return '© ' . " " . date('Y') . ' ' . esc_html(get_bloginfo('name')) . '. ' . __('Built using WordPress and Business Express Theme.', 'business-express');
}
/**
* Menu fallback used for wp_nav_menu
* @return string The wp_page_menu generated html
*/
function business_express_nomenu_cb() {
return wp_page_menu(array(
"menu_class" => 'fm2_drop_mainmenu',
"menu_id" => 'drop_mainmenu_container',
'before' => '',
));
}
/**
* The title to be used in header depending on the current post and template
* @return string The title to be used in header
*/
function business_express_title() {
$title = array(
'title' => '',
);
if (is_404()) {
$title['title'] = __('Page not found', 'business-express');
} elseif (is_search()) {
$title['title'] = sprintf(__('Search Results for “%s”', 'business-express'), get_search_query());
} elseif (is_home()) {
$title['title'] = __('Blog', 'business-express');
} elseif (is_post_type_archive()) {
$title['title'] = post_type_archive_title('', false);
} elseif (is_tax()) {
$title['title'] = single_term_title('', false);
} elseif (is_singular()) {
$title['title'] = single_post_title('', false);
} elseif (is_category() || is_tag()) {
$title['title'] = single_term_title('', false);
} elseif (is_author() && $author = get_queried_object()) {
$title['title'] = $author->display_name;
} elseif (is_year()) {
$title['title'] = get_the_date(_x('Y', 'yearly archives date format', 'business-express'));
} elseif (is_month()) {
$title['title'] = get_the_date(_x('F Y', 'monthly archives date format', 'business-express'));
} elseif (is_day()) {
$title['title'] = get_the_date();
}
return $title['title'];
}
/**
* Current homepage header
* @return string The escaped url of homepage header image
*/
function business_express_homepage_header() {
return esc_url(get_theme_mod('business_express_homepage_header', get_template_directory_uri() . "/assets/images/home_page_header.jpg"));
}