/**
* Zakra functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package zakra
*/
if ( ! function_exists( 'zakra_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
function zakra_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on zakra, use a find and replace
* to change 'zakra' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'zakra', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
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-primary' => esc_html__( 'Primary', 'zakra' ),
) );
/*
* 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',
) );
// 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(
'width' => 170,
'height' => 60,
'flex-width' => true,
'flex-height' => true,
) );
/**
* Custom background support.
*/
add_theme_support( 'custom-background' );
/**
* Gutenberg Wide/fullwidth support.
*/
add_theme_support( 'align-wide' );
/**
* AMP support.
*/
if ( defined( 'AMP__VERSION' ) && ( ! version_compare( AMP__VERSION, '1.0.0', '<' ) ) ) {
add_theme_support( 'amp',
apply_filters(
'zakra_amp_support_filter',
array(
'paired' => true,
)
)
);
}
}
endif;
add_action( 'after_setup_theme', 'zakra_setup' );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function zakra_widgets_init() {
$sidebars = apply_filters( 'zakra_sidebars_args', array(
'header-top-left-sidebar' => esc_html__( 'Header Top Bar Left Sidebar', 'zakra' ),
'header-top-right-sidebar' => esc_html__( 'Header Top Bar Right Sidebar', 'zakra' ),
'sidebar-right' => esc_html__( 'Sidebar Right', 'zakra' ),
'sidebar-left' => esc_html__( 'Sidebar Left', 'zakra' ),
'footer-sidebar-1' => esc_html__( 'Footer One', 'zakra' ),
'footer-sidebar-2' => esc_html__( 'Footer Two', 'zakra' ),
'footer-sidebar-3' => esc_html__( 'Footer Three', 'zakra' ),
'footer-sidebar-4' => esc_html__( 'Footer Four', 'zakra' ),
'footer-bar-left-sidebar' => esc_html__( 'Footer Bottom Bar Left Sidebar', 'zakra' ),
'footer-bar-right-sidebar' => esc_html__( 'Footer Bottom Bar Right Sidebar', 'zakra' ),
) );
if ( zakra_is_woocommerce_active() ) {
$sidebars['wc-left-sidebar'] = esc_html__( 'WooCommerce Left Sidebar', 'zakra' );
$sidebars['wc-right-sidebar'] = esc_html__( 'WooCommerce Right Sidebar', 'zakra' );
}
foreach ( $sidebars as $id => $name ) :
register_sidebar( array(
'id' => $id,
'name' => $name,
'description' => esc_html__( 'Add widgets here.', 'zakra' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '