定制
了解如何添加您自己的自定義和了解更多關(guān)于文件層次結(jié)構(gòu)在Warp架構(gòu)中.
提供盡可能多的靈活性,Warp用于一個(gè)特殊的文件顯示形式。如果你包含任何文件像CSS,JS或模板PHP文件,Warp按照先后順序在特定文件夾中加載這些文件,這允許您可以更靈活的來覆蓋任何重要主題相關(guān)的文件。
我們將解釋覆蓋及調(diào)取文件的先后順序。如果你只是想知道,如何覆蓋主題文件,跳下到適當(dāng)?shù)睦印?/p>
OVERRIDE CASCADE
下面的例子,就是覆蓋/ layouts文件夾的層次結(jié)構(gòu)。
1. 樣式文件夾
/styles/STYLE-NAME/layouts 文件夾,是你的主題文件夾層次結(jié)構(gòu)的頂部,您在這里所做修改將覆蓋所有其他主題文件。另外,在更新模板版本后,這個(gè)文件夾也將被保留下來,這是最安全的地方。
2. Theme folder 模板文件夾
模板 /layouts 文件夾存放所有的模板特定的布局。
3. Systems folder 系統(tǒng)文件夾
在 /warp/systems/joomla/layouts 或 /warp/systems/wordpress/layouts 文件夾中,提供CMS獨(dú)立系統(tǒng)所需的特殊整合。這一層使Warp適應(yīng)某些系統(tǒng)為模板發(fā)展形成一個(gè)一致的API。
4. Warp文件夾
在/warp/layouts 包括Warp核心的架構(gòu)文件.核心框架是普遍存在的,并且設(shè)計(jì)的每個(gè)部分工作支持在每個(gè)系統(tǒng)。
The cascades for the /js, /css and /layouts 文件夾定義在config.php文件中.如果你要加載其他css文件夾可以在這里設(shè)置.
LAYOUT OVERRIDES
To customize the general theme layout, you need to override the /layouts/theme.php. To do so, create the /styles/STYLE-NAME/layoutsdirectory, copy the file in there and start adding your own PHP code.
This way you can also override system files. For example, just take the Joomla article layout/warp/systems/joomla/layouts/com_content/article/default.php and copy it to your style folder /styles/STYLE-NAME/layouts/com_content/article/default.php and modify it. Now your modified article layout file will be used instead of the default system layout. The same applies for WordPress files.
ADD YOUR OWN CSS
There are several ways of adding your own custom CSS to a Warp theme. You can use the Customizer to change most aspects of the theme without having to write any CSS. Keep in mind that your style will only be shown in the Customizer, if there is a style.less file inside the style's folder. When you use the Customizer, changes will be saved in the style.less file. Together with the theme LESS files it will be compiled into the/css/theme.css file and override any customizations you may have done.
Add custom CSS
You can use the Customizer and also add your own CSS by creating a custom.css file inside the /css folder for the related style. That way your CSS won't be overwritten when you save changes in the Customizer.
Add CSS without using LESS and the Customizer
If you are not planning to use the Customizer at all, just duplicate an existing style and delete the style.less file. Now the /css/theme.css will no longer be overwritten when compiling LESS. You can write customizations directly in the the theme.css file.
ADD CUSTOM JAVASCRIPT
The configuration file /layouts/theme.config.php initializes all PHP classes and loads the necessary JavaScript. If you need to load custom JavaScript files, this is the place to do it. Enabled compression and Data URI will be applied automatically to all files you add here.
- Create a new file
/styles/STYLE-NAME/layouts/theme.config.php. - Load the original file through PHP by using the require function.
- Then add your JavaScript file to the asset collection, so it will be added automatically to the template header.
- Put your own custom JavaScript file in the
/styles/STYLE-NAME/js/MY-JS.jsdirectory.
<?php
require(__DIR__.'/../../../layouts/theme.config.php');
// add script
$this['asset']->addFile('js','js:MY-JS.js');
CUSTOM TEMPLATE FILES FOR WORDPRESS
You can use different layouts for template files, for example pages, by creating files in your theme folder with the name prefix page- followed by the ID or page-slug.
page-{id}.phppage-{slug}.php
Let's say you want custom content for a page with the ID 80. Create a file in your theme folder and name it page-80.php with the following content.
<?php get_header();?>
Put your content here...
<?php get_footer();?>
在中國(guó)六翼專注Joomla建站與策劃設(shè)計(jì),為您的品牌發(fā)展創(chuàng)造動(dòng)力!





