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(
'main-menu' => esc_html__('Primary', 'decents-blog') ,
));
/*
* 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('decents_blog_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', 'decents_blog_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 decents_blog_content_width()
{
$GLOBALS['content_width'] = apply_filters('decents_blog_content_width', 640);
}
add_action('after_setup_theme', 'decents_blog_content_width', 0);
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function decents_blog_widgets_init()
{
register_sidebar(array(
'name' => esc_html__('Sidebar', 'decents-blog') ,
'id' => 'sidebar-1',
'description' => esc_html__('Add widgets here.', 'decents-blog') ,
'before_widget' => '',
'before_title' => '
',
));
register_sidebar(array(
'name' => esc_html__('Footer 1', 'decents-blog') ,
'id' => 'footer-1',
'description' => esc_html__('Add widgets here.', 'decents-blog') ,
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__('Footer 2', 'decents-blog') ,
'id' => 'footer-2',
'description' => esc_html__('Add widgets here.', 'decents-blog') ,
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__('Footer 3', 'decents-blog') ,
'id' => 'footer-3',
'description' => esc_html__('Add widgets here.', 'decents-blog') ,
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => esc_html__('Footer 4', 'decents-blog') ,
'id' => 'footer-4',
'description' => esc_html__('Add widgets here.', 'decents-blog') ,
'before_widget' => '',
'before_title' => '',
));
register_widget('Decent_Blog_Widget_style');
}
add_action('widgets_init', 'decents_blog_widgets_init');
include_once (ABSPATH . 'wp-admin/includes/plugin.php');
/**
* Enqueue scripts and styles.
*/
function decents_blog_scripts()
{
wp_enqueue_style('decents-blog-style', get_stylesheet_uri() , array() , _DECENT_BLOG_VERSION);
//CSS
wp_enqueue_style('decents-blog-font-roboto', 'https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,300;1,400;1,500;1,700;1,900&display=swap');
wp_enqueue_style('decents-blog-font-montercarlo', 'https://fonts.googleapis.com/css2?family=MonteCarlo&display=swap');
wp_enqueue_style('bootstrap-css', get_template_directory_uri() . '/assets/css/bootstrap.css');
wp_enqueue_style('font-awesome-css', get_template_directory_uri() . '/assets/css/font-awesome.css');
wp_enqueue_style('responsive-css', get_template_directory_uri() . '/assets/css/responsive.css');
//JS
wp_enqueue_script('masonry');
wp_enqueue_script('decents-blog-main', get_template_directory_uri() . '/assets/js/decents-blog-main.js', array(
'jquery'
) , _DECENT_BLOG_VERSION, true);
global $wp_query;
$paged = (get_query_var('paged') > 1) ? get_query_var('paged') : 1;
$max_num_pages = $wp_query->max_num_pages;
wp_localize_script('decents-blog-main', 'decents_blog_ajax', array(
'ajaxurl' => admin_url('admin-ajax.php') ,
'paged' => absint($paged) ,
'max_num_pages' => absint($max_num_pages) ,
'next_posts' => next_posts(absint($max_num_pages) , false) ,
'show_more' => __('Load More', 'decents-blog') ,
'no_more_posts' => __('No More', 'decents-blog') ,
));
wp_enqueue_script('decents-blog-menu-accessibility.js', get_template_directory_uri() . '/assets/js/decents-blog-menu-accessibility.js', array() , _DECENT_BLOG_VERSION, true);
if (is_singular() && comments_open() && get_option('thread_comments'))
{
wp_enqueue_script('comment-reply');
}
}
add_action('wp_enqueue_scripts', 'decents_blog_scripts');
if (!function_exists('decents_blog_load_more_pagination')):
function decents_blog_load_more_pagination()
{
$decents_blog_pagination_option = get_theme_mod('decents_blog_pagination_options', esc_html__('loadmore', 'decents-blog'));
if ('number' == $decents_blog_pagination_option)
{
echo "