tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/** Image Crope **/
add_image_size('allrounder-news-slider-img',650,500,true);
add_image_size('allrounder-news-featured-posts-img',400,350,true);
add_image_size('allrounder-news-random-posts-img-1',379,213,true);
add_image_size('allrounder-news-random-posts-img-2',100,75,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(
'allrounder-news-primary-menu' => esc_html__( 'Primary Menu', 'allrounder-news' ),
) );
register_nav_menus( array(
'allrounder-news-footer-menu' => esc_html__( 'Footer Menu', 'allrounder-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( 'allrounder_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' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support( 'custom-logo', array(
'height' => 350,
'width' => 90,
'flex-width' => true,
'flex-height' => true,
) );
}
endif;
add_action( 'after_setup_theme', 'allrounder_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 allrounder_news_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( 'allrounder_news_content_width', 640 );
}
add_action( 'after_setup_theme', 'allrounder_news_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function allrounder_news_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'allrounder-news' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'allrounder-news' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Content With Right Sidebar', 'allrounder-news' ),
'id' => 'allrounder-news-home-right-sidebar',
'description' => esc_html__( 'Add widgets here.', 'allrounder-news' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Content With No Sidebar', 'allrounder-news' ),
'id' => 'allrounder-news-home-no-sidebar',
'description' => esc_html__( 'Add widgets here.', 'allrounder-news' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer One', 'allrounder-news' ),
'id' => 'allrounder-news-footer-1',
'description' => esc_html__( 'Add widgets here.', 'allrounder-news' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Two', 'allrounder-news' ),
'id' => 'allrounder-news-footer-2',
'description' => esc_html__( 'Add widgets here.', 'allrounder-news' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Three', 'allrounder-news' ),
'id' => 'allrounder-news-footer-3',
'description' => esc_html__( 'Add widgets here.', 'allrounder-news' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Four', 'allrounder-news' ),
'id' => 'allrounder-news-footer-4',
'description' => esc_html__( 'Add widgets here.', 'allrounder-news' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'allrounder_news_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function allrounder_news_scripts() {
$dir = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '/dir' : '';
$suffix = ( defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ) ? '' : '.min';
$allrounder_news_font_query_args = array('family' => 'Arimo:400,700|Lobster|Open+Sans:400,600,700,800');
wp_enqueue_style( 'allrounder-news-google-fonts', add_query_arg($allrounder_news_font_query_args, "//fonts.googleapis.com/css"));
wp_enqueue_style('bootstrap', get_template_directory_uri() . '/assets/css' . $dir . '/bootstrap' . $suffix . '.css' );
wp_enqueue_style('owl-carousel', get_template_directory_uri() . '/assets/css' . $dir . '/owl.carousel' . $suffix . '.css' );
wp_enqueue_style('ycp', get_template_directory_uri() . '/assets/css' . $dir . '/ycp' . $suffix . '.css' );
wp_enqueue_style( 'allrounder-news-style', get_stylesheet_uri());
wp_enqueue_script( 'all', get_template_directory_uri() . '/assets/js' . $dir . '/all' . $suffix . '.js', array('jquery'), true );
wp_enqueue_script( 'v4-shims', get_template_directory_uri() . '/assets/js' . $dir . '/v4-shims' . $suffix . '.js', array('jquery'), true );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/js' . $dir . '/bootstrap' . $suffix . '.js', array('jquery'), true );
wp_enqueue_script( 'owl-carousel', get_template_directory_uri() . '/assets/js' . $dir . '/owl.carousel' . $suffix . '.js', array('jquery'), true );
wp_enqueue_script( 'ycp', get_template_directory_uri() . '/assets/js' . $dir . '/ycp' . $suffix . '.js', array('jquery'), true );
wp_enqueue_script( 'superfish', get_template_directory_uri() . '/assets/js' . $dir . '/superfish' . $suffix . '.js', array('jquery'), true );
wp_enqueue_script( 'allrounder-news-navigation', get_template_directory_uri() . '/assets/js' . $dir . '/navigation' . $suffix . '.js', array(), '20151215', true );
wp_enqueue_script( 'allrounder-news-skip-link-focus-fix', get_template_directory_uri() . '/assets/js' . $dir . '/skip-link-focus-fix' . $suffix . '.js', array(), '20151215', true );
wp_enqueue_script( 'allrounder-news-script', get_template_directory_uri() . '/assets/js' . $dir . '/allrounder-news-script' . $suffix . '.js', array('jquery'), true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'allrounder_news_scripts',100);
function allrounder_news_customizer_enqueue(){
wp_enqueue_style( 'allrounder-news-customizer-style', get_template_directory_uri() . '/inc/customizer/css/allrounder-news-customizer-style.css' );
wp_enqueue_script( 'allrounder-news-customizer-script', get_template_directory_uri() . '/inc/customizer/js/allrounder-news-customizer-script.js',array('jquery', 'customize-controls') );
$array = array(
'home_url' => get_home_url(),
);
wp_localize_script( 'allrounder-news-customizer-script', 'allrounder_news_customize_data', $array );
}
add_action('customize_controls_enqueue_scripts','allrounder_news_customizer_enqueue');
/** Implement the Custom Header feature. **/
require get_template_directory() . '/inc/custom-header.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';
/** AllRounder News Functions **/
require get_template_directory() . '/inc/allrounder-news-functions.php';
/** AllRounder News Widget Fields **/
require get_template_directory() . '/inc/widget/allrounder-news-widget-fields.php';
/** AllRounder News Widget Category Tab Posts **/
require get_template_directory() . '/inc/widget/allrounder-news-cat-tab-posts.php';
/** AllRounder News Widget Random Posts **/
require get_template_directory() . '/inc/widget/allrounder-news-random-posts.php';
/** AllRounder News Widget Catagory Posts **/
require get_template_directory() . '/inc/widget/allrounder-news-category-posts.php';
/** AllRounder News Widget Multiple Category Posts **/
require get_template_directory() . '/inc/widget/allrounder-news-multiple-category.php';
/** AllRounder News Widget Posts & Reviews **/
require get_template_directory() . '/inc/widget/allrounder-news-widget-post-rating.php';
/** AllRounder News Widget Youtube Video **/
require get_template_directory() . '/inc/widget/allrounder-news-video-playlist.php';
/** AllRounder News Widget Sidebar Category Posts **/
require get_template_directory() . '/inc/widget/allrounder-news-sidebar-cat-post.php';
/**
* AllRounder News Plugin Activation.
*/
require get_template_directory() . '/inc/tgmpa/plugins.php';