tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* 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(
'menu-1' => esc_html__( 'Primary', 'startup-shop' ),
) );
/*
* 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( 'startup_shop_custom_background_args', array(
'default-color' => 'f6f7f9',
'default-image' => '',
) ) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'image',
'video',
'gallery',
'audio',
'quote'
) );
add_theme_support("responsive-embeds");
add_theme_support( "wp-block-styles" );
add_theme_support( "align-wide" );
update_option( 'widget_block', '' );
}
endif;
add_action( 'after_setup_theme', 'startup_shop_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 startup_shop_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'startup_shop_content_width', 640 );
}
add_action( 'after_setup_theme', 'startup_shop_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function startup_shop_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'startup-shop' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'startup-shop' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Logo Right', 'startup-shop' ),
'id' => 'logo-right',
'description' => esc_html__( 'Add widgets here.', 'startup-shop' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Home Page Slider', 'startup-shop' ),
'id' => 'slider',
'description' => esc_html__( 'Add widgets here.', 'startup-shop' ),
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer', 'startup-shop' ),
'id' => 'footer-1',
'description' => esc_html__( 'Add widgets here.', 'startup-shop' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'startup_shop_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function startup_shop_scripts() {
wp_enqueue_style( 'startup-shop-google-fonts', '//fonts.googleapis.com/css?family=Jost:wght@400;500|Raleway:400,600|Roboto+Condensed:400;700&display=swap' );
/* PLUGIN CSS */
wp_enqueue_style( 'bootstrap', get_theme_file_uri( '/vendors/bootstrap/css/bootstrap.css' ), array(), '4.0.0' );
wp_enqueue_style( 'icofont', get_theme_file_uri( '/vendors/icofont/icofont.css' ), array(), '1.0.1' );
wp_enqueue_style( 'scrollbar', get_theme_file_uri( '/vendors/scrollbar/simple-scrollbar.css' ), array(), '1.0.0' );
wp_enqueue_style( 'magnific-popup', get_theme_file_uri( '/vendors/magnific-popup/magnific-popup.css' ), array(), '1.0.0' );
wp_enqueue_style( 'owl-carousel', get_theme_file_uri( '/vendors/owl-carousel/assets/owl.carousel.css' ), array(), '1.0.0' );
wp_enqueue_style( 'startup-shop-common', get_theme_file_uri( '/assets/css/startup-shop-common.css' ), array(), '1.0.0' );
wp_enqueue_style( 'startup-shop-style', get_stylesheet_uri(), array(), _FATEST_SHOP_VERSION );
wp_style_add_data( 'startup-shop-style', 'rtl', 'replace' );
$custom_css = ':root {--primary-color:'.esc_attr( get_theme_mod('__primary_color','#6c757d') ).'; --secondary-color: '.esc_attr( get_theme_mod('__secondary_color','#ed1c24') ).';--nav-color-h:'.esc_attr( get_theme_mod('__secondary_color','#ed1c24') ).';--nav-sub-color:'.esc_attr( get_theme_mod('__secondary_color','#ed1c24') ).';--nav-sub-bg-h:'.esc_attr( get_theme_mod('__secondary_color','#ed1c24') ).';--nav-sub-color-h:#fff}';
wp_add_inline_style( 'startup-shop-style', $custom_css );
wp_enqueue_script( 'bootstrap', get_theme_file_uri( '/vendors/bootstrap/js/bootstrap.js' ), 0, '3.3.7', true );
wp_enqueue_script( 'scrollbar-js', get_theme_file_uri( '/vendors/scrollbar/simple-scrollbar.js' ), 0, '', true );
wp_enqueue_script( 'customselect', get_theme_file_uri( '/vendors/customselect.js' ), 0, '', true );
wp_enqueue_script( 'magnific-popup-js', get_theme_file_uri( '/vendors/magnific-popup/jquery.magnific-popup.js' ), 0, '', true );
wp_enqueue_script( 'owl-carousel-js', get_theme_file_uri( '/vendors/owl-carousel/owl.carousel.js' ), 0, '', true );
wp_enqueue_script( 'sticky-sidebar', get_theme_file_uri( '/vendors/sticky-sidebar/jquery.sticky-sidebar.js' ), 0, '', true );
wp_enqueue_script( 'startup-shop-js', get_theme_file_uri( '/assets/js/startup-shop.js'), array('jquery' ), '1.0.0', true);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'startup_shop_scripts' );
/**
* Set up the WordPress core custom header feature.
*
* @uses startup_shop_header_style()
*/
function startup_shop_custom_header_setup() {
add_theme_support( 'custom-header', apply_filters( 'startup_shop_custom_header_args', array(
'default-image' => get_template_directory_uri() . '/assets/image/custom-header.jpg',
'default-text-color' => '000000',
'width' => 1000,
'height' => 350,
'flex-height' => true,
'wp-head-callback' => 'startup_shop_header_style',
) ) );
register_default_headers( array(
'default-image' => array(
'url' => '%s/assets/image/custom-header.jpg',
'thumbnail_url' => '%s/assets/image/custom-header.jpg',
'description' => esc_html__( 'Default Header Image', 'startup-shop' ),
),
));
}
add_action( 'after_setup_theme', 'startup_shop_custom_header_setup' );
if ( ! function_exists( 'startup_shop_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog.
*
* @see startup_shop_custom_header_setup().
*/
function startup_shop_header_style() {
$header_text_color = get_header_textcolor();
$header_image = get_header_image();
if( !empty( $header_image ) ){
?>