久青草国产观看在线视频,在线观看欧美日女,777毛片,亚洲国产精品99久久久久久久

WordPress后臺框架options-framework的介紹,locate_template

2018-10-09 wordpress經驗
  • 文章介紹
  • 快速入門
  • 評價&建議

options-framework插件下載?https://WordPress.org/plugins/options-framework/

一般放在當前主題下面。比如yourtheme/includes/framework

然后在function.php調用它。

if ( !function_exists( ‘optionsframework_init’ ) ) {
define( ‘OPTIONS_FRAMEWORK_DIRECTORY’, get_template_directory_uri() . ‘/includes/framework/’ );
require_once dirname(__FILE__).’/includes/framework/options-framework.php’;
}

OPTIONS_FRAMEWORK_DIRECTORY很重要,這個框架要用到的一個常量。

——————

關于options.php這個文件,可以從這里得到:

https://github.com/devinsays/options-framework-theme

https://github.com/devinsays/options-framework-theme/archive/master.zip

在插件的includes/class-options-framework.php有以下代碼:

$location = apply_filters( ‘options_framework_location’, array( ‘options.php’ ) );

…?locate_template( $location ) 這是用來加載options.php的。

后臺的主題選項編輯,主要是在options.php里。

————-

前臺得到值:類似:?$logo_src = of_get_option( ‘website_logo_upload’, ” );

——

關于加入js代碼: 因為后臺不能直接加入js代碼,被認為不安全,那就通過下面代碼的方式來添加:

add_action(‘optionsframework_custom_scripts’, ‘optionsframework_custom_scripts’);
function optionsframework_custom_scripts(){ ?>
<script type=”text/javascript”>
你的js代碼
</script>
<?php
}

 

 

 

 

2 0

企業建站推薦正版商業主題,國內專業團隊開發,完善售后,是您不二選擇。

正版主題商店

主題貓WP建站,累計幫助1300+客戶成功建站,為站長提供支持!

立刻開啟你的建站之旅
QQ在線客服

服務熱線

wordpress建站咨詢