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.
*/
add_theme_support( 'post-thumbnails' );
/*
* WooCommerce Support
*/
add_theme_support( 'woocommerce' );
add_theme_support( 'wc-product-gallery-zoom' );
add_theme_support( 'wc-product-gallery-lightbox' );
add_theme_support( 'wc-product-gallery-slider' );
/*
* Gutenberg Support
*/
add_theme_support( 'custom-line-height' );
add_theme_support( 'align-wide' );
add_theme_support( 'wp-block-styles' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'editor-styles' );
add_action( 'init', function () {
register_block_style( 'core/cover', [
'name' => 'my-cover-100',
'label' => __( 'Cover height 100px', 'allx' ),
'inline_style' => '.is-style-my-cover-100 { min-height: 100px;}',
] );
register_block_style( 'core/cover', [
'name' => 'my-cover-200',
'label' => __( 'Cover height 200px', 'allx' ),
'inline_style' => '.is-style-my-cover-200 { min-height: 200px;}',
] );
register_block_style( 'core/cover', [
'name' => 'my-cover-300',
'label' => __( 'Cover height 300px', 'allx' ),
'inline_style' => '.is-style-my-cover-300 { min-height: 300px;}',
] );
register_block_style( 'core/cover', [
'name' => 'my-cover-400',
'label' => __( 'Cover height 400px', 'allx' ),
'inline_style' => '.is-style-my-cover-400 { min-height: 400px;}',
] );
register_block_style( 'core/cover', [
'name' => 'my-cover-500',
'label' => __( 'Cover height 500px', 'allx' ),
'inline_style' => '.is-style-my-cover-500 { min-height: 500px;}',
] );
register_block_style( 'core/paragraph', array(
'name' => 'prefix-rounded-corners-5',
'label' => __( 'Rounded corners (Requires background color). Border radius 5px', 'allx' ),
'inline_style' => '.is-style-prefix-rounded-corners-5 {
border-radius: 5px;
}',
) );
register_block_style( 'core/paragraph', array(
'name' => 'prefix-rounded-corners-10',
'label' => __( 'Rounded corners (Requires background color). Border radius 10px', 'allx' ),
'inline_style' => '.is-style-prefix-rounded-corners-10 {
border-radius: 10px;
}',
) );
} );
// This theme uses wp_nav_menu() in one location.
add_theme_support( 'nav-menus' );
register_nav_menu( 'primary', esc_html__( 'Primary', 'allx' ) );
/*
* 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( 'allx__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.
*/
add_theme_support( 'custom-logo', array(
'flex-width' => true,
'flex-height' => true,
) );
register_default_headers( array(
'img1' => array(
'url' => allx_THEME_URI . '/images/header.jpg',
'thumbnail_url' => allx_THEME_URI . '/images/header.jpg',
'description' => esc_html__( 'Default Image 1', 'allx' ),
),
) );
}
}
add_action( 'after_setup_theme', 'allx__setup' );
function wpdocs_theme_add_editor_styles()
{
add_editor_style( 'editor-styles.css' );
}
add_action( 'admin_init', 'wpdocs_theme_add_editor_styles' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*/
function allx__content_width()
{
// This variable is intended to be overruled from themes.
$GLOBALS['content_width'] = apply_filters( 'allx__content_width', 640 );
}
add_action( 'after_setup_theme', 'allx__content_width', 0 );
/**
* Register widget area.
*/
function allx__widgets_init()
{
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'allx' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'allx' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 1', 'allx' ),
'id' => 'footer-1',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 2', 'allx' ),
'id' => 'footer-2',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 3', 'allx' ),
'id' => 'footer-3',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 4', 'allx' ),
'id' => 'footer-4',
'description' => '',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'allx__widgets_init' );
/**
* Enqueue scripts and styles.
*/
function allx__scripts()
{
wp_enqueue_script( 'jquery' );
wp_enqueue_script(
'allx-menu',
allx_THEME_URI . '/js/menu.js',
array(),
'',
true
);
wp_enqueue_style( 'custom-style-css', get_stylesheet_uri() );
wp_enqueue_style( 'dashicons' );
wp_enqueue_style( 'allx-animate-css', allx_THEME_URI . '/css/animate.css' );
wp_enqueue_style( 'allx-form-css', allx_THEME_URI . '/css/form-styles.css' );
wp_enqueue_script(
'allx-search-top-js',
allx_THEME_URI . '/js/search-top.js',
array(),
'',
false
);
wp_enqueue_script(
'allx-select-search-js',
allx_THEME_URI . '/js/select-search.js',
array(),
'',
true
);
wp_enqueue_style(
'allx-font-awesome',
allx_THEME_URI . '/css/font-awesome.css',
array(),
'',
false
);
wp_enqueue_style(
'allx-font-awesome-v4-shims',
allx_THEME_URI . '/css/v4-shims.css',
array(),
'',
false
);
wp_enqueue_style(
'allx-font-awesome-v5-font-face',
allx_THEME_URI . '/css/v5-font-face.css',
array(),
'',
false
);
wp_enqueue_style(
'allx-font-awesome-v4-font-face',
allx_THEME_URI . '/css/v4-font-face.css',
array(),
'',
false
);
wp_enqueue_style(
'allx-font-woo-css',
allx_THEME_URI . '/include/woocommerce/woo-css.css',
array(),
'4.7.0'
);
wp_enqueue_style( 'allx-font-oswald', allx_THEME_URI . '/css/oswald.css' );
wp_enqueue_script(
'allx-navigation',
allx_THEME_URI . '/js/navigation.js',
array(),
'',
true
);
wp_enqueue_script(
'allx-mobile-menu',
allx_THEME_URI . '/js/mobile-menu.js',
array(),
'',
false
);
wp_enqueue_script(
'allx-viewportchecker',
allx_THEME_URI . '/js/viewportchecker.js',
array(),
'',
true
);
wp_enqueue_script(
'allx-top',
allx_THEME_URI . '/js/to-top.js',
array(),
'',
true
);
wp_enqueue_style( 'allx-back-top-css', allx_THEME_URI . '/include/back-to-top/style.css' );
wp_enqueue_script(
'allx-search-top-main-js',
allx_THEME_URI . '/include/back-to-top/main.js',
array(),
'',
true
);
wp_enqueue_script(
'allx-search-top-util-js',
allx_THEME_URI . '/include/back-to-top/util.js',
array(),
'',
true
);
wp_enqueue_script(
'allx-skip-link-focus-fix',
allx_THEME_URI . '/js/skip-link-focus-fix.js',
array(),
'',
true
);
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_localize_script( 'allx-menu', 'menuObject', array(
'menu_position_abs' => esc_html( get_theme_mod( 'menu_position_absolute' ) ),
) );
}
add_action( 'wp_enqueue_scripts', 'allx__scripts' );
function allx_admin_scripts() {
wp_enqueue_style( 'wp-color-picker' );
wp_enqueue_style( 'style-admin-css', allx_THEME_URI . '/css/admin.css' );
wp_enqueue_script( 'admin-js', allx_THEME_URI . '/js/admin.js', array(), '', true );
wp_enqueue_script( 'wp-color-picker-alpha', allx_THEME_URI . '/js/wp-color-picker-alpha.js', array( 'wp-color-picker' ), "", true );
wp_add_inline_script('wp-color-picker-alpha', 'jQuery( function() { jQuery( ".color-picker-alpha-options" ).wpColorPicker(); } );');
}
add_action( 'admin_enqueue_scripts', 'allx_admin_scripts' );
/**
* Includes
*/
require_once allx_THEME_DIR . '/include/content-customizer.php';
require_once allx_THEME_DIR . '/include/custom-header.php';
require_once allx_THEME_DIR . '/include/template-tags.php';
require_once allx_THEME_DIR . '/include/customizer.php';
require_once allx_THEME_DIR . '/include/header-top.php';
require_once allx_THEME_DIR . '/include/read-more-button.php';
require_once allx_THEME_DIR . '/include/animations/animations.php';
require_once allx_THEME_DIR . '/include/menu-options.php';
require_once allx_THEME_DIR . '/include/post-options.php';
require_once allx_THEME_DIR . '/include/color-scheme.php';
require_once allx_THEME_DIR . '/include/back-to-top/back-to-top-button.php';
require_once allx_THEME_DIR . '/include/header-buttons.php';
require_once allx_THEME_DIR . '/include/footer-options.php';
require_once allx_THEME_DIR . '/include/range/range-class.php';
require_once allx_THEME_DIR . '/include/typography.php';
require_once allx_THEME_DIR . '/include/dark-mode/dark-mode.php';
require_once allx_THEME_DIR . '/include/letters/anime.php';
require_once allx_THEME_DIR . '/css/animation-speed.php';
require_once allx_THEME_DIR . '/js/viewportchecker.php';
require_once allx_THEME_DIR . '/include/search-query.php';
require_once allx_THEME_DIR . '/include/categories-options.php';
require_once allx_THEME_DIR . '/include/colors.php';
require_once allx_THEME_DIR . '/include/templates-home/layout-left.php';
require_once allx_THEME_DIR . '/include/templates-home/layout-right.php';
require_once allx_THEME_DIR . '/include/categories-templates.php';
require_once allx_THEME_DIR . '/include/sc.php';
require_once allx_THEME_DIR . '/include/pro/pro.php';
require_once allx_THEME_DIR . '/include/customize-pro/class-customize.php';
if ( class_exists( 'WooCommerce' ) ) {
require_once allx_THEME_DIR . '/include/woocommerce/cart.php';
}
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require_once allx_THEME_DIR . '/include/jetpack.php';
}
/**
* Adds custom classes to the array of body classes.
*/
function allx__body_classes( $classes )
{
// Adds a class of hfeed to non-singular pages.
if ( !is_singular() ) {
$classes[] = 'hfeed';
}
// Adds a class of no-sidebar when there is no sidebar present.
if ( !is_active_sidebar( 'sidebar-1' ) ) {
$classes[] = 'no-sidebar';
}
return $classes;
}
add_filter( 'body_class', 'allx__body_classes' );
function allx__sidebar_position()
{
if ( is_active_sidebar( 'sidebar-1' ) ) {
wp_enqueue_style( 'style-sidebar', allx_THEME_URI . '/layouts/left-sidebar.css' );
}
}
add_action( 'wp_enqueue_scripts', 'allx__sidebar_position' );
/**
* Add a pingback url auto-discovery header for single posts, pages, or attachments.
*/
function allx__pingback_header()
{
if ( is_singular() && pings_open() ) {
printf( '', esc_url( get_bloginfo( 'pingback_url' ) ) );
}
}
add_action( 'wp_head', 'allx__pingback_header' );
/*********************************************************************************************************
* Customizer Styles
**********************************************************************************************************/
function allx__customize_checkbox_styles( $input )
{
?>
-webkit-animation: header-image
s ease-out both;
animation: header-image
s ease-out 0s 1 normal both running;
.
*/
function allx_replace_empty_p( $content )
{
$replace = array(
'' => '
',
);
return strtr( $content, $replace );
}
add_filter( 'the_content', 'allx_replace_empty_p' );
remove_filter( 'widget_text_content', 'wpautop' );