240,
'width' => 240,
'flex-height' => true,
)
);
add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 1200, 9999 );
$header_args = array(
'width' => 1600,
'flex-width' => true,
'uploads' => true,
'random-default' => true,
'header-text' => false,
'default-image' => get_template_directory_uri().'/images/header.jpg',
);
add_theme_support( 'custom-header', $header_args );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus(
array(
'primary' => __( 'Primary Menu', 'business-ecommerce' ),
'social' => __( 'Social Links Menu', 'business-ecommerce' ),
)
);
/*
* 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',
)
);
/*
* Enable support for Post Formats.
*/
add_theme_support(
'post-formats',
array(
'aside',
'image',
'video',
'quote',
'link',
'gallery',
'status',
'audio',
'chat',
)
);
// Add support for responsive embeds.
add_theme_support( 'responsive-embeds' );
// Indicate widget sidebars can use selective refresh in the Customizer.
add_theme_support( 'customize-selective-refresh-widgets' );
}
endif; // business_ecommerce_setup
add_action( 'after_setup_theme', 'business_ecommerce_setup' );
/**
*
* @global int $content_width
*
*
*/
function business_ecommerce_content_width() {
$GLOBALS['content_width'] = apply_filters( 'business_ecommerce_content_width', 840 );
}
add_action( 'after_setup_theme', 'business_ecommerce_content_width', 0 );
/**
* Add preconnect for Google Fonts.
*
* @param array $urls URLs to print for resource hints.
* @param string $relation_type The relation type the URLs are printed.
* @return array $urls URLs to print for resource hints.
*/
function business_ecommerce_resource_hints( $urls, $relation_type ) {
if ( wp_style_is( 'business-ecommerce-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
$urls[] = array(
'href' => 'https://fonts.gstatic.com',
'crossorigin',
);
}
return $urls;
}
add_filter( 'wp_resource_hints', 'business_ecommerce_resource_hints', 10, 2 );
/**
* Registers a widget area.
*/
function business_ecommerce_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'business-ecommerce' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here to appear in your sidebar.', 'business-ecommerce' ),
'before_widget' => '',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Bottom Post & Pages 1', 'business-ecommerce' ),
'id' => 'sidebar-2',
'description' => esc_html__( 'Appears at the bottom of the content on posts and pages.', 'business-ecommerce' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Bottom Post & Pages 2', 'business-ecommerce' ),
'id' => 'sidebar-3',
'description' => esc_html__( 'Appears at the bottom of the content on posts and pages.', 'business-ecommerce' ),
'before_widget' => '',
'before_title' => '',
)
);
/* Footer widget area */
register_sidebar(
array(
'name' => esc_html__( 'Footer 1', 'business-ecommerce' ),
'id' => 'footer-sidebar-1',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'business-ecommerce' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 2', 'business-ecommerce' ),
'id' => 'footer-sidebar-2',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'business-ecommerce' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 3', 'business-ecommerce' ),
'id' => 'footer-sidebar-3',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'business-ecommerce' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 4', 'business-ecommerce' ),
'id' => 'footer-sidebar-4',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'business-ecommerce' ),
'before_widget' => '',
'before_title' => '',
)
);
}
add_action( 'widgets_init', 'business_ecommerce_widgets_init' );
if ( ! function_exists( 'business_ecommerce_fonts_url' ) ) :
/**
* @return string Google fonts URL for the theme.
*/
function business_ecommerce_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Merriweather, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Merriweather font: on or off', 'business-ecommerce' ) ) {
$fonts[] = 'Merriweather:400,700,900,400italic,700italic,900italic';
}
/* translators: If there are characters in your language that are not supported by Montserrat, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Montserrat font: on or off', 'business-ecommerce' ) ) {
$fonts[] = 'Montserrat:400,700';
}
/* translators: If there are characters in your language that are not supported by Inconsolata, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Inconsolata font: on or off', 'business-ecommerce' ) ) {
$fonts[] = 'Inconsolata:400';
}
if ( $fonts ) {
$fonts_url = add_query_arg(
array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
),
'https://fonts.googleapis.com/css'
);
}
return $fonts_url;
}
endif;
/**
* Handles JavaScript detection.
* Adds a `js` class to the root `` element when JavaScript is detected.
*/
function business_ecommerce_javascript_detection() {
echo "\n";
}
add_action( 'wp_head', 'business_ecommerce_javascript_detection', 0 );
/**
* Enqueues scripts and styles.
*/
function business_ecommerce_scripts() {
// Add custom fonts, used in the main stylesheet.
wp_enqueue_style( 'business-ecommerce-fonts', business_ecommerce_fonts_url(), array(), null );
wp_enqueue_style( 'bootstrap', get_theme_file_uri( '/css/bootstrap.css' ), array(), '3.3.6');
// Add Genericons, used in the main stylesheet.
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/fonts/font-awesome/css/font-awesome.css', array(), '3.4.1' );
// Theme stylesheet.
wp_enqueue_style( 'business-ecommerce-style', get_stylesheet_uri() );
// Load the html5 shiv.
wp_enqueue_script( 'business-ecommerce-html5', get_template_directory_uri() . '/js/html5.js', array(), '3.7.3' );
wp_script_add_data( 'business-ecommerce-html5', 'conditional', 'lt IE 9' );
wp_enqueue_script( 'business-ecommerce-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20191010', true );
wp_enqueue_script( 'bootstrap', get_theme_file_uri( '/js/bootstrap.js' ), array( 'jquery' ), '3.3.7', true);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'business-ecommerce-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20160816' );
}
wp_enqueue_script( 'business-ecommerce-script', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20191010', true );
wp_localize_script(
'business-ecommerce-script',
'screenReaderText',
array(
'expand' => esc_html__( 'expand child menu', 'business-ecommerce' ),
'collapse' => esc_html__( 'collapse child menu', 'business-ecommerce' ),
)
);
}
add_action( 'wp_enqueue_scripts', 'business_ecommerce_scripts' );
/**
* Enqueue styles for the block-based editor.
*/
function business_ecommerce_block_editor_styles() {
// Add custom fonts.
wp_enqueue_style( 'business-ecommerce-fonts', business_ecommerce_fonts_url(), array(), null );
}
add_action( 'enqueue_block_editor_assets', 'business_ecommerce_block_editor_styles' );
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
remove_filter( 'the_content', 'wpautop' );