/**
* vmagazine functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package vmagazine-lite
*/
/** important constants **/
$vmagazine_lite_theme_ob = wp_get_theme();
$vmagazine_lite_ver = $vmagazine_lite_theme_ob -> get( 'Version' );
define( 'VMAG_VER',$vmagazine_lite_ver);
define( 'VMAG_URI', get_template_directory_uri() );
define( 'VMAG_DIR', get_template_directory() );
define( 'VMAG_LIB_URI', get_template_directory_uri(). '/assets/library/' );
if ( ! function_exists( 'vmagazine_lite_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 vmagazine_lite_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on vmagazine, use a find and replace
* to change 'vmagazine-lite' to the name of your theme in all the template files.
*/
load_theme_textdomain( 'vmagazine-lite', VMAG_DIR . '/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 custom logo.
*/
add_theme_support(
'custom-logo', array(
'height' => 90,
'width' => 268,
'flex-width' => true,
'flex-hight' => true,
)
);
add_image_size( 'vmagazine-lite-rectangle-thumb', 510, 369, true );
add_image_size( 'vmagazine-lite-small-thumb', 320, 224, true );
add_image_size( 'vmagazine-lite-single-large', 1920, 1000, true );
add_image_size( 'vmagazine-lite-large-category', 1200, 500, true );
add_image_size( 'vmagazine-lite-small-square-thumb', 321, 257, true );
add_image_size( 'vmagazine-lite-slider-thumb', 300, 200, true );
add_image_size( 'vmagazine-lite-vertical-slider-thumb', 400, 340, true );
add_image_size( 'vmagazine-lite-post-slider-lg', 600, 400, true );
add_image_size( 'vmagazine-lite-post-slider-new', 700, 400, true );
/*
* 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_menu' => esc_html__( 'Primary Menu', 'vmagazine-lite' ),
'top_menu' => esc_html__( 'Top Header Menu', 'vmagazine-lite' ),
'footer_menu' => esc_html__( 'Footer Menu', 'vmagazine-lite' )
) );
/*
* 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.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'aside',
'image',
'audio',
'video',
'gallery',
'quote',
'link',
) );
// Add support for Block Styles.
add_theme_support( 'wp-block-styles' );
// Add support for full and wide align images.
add_theme_support( 'align-wide' );
// Add support for responsive embedded content.
add_theme_support( 'responsive-embeds' );
// Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'vmagazine_lite_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
}
endif;
add_action( 'after_setup_theme', 'vmagazine_lite_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 vmagazine_lite_content_width() {
$GLOBALS['content_width'] = apply_filters( 'vmagazine_lite_content_width', 640 );
}
add_action( 'after_setup_theme', 'vmagazine_lite_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function vmagazine_lite_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Right Sidebar', 'vmagazine-lite' ),
'id' => 'vmagazine-lite-sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'vmagazine-lite' ),
'before_widget' => '