WordPress Sage Theme Framework Documentation Translation - Installation and Configuration and Functionality Description
Sage is an excellent WordPress framework, it is also very simple to get started, the official document is written very clearly and concisely, the basic English over the program can be read, but in order to let you see more easily and conveniently, I still simply translated, according to the length of the different, may be divided into several articles, you can view as needed. Translation time according to their own understanding and experience, will add some illustrative content, easy to understand and use. The level is limited, there are inappropriate and incorrect translation, welcome to point out in the comments.
Install WordPress Sage Theme Framework
Clone Sage's git repository directly from the WordPress theme directory, or download it from Github and unzip it into the theme directory.
git clone https://github.com/roots/sage.git theme-name
If you are not using Bedrock, you need to add the wp-config.php 文件中加入以下配置。
define('WP_ENV', 'development').;
WordPress Sage Theme Framework Configuration
All configurations for the Sage theme framework are available in the lib/config.php Inside this file, we can enable and disable some of the features of the Sage theme and Soil plugin, some of the default configurations of the theme are as follows.
Enable the code cleanup feature of the Soil plugin:
add_theme_support('soil-clean-up');
Enable the navigation walker feature of the Soil plugin:
add_theme_support('soil-nav-walker');
Enable the relative URL feature of the Soil plugin:
add_theme_support('soil-relative-urls');
Enable the Soil plugin's search URL:
add_theme_support('soil-nice-search');
Enable the Soil plugin's jQuery CDN functionality:
add_theme_support('soil-jquery-cdn');
WordPress Sage Theme Framework Features
functions.php
主要主要用来包含 lib/ folder inside the file , the theme of all the functions are basically defined in this folder , do not add any function in this file , but put the function inside the lib/ folder , and then through the functions.php file to include , this will make the structure of the theme more clear and concise .
Since the Sage theme is a basic theme, you can modify it as much as you want. lib/ 文件夹里面的功能以符合你的需求。
lib/assets.php- Insert the styles and javascript used by the theme into the theme
lib/conditional-tag-check.phpConditionalTagCheck应用类,在主题侧边栏中使用
lib/config.php- 启用/禁用主题功能
lib/extras.php- Theme add-ons that include the ability to add CSS classes to the
<body>on and add ‘read more' links to summaries
lib/gallery.php- Recreating the album shortcode to fit the Bootstrap thumbnails component
lib/init.php- Initialize the theme, register the navigation menu, sidebars, define the core WordPress features supported by the WordPress theme such as: post thumbnails, post formats and HTML5 tags.
lib/nav.php- Clean up redundant HTML tags in navigation menus
lib/titles.php- 控制页面标题输出
lib/utils.php- Redefine the position of the searchform template in the template, some helper functions
lib/wrapper.php- 主题封装
This part is the basic description of the WordPress Sage theme framework, mastered these, we install and configure the Sage theme, simple configuration of some of the features of the Sage theme will be no problem, the next part, I will translate the structure of the Sage theme template and expand the custom template for you.