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', 'sharksdesign' ),
)
);
/*
* 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',
'style',
'script',
)
);
// Set up the WordPress core custom background feature.
add_theme_support(
'custom-background',
apply_filters(
'sharksdesign_custom_background_args',
array(
'default-color' => 'ffffff',
'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,
)
);
}
endif;
add_action( 'after_setup_theme', 'sharksdesign_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 $sharksdesign_content_width
*/
function sharksdesign_content_width() {
$GLOBALS['sharksdesign_content_width'] = apply_filters( 'sharksdesign_content_width', 640 );
}
add_action( 'after_setup_theme', 'sharksdesign_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function sharksdesign_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'sharksdesign' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'sharksdesign' ),
'before_widget' => '',
'before_title' => '
',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 1', 'sharksdesign' ),
'id' => 'footer-1',
'description' => esc_html__( 'Add widgets here.', 'sharksdesign' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 2', 'sharksdesign' ),
'id' => 'footer-2',
'description' => esc_html__( 'Add widgets here.', 'sharksdesign' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 3', 'sharksdesign' ),
'id' => 'footer-3',
'description' => esc_html__( 'Add widgets here.', 'sharksdesign' ),
'before_widget' => '',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => esc_html__( 'Footer 4', 'sharksdesign' ),
'id' => 'footer-4',
'description' => esc_html__( 'Add widgets here.', 'sharksdesign' ),
'before_widget' => '',
'before_title' => '',
)
);
if ( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
register_sidebar(
array(
'name' => esc_html__( 'WooCommerce Product Section', 'sharksdesign' ),
'id' => 'woocommerce_product',
'description' => esc_html__( 'Add widgets here.', 'sharksdesign' ),
'before_widget' => '',
'before_title' => '',
)
);
}
}
add_action( 'widgets_init', 'sharksdesign_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function sharksdesign_scripts() {
wp_enqueue_script('jquery', false, array(), false, false);
wp_enqueue_style( 'sharksdesign-style', get_stylesheet_uri(), array(), _S_VERSION );
wp_style_add_data( 'sharksdesign-style', 'rtl', 'replace' );
wp_enqueue_style( 'fontawesome-css', esc_url(get_template_directory_uri()).'/assets/fontawesome/css/font-awesome.css' , array(), _S_VERSION );
wp_enqueue_style( 'theme-css', esc_url(get_template_directory_uri()).'/assets/css/theme.css' , array(), _S_VERSION );
wp_enqueue_script( 'sharksdesign-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), _S_VERSION, true );
wp_enqueue_style( 'owl-carousel-min-css', esc_url(get_template_directory_uri()).'/assets/css/owl.carousel.min.css' , array(), _S_VERSION );
wp_enqueue_style( 'owl-carousel_theme-min-css', esc_url(get_template_directory_uri()).'/assets/css/owl.theme.min.css' , array(), _S_VERSION );
wp_enqueue_script( 'owl-carousel-min', get_template_directory_uri() . '/assets/js/owl.carousel.min.js', array(), _S_VERSION, true );
wp_enqueue_script( 'custom-js', get_template_directory_uri() . '/assets/js/custom.js', array(), _S_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'sharksdesign_scripts' );
function sharksdesign_admin_script_style(){
wp_enqueue_style( 'fontawesome-min-css', esc_url(get_template_directory_uri()).'/assets/fontawesome/css/font-awesome.min.css' , array(), _S_VERSION );
wp_enqueue_style( 'admin-site-css', esc_url(get_template_directory_uri()).'/assets/css/admin_site.css' , array(), _S_VERSION );
wp_enqueue_style('wp-color-picker' );
wp_enqueue_script('wp-color-picker-alpha', get_template_directory_uri() . '/assets/js/wp-color-picker-alpha.js', array( 'wp-color-picker' ), '1.0.0', true );
wp_enqueue_script( 'sharksdesign-install-recommended-plugins', get_template_directory_uri() . '/install-recommended-plugins/admin.js', array( 'jquery' ), false, false );
$color_picker_strings = array(
'clear' => __( 'Clear', 'sharksdesign' ),
'clearAriaLabel' => __( 'Clear color', 'sharksdesign' ),
'defaultString' => __( 'Default', 'sharksdesign' ),
'defaultAriaLabel' => __( 'Select default color', 'sharksdesign' ),
'pick' => __( 'Select Color', 'sharksdesign' ),
'defaultLabel' => __( 'Color value', 'sharksdesign' ),
);
wp_localize_script( 'wp-color-picker-alpha', 'wpColorPickerL10n', $color_picker_strings );
wp_enqueue_script( 'wp-color-picker-alpha' );
}
add_action('admin_enqueue_scripts', 'sharksdesign_admin_script_style');
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
require get_template_directory() . '/inc/customizer-css.php';
require get_template_directory() . '/inc/customizer_control.php';
require get_template_directory() . '/inc/about.php';
require get_template_directory() . '/install-recommended-plugins/wtb-required-plugins.php';
require get_template_directory() . '/install-recommended-plugins/index.php';
require get_template_directory() . '/inc/customizer-options/sharksdesign_recommended_plugin.php';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}
/**
* Load WooCommerce compatibility file.
*/
if ( class_exists( 'WooCommerce' ) ) {
require get_template_directory() . '/inc/woocommerce.php';
}
function sharksdesign_breadcrumb_slider(){
?>
get( 'Name' );
$nonce = wp_create_nonce("sharksdesign_install_plugins");
?>
';
printf(
esc_html__( 'Thank you for installing %1$s', 'sharksdesign' ),
esc_attr($theme_name)
);
echo '';
echo '
' . esc_html__( "Install and activate Page Section For Themereviewer plugin for taking full advantage of all the features this theme has to offer." , 'sharksdesign' ) . '
';
?>
array(
'slug' => 'spediex-for-theme/spediex-for-theme.php',
'zip' => 'spediex-for-theme'
),
'woocommerce' => array(
'slug' => 'woocommerce/woocommerce.php',
'zip' => 'woocommerce'
),
);
return $plugins;
});
function sharksdesign_main_js() {
wp_enqueue_script( 'main-js', get_theme_file_uri( '/assets/js/custom.js' ), array(), '1.0', true );
// Localize the script with new data and pass php variables to JS.
$main_js_data = array(
'img_autoplay' => get_theme_mod('featured_slider_autoplay', 'true'),
'img_autoplayspped' => get_theme_mod('featured_slider_autoplay_speed','1000'),
'img_autoplaytimeout' => get_theme_mod('featured_slider_autoplay_timeout','5000'),
'autoplay' => get_theme_mod('our_testimonial_slider_autoplay', 'true'),
'autoplayspped' => get_theme_mod('our_testimonial_slider_autoplay_speed','1000'),
'autoplaytimeout' => get_theme_mod('our_testimonial_autoplay_timeout','5000'),
'sponsor_autoplay' => get_theme_mod('our_sponsors_slider_autoplay', 'true'),
'sponsor_autoplayspped' => get_theme_mod('our_sponsors_slider_autoplay_speed','1000'),
'sponsor_autoplaytimeout' => get_theme_mod('our_sponsors_autoplay_timeout','5000'),
);
wp_localize_script( 'main-js', 'main_vars', $main_js_data );
}
add_action( 'wp_enqueue_scripts', 'sharksdesign_main_js' );