本文整理汇总了PHP中wpgrade::display_dynamic_css_rule方法的典型用法代码示例。如果您正苦于以下问题:PHP wpgrade::display_dynamic_css_rule方法的具体用法?PHP wpgrade::display_dynamic_css_rule怎么用?PHP wpgrade::display_dynamic_css_rule使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wpgrade
的用法示例。
在下文中一共展示了wpgrade::display_dynamic_css_rule方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
/* for PRO users! - *
* Generate all the css declared in customizer's config
* ====== DO NOT EDIT BELOW!!! =======
* If you need to add custom css rules add them above so we can keep track of them
*/
$redux_sections = wpgrade::get_redux_sections();
if (is_array($redux_sections) || is_object($redux_sections)) {
foreach ($redux_sections as $key => $section) {
if (isset($section['fields'])) {
foreach ($section['fields'] as $i => $field) {
if (isset($field['customizer']) && isset($field['customizer']['css_rules'])) {
foreach ($field['customizer']['css_rules'] as $key => $rule) {
//rebuild the option value for each rule
$option_value = wpgrade::option($field['id']);
// @TODO make from this a method used also in customizer
wpgrade::display_dynamic_css_rule($rule, $key, $option_value);
}
}
}
}
}
}
/* for PRO users! - *
*======= TYPOGRAPHY
*/
$fonts = array();
if (wpgrade::option('use_google_fonts')) {
$fonts_array = array('google_titles_font', 'google_subtitles_font', 'google_nav_font', 'google_body_font');
foreach ($fonts_array as $font) {
$the_font = wpgrade::get_the_typo($font);
if (isset($the_font['font-family']) && !empty($the_font['font-family'])) {
示例2: header_output
/**
* This will output the custom WordPress settings to the live theme's WP head.
* Used by hook: 'wp_head'
* @see add_action('wp_head',$func)
* @since MyTheme 1.0
*/
public function header_output()
{
if (!isset($GLOBALS['wp_customize'])) {
return;
}
// iterate through options and setup an style for those who need an embeded style
foreach ($this->parent->sections as $key => $section) {
// Not a type that should go on the customizer
if (empty($section['fields']) || isset($section['type']) && $section['type'] == "divide") {
continue;
}
// If section customizer is set to false
if (isset($section['customizer']) && $section['customizer'] === false) {
continue;
}
foreach ($section['fields'] as $skey => $option) {
if (isset($option['customizer']) && $option['customizer'] === false) {
continue;
}
if ($this->parent->args['customizer'] === false && (!isset($option['customizer']) || !is_array($option['customizer']))) {
continue;
}
// @TODO maybe refactor here
if (!isset($option['customizer']) || !is_array($option['customizer'])) {
continue;
}
// to localize setting
$tlcs = array();
if (isset($option['customizer']['selector'])) {
$tlcs['selector'] = $option['customizer']['selector'];
}
if (isset($option['customizer']['rules'])) {
$tlcs['rules'] = $option['customizer']['rules'];
}
if (isset($option['customizer']['css_rules'])) {
$tlcs['css_rules'] = $option['customizer']['css_rules'];
}
if (isset($option['customizer']['transport'])) {
$tlcs['transport'] = $option['customizer']['transport'];
}
if (isset($option['type'])) {
$tlcs['type'] = $option['type'];
}
if (!isset($tlcs['css_rules']) || !is_array($tlcs['css_rules'])) {
continue;
}
// $option_value = wpgrade::option( $option['id'], $option['default'] );// ( isset($option['value'] ) ) ? $option['value'] : $option['default'];
?>
<style id="<?php
echo $option['id'];
?>
" type="text/css"><?php
foreach ($tlcs['css_rules'] as $key => $rule) {
// rebuild the option value for each rule
$option_value = wpgrade::option($option['id']);
// get the rule
wpgrade::display_dynamic_css_rule($rule, $key, $option_value, $important = false);
}
?>
</style>
<?php
}
}
}