css 儿童主题的例子
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了css 儿童主题的例子相关的知识,希望对你有一定的参考价值。
/**
* Use a child theme : http://codex.wordpress.org/Child_Themes
*/
const MAIN_CSS_FILE = '/style.css';
const CUSTOM_CSS_FILE = '/css/Euroserum.css';
const BUTTONS_CSS_FILE = '/css/buttons.css';
const CUSTOM_JS_FILE = '/js/euroserum.js';
const CUSTOM_CSSFIX_FILE = '/css/euroserum-fix.css';
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which
* runs before the init hook. The init hook is too late for some features, such
* as indicating support for post thumbnails.
*/
if (!function_exists('child_theme_setup')) {
function child_theme_setup()
{
/**
* Load custom language file
*/
load_theme_textdomain('lang-euroserum', get_stylesheet_directory() . '/language/');
/**
* Registers a menu area
*/
register_nav_menus(array(
'footer' => __('Footer Menu', 'lang-euroserum'),
));
/**
* Change post-thumbnails (header img) size
* @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
set_post_thumbnail_size(0, 0, false);
/**
* This theme styles the visual editor to resemble the theme style
*/
add_editor_style(get_stylesheet_directory_uri() . CUSTOM_CSS_FILE);
}
}
add_action('after_setup_theme', 'child_theme_setup');
/**
* Add parent theme style and custom css files
*/
function child_theme_styles()
{
// Load Parent theme CSS
/*
$parent_style = 'twentysixteen-style';
wp_enqueue_style($parent_style, get_template_directory_uri() . MAIN_CSS_FILE);
wp_enqueue_style('twentysixteen-child', get_stylesheet_directory_uri() . MAIN_CSS_FILE, array($parent_style));
*/
// Load Child theme CSS
wp_enqueue_style('twentysixteen-child', get_stylesheet_directory_uri() . MAIN_CSS_FILE, array());
// Load project CSS
wp_enqueue_style('buttons');
wp_enqueue_style('euroserum-style', get_stylesheet_directory_uri() . CUSTOM_CSS_FILE, array('buttons'));
wp_enqueue_style('euroserum-fix-style', get_stylesheet_directory_uri() . CUSTOM_CSSFIX_FILE, array('euroserum-style'));
}
/**
* Add custom js files
*/
function child_theme_javascripts()
{
wp_enqueue_script('euroserum', get_stylesheet_directory_uri() . CUSTOM_JS_FILE, array('jquery', 'bootstrap-all-min'), false, true);
}
/**
* Enqueue custom scripts
*/
function child_theme_enqueue_scripts()
{
child_theme_styles();
child_theme_javascripts();
}
add_action('wp_enqueue_scripts', 'child_theme_enqueue_scripts');
function child_theme_remove_menus()
{
//remove_menu_page('index.php'); // Dashboard
//remove_menu_page('jetpack'); // Jetpack*
remove_menu_page('edit.php'); // Posts
//remove_menu_page('upload.php'); // Media
//remove_menu_page('edit.php?post_type=page'); // Pages
remove_menu_page('edit-comments.php'); // Comments
//remove_menu_page('themes.php'); // Appearance
//remove_menu_page('plugins.php'); // Plugins
//remove_menu_page('users.php'); // Users
remove_menu_page('tools.php'); // Tools
//remove_menu_page('options-general.php'); // Settings
}
add_action('admin_menu', 'child_theme_remove_menus', 999);
/**
* Add custom URL rewrite with parameters
*/
function child_theme_url_rewrite()
{
global $wp_rewrite;
// Réécriture pour les pages "Domaine d'activité"
add_rewrite_tag('%selectedProduct%', '([^&]+)');
$wp_rewrite->add_rule(
'pour-vos-recettes/alimentation-infantile/([-a-z0-9]+)',
'index.php?pagename=alimentation-infantile&selectedProduct=$matches[1]',
'top'
);
$wp_rewrite->add_rule(
'pour-vos-recettes/industrie-agro-alimentaire/([-a-z0-9]+)',
'index.php?pagename=industrie-agro-alimentaire&selectedProduct=$matches[1]',
'top'
);
$wp_rewrite->flush_rules();
}
add_action('init', 'child_theme_url_rewrite');
/*
Theme Name: Twenty Sixteen Child
Template: twentysixteen
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Text Domain: twentysixteen-child
*/
以上是关于css 儿童主题的例子的主要内容,如果未能解决你的问题,请参考以下文章
css WordPress - 儿童主题 - style.css模板