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' );
add_image_size( 'online-news-slider', 1366, 640, true);
add_image_size( 'online-news-article-thumb', 70, 70, true);
add_image_size( 'online-news-sidebar-thumb', 255, 139, true);
add_image_size( 'online-news-post-thumb', 255, 166, true);
add_image_size( 'online-news-postthumb-medium', 1270, 650, true);
add_image_size( 'online-news-post-side-thumb', 620, 404, true);
add_image_size( 'online-news-feature-thumb', 945, 421, true);
add_image_size( 'online-news-postthumb-thumb', 87, 59, true);
add_image_size( 'online-news-post-mediumthumb', 837, 428, true);
// Enable support for custom logo.
add_theme_support( 'custom-logo' );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary', 'online-news' ),
'top-menu' => esc_html__( 'Top Menu', 'online-news' ),
'footer-top-menu' => esc_html__( ' Footer Top Menu', 'online-news' ),
'footer-menu' => esc_html__( ' Footer Menu', 'online-news' ),
) );
/*
* 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( 'online_news_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', 'online_news_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 online_news_content_width() {
$GLOBALS['content_width'] = apply_filters( 'online_news_content_width', 640 );
}
add_action( 'after_setup_theme', 'online_news_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function online_news_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'online-news' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'online-news' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'News Section 1:Tab Section', 'online-news' ),
'id' => 'news-section1-breaking-news',
'description' => esc_html__( 'Widget for breaking news in News Section 1', 'online-news' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'News Section 1:Sidebar', 'online-news' ),
'id' => 'news-section1-sidebar',
'description' => esc_html__( 'Widget for sidebar in News Section 1', 'online-news' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'News Section 2:Sidebar', 'online-news' ),
'id' => 'news-section2-sidebar',
'description' => esc_html__( 'Widget for sidebar in News Section 2', 'online-news' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'News Section 3:Sidebar', 'online-news' ),
'id' => 'news-section3-sidebar',
'description' => esc_html__( 'Widget for sidebar in News Section 3', 'online-news' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'News Section 3:News Section', 'online-news' ),
'id' => 'news-section3-news-section',
'description' => esc_html__( 'Widget for sidebar in News Section 3', 'online-news' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'News Section 4:Sidebar', 'online-news' ),
'id' => 'news-section4-sidebar',
'description' => esc_html__( 'Widget for sidebar in News Section 4', 'online-news' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Section 1 Advertisement', 'online-news' ),
'id' => 'advertisement-section',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Section 2 Advertisement', 'online-news' ),
'id' => 'advertisement-section1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Section 3 Advertisement', 'online-news' ),
'id' => 'advertisement-section2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'online_news_widgets_init' );
/**
* Register custom fonts.
*/
function online_news_fonts_url() {
$fonts_url = '';
/**
* Translators: If there are characters in your language that are not
* supported by Libre Franklin, translate this to 'off'. Do not translate
* into your own language.
*/
$poppins = _x( 'on', 'Poppins font: on or off', 'online-news' );
if ( 'off' !== $poppins ) {
$font_families = array();
$font_families[] = 'Poppins:300,400,500,600,700';
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
/**
* Enqueue scripts and styles.
*/
function online_news_scripts() {
$fonts_url = online_news_fonts_url();
if ( ! empty( $fonts_url ) ) {
wp_enqueue_style( 'online-news-google-fonts', $fonts_url, array(), null );}
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/font-awesome/css/font-awesome.min.css', '', '4.7.0' );
wp_enqueue_style( 'owl-carousel', get_template_directory_uri() .'/css/owl.carousel.min.css', '', 'v2.2.0');
wp_enqueue_style( 'owl-theme', get_template_directory_uri() .'/css/owl.theme.css', '', 'v2.2.0');
wp_enqueue_style( 'meanmenu-css', get_template_directory_uri() .'/css/meanmenu.css', '', '2.0.7');
wp_enqueue_style( 'online-news-style', get_stylesheet_uri(), array(), '1.0.0' );
add_editor_style( 'online-news-style', get_stylesheet_uri());
wp_enqueue_script( 'owl-carousel-min-js', get_template_directory_uri() . '/js/owl.carousel.min.js', array('jquery'), '20151215', true );
wp_enqueue_script( 'easyResponsiveTabs-js', get_template_directory_uri() . '/js/easyResponsiveTabs.js', array('jquery'), '20151215', true );
wp_enqueue_script( 'jquery-nicescroll-js', get_template_directory_uri() . '/js/jquery.nicescroll.js', array('jquery'), '20151215', true );
wp_enqueue_script( 'jquery-newsTicker-js', get_template_directory_uri() . '/js/jquery.easy-ticker.min.js', array('jquery'), '20151215', true );
wp_enqueue_script( 'jquery-meanmenu-js', get_template_directory_uri() . '/js/jquery.meanmenu.js', array(), '2.0.8', true );
wp_enqueue_script( 'online-news-custom-js', get_template_directory_uri() . '/js/custom.js', array('jquery'), '20151215', true );
wp_enqueue_script( 'navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20151215', true );
wp_enqueue_script( 'skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20151215', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'online_news_scripts' );
/**
* Load init.
*/
require_once get_template_directory() . '/inc/init.php';