tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Gutenberg Align wide support.
*/
add_theme_support( 'align-wide' );
/*
* 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(
'menu-1' => esc_html__( 'Primary', 'yuzu' ),
) );
/*
* 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( 'yuzu_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' => 120,
'flex-width' => true,
'flex-height' => true,
) );
}
endif;
add_action( 'after_setup_theme', 'yuzu_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 yuzu_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( 'yuzu_content_width', 640 );
}
add_action( 'after_setup_theme', 'yuzu_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function yuzu_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Footer · Left', 'yuzu' ),
'id' => 'footer-left',
'description' => esc_html__( 'Add widgets here.', 'yuzu' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer · Middle', 'yuzu' ),
'id' => 'footer-middle',
'description' => esc_html__( 'Add widgets here.', 'yuzu' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer · Right', 'yuzu' ),
'id' => 'footer-right',
'description' => esc_html__( 'Add widgets here.', 'yuzu' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'yuzu_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function yuzu_scripts() {
$ver_num = mt_rand();
wp_enqueue_style( 'yuzu-custom-properties', get_template_directory_uri() . '/assets/css/custom-properties.css', array(), $ver_num );
wp_enqueue_style( 'yuzu-style', get_stylesheet_uri(), array(), $ver_num );
wp_enqueue_script( 'jquery' );
wp_enqueue_script( 'main-js', get_template_directory_uri() . '/assets/js/main.js', array('jquery'), $ver_num, true );
$dataToBePassed = array(
'enable_posts_height_equalizer' => get_theme_mod('enable_posts_height_equalizer', true),
'test' => 'test'
);
wp_localize_script( 'main-js', 'php_vars', $dataToBePassed );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'yuzu_scripts' );
/**
* Registers an editor stylesheet for the theme.
*/
function yuzu_add_editor_styles() {
add_editor_style( 'editor-style.css' );
}
add_action( 'admin_init', 'yuzu_add_editor_styles' );
function legit_block_editor_styles() {
wp_enqueue_style( 'legit-editor-styles', get_theme_file_uri( '/assets/css/editor-style.css' ), false, '1.0', 'all' );
}
add_action( 'enqueue_block_editor_assets', 'legit_block_editor_styles' );
/**
* Apply Color Scheme Class
*/
add_filter( 'body_class', 'apply_theme_color_scheme');
function apply_theme_color_scheme( $classes ) {
$classes[] = get_theme_mod('color_scheme', 'light') . '-theme';
return $classes;
}
/**
* Reduce excerpt length
*/
add_filter( 'excerpt_length', function($length) {
return 25;
} );
/**
* Load Meow Blocks Output
*/
require get_template_directory() . '/inc/meow-blocks-output.php';
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.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/custom-controls.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Apply Customizer Colors.
*/
require get_template_directory() . '/inc/apply-colors.php';
/**
* Load Jetpack compatibility file.
*/
if ( defined( 'JETPACK__VERSION' ) ) {
require get_template_directory() . '/inc/jetpack.php';
}
/**
* Custom comment template
*/
function yuzu_comment_template($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
id="li-comment-">
is_search ) {
$query->set( 'post_type', array( 'post', 'attachment', 'meow_collection' ) );
$query->set( 'post_status', array( 'publish', 'inherit' ) );
$query->set( 'posts_per_page', '-1');
}
return $query;
}
add_filter( 'pre_get_posts', 'attachment_search' );
require_once( get_template_directory() . '/class-tgm-plugin-activation.php');
add_action( 'tgmpa_register', 'yuzu_register_required_plugins' );
/**
* Register the required plugins for this theme.
*
*
*
* This function is hooked into tgmpa_init, which is fired within the
* TGM_Plugin_Activation class constructor.
*/
function yuzu_register_required_plugins() {
/*
* Array of plugin arrays. Required keys are name and slug.
* If the source is NOT from the .org repo, then source is also required.
*/
$plugins = array(
// This is an example of how to include a plugin from the WordPress Plugin Repository.
array(
'name' => 'Photography Core',
'slug' => 'photography-core',
'required' => false,
),
array(
'name' => 'WP/LR Sync',
'slug' => 'wplr-sync',
'required' => false,
),
array(
'name' => 'Meow Gallery',
'slug' => 'meow-gallery',
'is_callable' => array( 'Meow_Gallery_Core', 'installed' ),
'required' => false,
),
array(
'name' => 'Meow Lightbox',
'slug' => 'meow-lightbox',
'is_callable' => array( 'Meow_Lightbox_Core', 'installed' ),
'required' => false,
)
);
/*
* Array of configuration settings. Amend each line as needed.
*
* TGMPA will start providing localized text strings soon. If you already have translations of our standard
* strings available, please help us make TGMPA even better by giving us access to these translations or by
* sending in a pull-request with .po file(s) with the translations.
*
* Only uncomment the strings in the config array if you want to customize the strings.
*/
$config = array(
'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA.
'default_path' => '', // Default absolute path to bundled plugins.
'menu' => 'tgmpa-install-plugins', // Menu slug.
'parent_slug' => 'themes.php', // Parent menu slug.
'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used.
'has_notices' => true, // Show admin notices or not.
'dismissable' => true, // If false, a user cannot dismiss the nag message.
'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag.
'is_automatic' => false, // Automatically activate plugins after installation or not.
'message' => '', // Message to output right before the plugins table.
);
tgmpa( $plugins, $config );
}
/*
MEOW APPS LICENSE
*/
global $meowapps_theme_version;
$meowapps_theme_version = '0.1.0';
function prefix_theme_updater() {
require( get_template_directory() . '/updater/yuzu-updater.php' );
}
add_action( 'after_setup_theme', 'prefix_theme_updater' );