tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
$args = array(
'width' => 1600,
'flex-width' => true,
'uploads' => true,
'random-default' => true,
'header-text' => false,
);
add_theme_support( 'custom-header', $args );
register_default_headers( array(
'default-image' => array(
'url' => '%s/images/header.jpg',
'thumbnail_url' => '%s/images/header.jpg',
'description' => __( 'Default Header Image', 'business-trust' )
),
) );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'business-trust' ),
'secondary' => esc_html__( 'Secondary', 'business-trust' ),
'social' => esc_html__( 'Social Links Menu', 'business-trust' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'business_trust_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif;
add_action( 'after_setup_theme', 'business_trust_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function business_trust_content_width() {
$GLOBALS['content_width'] = apply_filters( 'business_trust_content_width', 640 );
}
add_action( 'after_setup_theme', 'business_trust_content_width', 0 );
/**
* Add custom logo
*
* @link https://codex.wordpress.org/Theme_Logo
*/
function business_trust_theme_prefix_setup() {
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 400,
'flex-width' => true,
) );
}
add_action( 'after_setup_theme', 'business_trust_theme_prefix_setup' );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function business_trust_widgets_init() {
register_sidebar(
array(
'name' => __( 'Blog Sidebar', 'business-trust' ),
'id' => 'sidebar-1',
'description' => __( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'business-trust' ),
'before_widget' => '',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => __( 'WooCommerce Sidebar', 'business-trust' ),
'id' => 'woo-sidebar',
'description' => __( 'Add widgets here to appear in WooCommerce pages.', 'business-trust' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Footer 1', 'business-trust' ),
'id' => 'footer-sidebar-1',
'description' => __( 'Add widgets here to appear in your footer.', 'business-trust' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Footer 2', 'business-trust' ),
'id' => 'footer-sidebar-2',
'description' => __( 'Add widgets here to appear in your footer.', 'business-trust' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Footer 3', 'business-trust' ),
'id' => 'footer-sidebar-3',
'description' => __( 'Add widgets here to appear in your footer.', 'business-trust' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Footer 4', 'business-trust' ),
'id' => 'footer-sidebar-4',
'description' => __( 'Add widgets here to appear in your footer.', 'business-trust' ),
'before_widget' => '',
'before_title' => '',
)
);
}
add_action( 'widgets_init', 'business_trust_widgets_init' );
/**
* Register custom fonts.
*/
if(!function_exists('business_trust_fonts_url')) {
function business_trust_fonts_url() {
$fonts_url = '';
$typography = _x( 'on', 'Open Sans font: on or off', 'business-trust' );
if ( 'off' !== $typography ) {
$font_families = array();
$font_families[] = 'Roboto'.':300,400,500'; //header
$font_families[] = 'Lato'.':300,400,500'; //body
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return esc_url( $fonts_url );
}
}
/**
* Display custom font CSS.
*/
function business_trust_fonts_css_container() {
require( get_parent_theme_file_path( '/inc/google-fonts.php' ) );
?>
';
$wrap .= '';
$wrap .= '%3$s';
$wrap .= '';
return $wrap;
}
function business_trust_excerpt($more)
{
global $post;
return '...'.esc_html__('Read More','business-trust').'';
}
add_filter('excerpt_more','business_trust_excerpt');
add_filter( 'widget_tag_cloud_args', 'business_trust_tag_cloud_font_sizes');
/**
* Change the Tag Cloud's Font Sizes.
* @since 1.0.0
* @param array $args
* @return array
*/
function business_trust_tag_cloud_font_sizes( array $args ) {
$args['smallest'] = '12';
$args['largest'] = '18';
return $args;
}
/**
* @since 1.0.0
* Add woocommerce support to theme
*/
add_action( 'after_setup_theme', 'business_trust_woocommerce_support' );
function business_trust_woocommerce_support() {
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
}