使用 of_get_option($id,$default)
调用设置.
建议你阅读 WordPress轻量级后台框架OptionsFramework使用设置举例
基础设置
类型: text (mini)
of_get_option('example_text_mini'): 默认值
of_get_option('example_text_mini'):<?php echo of_get_option( 'example_text_mini', '空值' ); ?>
类型: text
of_get_option('example_text'): 默认值
of_get_option('example_text'):<?php echo of_get_option( 'example_text', '空值' ); ?>
类型: textarea
of_get_option('example_textarea'): 默认文本
of_get_option('example_textarea'):<?php echo of_get_option( 'example_textarea', '空值' ); ?>
类型: select (mini)
of_get_option('example_select'):
of_get_option('example_select'):<?php echo of_get_option( 'example_select', '空值' ); ?>
类型: select2 (wide)
of_get_option('example_select_wide'):
of_get_option('example_select_wide'): <?php echo of_get_option( 'example_select_wide', '空值' ); ?>
类型: select
of_get_option('example_select_categories'): category id =
of_get_option('example_select_categories'): category id = <?php echo of_get_option( 'example_select_categories', '空值' ); ?>
类型: select
of_get_option('example_select_tags'): term id =
of_get_option('example_select_tags'): term id = <?php echo of_get_option( 'example_select_tags', '空值' ); ?>
类型: select
of_get_option('example_select_pages'): page id =
of_get_option('example_select_pages'): page id = <?php echo of_get_option( 'example_select_pages', '空值' ); ?>
类型: radio
of_get_option('example_radio'):
of_get_option('example_radio'): <?php echo of_get_option( 'example_radio', '空值' ); ?>
类型: checkbox
of_get_option('example_checkbox'):
of_get_option('example_checkbox'): <?php echo of_get_option( 'example_checkbox', '空值' ); ?>
高级设置
类型: uploader
of_get_option('example_uploader'):
of_get_option('example_uploader'): <?php echo of_get_option( 'example_uploader', '空值' ); ?>
<?php if ( of_get_option( 'example_uploader' ) ) { ?>
<img src="<?php echo of_get_option( 'example_uploader' ); ?>" />
<?php } ?>
类型: image
of_get_option('images'): 2c-l-fixed
of_get_option('images'): <?php echo of_get_option( 'example_images', '空值' ); ?>
类型: multicheck
of_get_option('multicheck'): Array ( [one] => 1 [two] => [three] => [four] => [five] => 1 )
of_get_option('multicheck'):
<?php $multicheck = of_get_option( 'example_multicheck', 'none' ); ?>
<?php print_r($multicheck); ?>
类型: background
<?php $background = of_get_option('example_background');
if ( $background ) {
if ( $background['image'] ) {
echo '<span style="display: block; height: 200px; width: 200px; background:url(' . $background['image'] . ') "></span>';
echo '<ul>';
foreach ( $background as $i=> $param ){
echo '<li>'.$i . ' = ' . $param . '</li>';
}
echo '</ul>';
} else {
echo '<span style="display: inline-block; height: 20px; width: 20px; background:' . $background['color'] . ' "></span>';
echo '<ul>';
echo '<li>'.$background['color'].'</li>';
echo '</ul>';
}
} else {
echo "没有值";
}; ?>
类型: typography
<?php $typography = of_get_option('example_typography');
if ( $typography ) {
echo '<ul>';
foreach ( $typography as $i => $param ) {
echo '<li>'.$i . ' = ' . $param . '</li>';
}
echo '</ul>';
echo '<span style="font-family: ' . $typography['face'] . '; font-size:' . $typography['size'] . '; font-style: ' . $typography['style'] . '; color:'.$typography['color'] . ';">Some sample text in your style</span>';
} else {
echo "空值";
} ?>
类型: editor
<?php echo of_get_option( 'example_editor', '空值'); ?>