__( 'Header Menu', "toolset_starter" ),
) );
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
'video'
) );
/**********************************************************
* The Archive Title Filter
********************************************************/
if (!function_exists('ref_custom_archive_title')) {
add_filter('get_the_archive_title', 'ref_custom_archive_title');
function ref_custom_archive_title($title)
{
if (is_post_type_archive()) {
$title = post_type_archive_title('', false);
}
return $title;
}
}
/******************************************************************************************
* Add Open Sans font variants for admin and front-end
*****************************************************************************************/
if ( ! function_exists( 'replace_open_sans' ) ) {
function replace_open_sans() {
wp_deregister_style( 'open-sans' );
wp_register_style( 'open-sans', '//fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,700italic,800italic,400,300,600,700,800&subset=latin,latin-ext' );
wp_enqueue_style( 'open-sans' );
}
add_action( 'wp_enqueue_scripts', 'replace_open_sans' );
}
/**********************************************************************
* Add image sizes
********************************************************************/
add_image_size( 'product-thumbnail', 260, 330, true );
/**********************************************************************
* Register sidebars
********************************************************************/
if ( ! defined( 'WPDDL_VERSION' ) ) {
if (!function_exists('wpbootstrap_register_widget_areas')) {
function wpbootstrap_register_widget_areas()
{
register_sidebar(array(
'name' => __('Widgets in Footer', "toolset_starter"),
'id' => 'sidebar-footer',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => __('Widgets in Header', "toolset_starter"),
'id' => 'sidebar-header',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
register_sidebar(array(
'name' => __('Default Sidebar', "toolset_starter"),
'id' => 'sidebar-default',
'before_widget' => '',
'after_widget' => '
',
'before_title' => ''
));
}
add_action('widgets_init', 'wpbootstrap_register_widget_areas');
}
}
/**************************************************
* Load custom cells types for Layouts plugin from the /dd-layouts-cells/ directory
**************************************************/
if (class_exists('WPDD_Layouts') && !function_exists('include_ddl_layouts')) {
function include_ddl_layouts( $tpls_dir = '' ) {
$dir_str = dirname( __FILE__ ) . $tpls_dir;
$dir = opendir( $dir_str );
while ( ( $currentFile = readdir( $dir ) ) !== false ) {
if (is_file($dir_str . $currentFile)) {
include $dir_str . $currentFile;
}
}
closedir( $dir );
}
include_ddl_layouts( '/dd-layouts-cells/' );
}
/**************************************************
* Allow to Import/Export Layouts
**************************************************/
if (defined('WPDDL_VERSION')) {
require_once WPDDL_ABSPATH . '/ddl-theme.php';
}
if (function_exists('ddl_import_layouts_from_theme_dir')) {
function ref_import_layouts()
{
ddl_import_layouts_from_theme_dir();
}
add_action('init', 'ref_import_layouts', 99);
}
/**********************************************************************
* Page Slug Body Class
********************************************************************/
function add_slug_body_class( $classes ) {
global $post;
if ( isset( $post ) ) {
$classes[] = $post->post_type . '-' . $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'add_slug_body_class' );
add_filter('get_layout_id_for_render', 'toolset_base_theme_fix_attachment', 2, 99);
function toolset_base_theme_fix_attachment( $layout_id, $layout ){
// if the page is rendering with layouts fix attachment if that's the case
if( $layout_id !== 0 ){
add_filter('the_content', 'prepend_attachment', 1, 999);
}
return $layout_id;
}
/** If has_header_image not exists */
if( ! function_exists( 'has_header_image' ) ) {
function has_header_image() {
return (bool) get_header_image();
}
}
?>