本文整理汇总了PHP中layers_is_light_or_dark函数的典型用法代码示例。如果您正苦于以下问题:PHP layers_is_light_or_dark函数的具体用法?PHP layers_is_light_or_dark怎么用?PHP layers_is_light_or_dark使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了layers_is_light_or_dark函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: widget
/**
* Widget front end display
*/
function widget($args, $instance)
{
global $wp_customize;
// Turn $args array into variables.
extract($args);
// $instance Defaults
$instance_defaults = $this->defaults;
// If we have information in this widget, then ignore the defaults
if (!empty($instance)) {
$instance_defaults = array();
}
$widget = wp_parse_args($instance, $instance_defaults);
// Check if we have a map present
if (isset($widget['show_google_map']) && ('' != $widget['google_maps_location'] || '' != $widget['google_maps_long_lat'])) {
$hasmap = true;
}
// Set the background styling
if (!empty($widget['design']['background'])) {
layers_inline_styles('#' . $widget_id, 'background', array('background' => $widget['design']['background']));
}
if (!empty($widget['design']['fonts']['color'])) {
layers_inline_styles('#' . $widget_id, 'color', array('selectors' => array('.section-title h3.heading', '.section-title div.excerpt', '.section-title small', '.form.content', 'form p', 'form label'), 'color' => $widget['design']['fonts']['color']));
}
// Apply the advanced widget styling
$this->apply_widget_advanced_styling($widget_id, $widget);
// Set the map & form widths
if (isset($hasmap)) {
$form_class = 'span-6';
} else {
$form_class = 'span-12';
}
$mapwidth = 'span-12';
// Set Display Variables
$show_address_or_contactform = '' != $widget['address_shown'] && isset($widget['show_address']) || $this->check_and_return($widget, 'contact_form') && $this->check_and_return($widget, 'show_contact_form') ? TRUE : FALSE;
$show_title_or_excerpt = '' != $widget['title'] || '' != $widget['excerpt'] ? TRUE : FALSE;
/**
* Generate the widget container class
*/
$widget_container_class = array();
$widget_container_class[] = 'widget';
$widget_container_class[] = 'row';
$widget_container_class[] = 'content-vertical-massive';
$widget_container_class[] = 'layers-contact-widget';
$widget_container_class[] = $this->check_and_return($widget, 'design', 'advanced', 'customclass');
$widget_container_class[] = $this->get_widget_spacing_class($widget);
if (!$show_title_or_excerpt && !$show_address_or_contactform) {
$widget_container_class[] = 'no-inset-top no-inset-bottom';
}
$widget_container_class = implode(' ', apply_filters('layers_contact_widget_container_class', $widget_container_class));
?>
<section class="<?php
echo $widget_container_class;
?>
" id="<?php
echo $widget_id;
?>
">
<?php
if ($show_title_or_excerpt) {
?>
<div class="container clearfix">
<?php
/**
* Generate the Section Title Classes
*/
$section_title_class = array();
$section_title_class[] = 'section-title clearfix';
$section_title_class[] = $this->check_and_return($widget, 'design', 'fonts', 'size');
$section_title_class[] = $this->check_and_return($widget, 'design', 'fonts', 'align');
$section_title_class[] = $this->check_and_return($widget, 'design', 'background', 'color') && 'dark' == layers_is_light_or_dark($this->check_and_return($widget, 'design', 'background', 'color')) ? 'invert' : '';
$section_title_class = implode(' ', $section_title_class);
?>
<div class="<?php
echo $section_title_class;
?>
">
<?php
if ('' != $widget['title']) {
?>
<h3 class="heading"><?php
echo $widget['title'];
?>
</h3>
<?php
}
?>
<?php
if ('' != $widget['excerpt']) {
?>
<div class="excerpt"><?php
echo $widget['excerpt'];
?>
</div>
<?php
}
?>
//.........这里部分代码省略.........
示例2: widget
/**
* Widget front end display
*/
function widget($args, $instance)
{
// Turn $args array into variables.
extract($args);
// $instance Defaults
$instance_defaults = $this->defaults;
// If we have information in this widget, then ignore the defaults
if (!empty($instance)) {
$instance_defaults = array();
}
// Parse $instance
$widget = wp_parse_args($instance, $instance_defaults);
// Enqueue Masonry if need be
if ('list-masonry' == $this->check_and_return($widget, 'design', 'liststyle')) {
$this->enqueue_masonry();
}
// Set the background styling
if (!empty($widget['design']['background'])) {
layers_inline_styles('#' . $widget_id, 'background', array('background' => $widget['design']['background']));
}
if (!empty($widget['design']['fonts']['color'])) {
layers_inline_styles('#' . $widget_id, 'color', array('selectors' => array('.section-title h3.heading', '.section-title div.excerpt'), 'color' => $widget['design']['fonts']['color']));
}
// Apply the advanced widget styling
$this->apply_widget_advanced_styling($widget_id, $widget);
/**
* Generate the widget container class
*/
$widget_container_class = array();
$widget_container_class[] = 'widget';
$widget_container_class[] = 'row';
$widget_container_class[] = 'content-vertical-massive';
$widget_container_class[] = $this->check_and_return($widget, 'design', 'advanced', 'customclass');
$widget_container_class[] = $this->get_widget_spacing_class($widget);
$widget_container_class = implode(' ', apply_filters('layers_content_widget_container_class', $widget_container_class));
?>
<section class="<?php
echo $widget_container_class;
?>
" id="<?php
echo $widget_id;
?>
">
<?php
if ('' != $this->check_and_return($widget, 'title') || '' != $this->check_and_return($widget, 'excerpt')) {
?>
<div class="container clearfix">
<?php
/**
* Generate the Section Title Classes
*/
$section_title_class = array();
$section_title_class[] = 'section-title clearfix';
$section_title_class[] = $this->check_and_return($widget, 'design', 'fonts', 'size');
$section_title_class[] = $this->check_and_return($widget, 'design', 'fonts', 'align');
$section_title_class[] = $this->check_and_return($widget, 'design', 'background', 'color') && 'dark' == layers_is_light_or_dark($this->check_and_return($widget, 'design', 'background', 'color')) ? 'invert' : '';
$section_title_class = implode(' ', $section_title_class);
?>
<div class="<?php
echo $section_title_class;
?>
">
<?php
if ('' != $widget['title']) {
?>
<h3 class="heading"><?php
echo $widget['title'];
?>
</h3>
<?php
}
?>
<?php
if ('' != $widget['excerpt']) {
?>
<div class="excerpt"><?php
echo $widget['excerpt'];
?>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
<?php
if (!empty($widget['columns'])) {
?>
<div class="row <?php
echo $this->get_widget_layout_class($widget);
?>
<?php
echo $this->check_and_return($widget, 'design', 'liststyle');
?>
//.........这里部分代码省略.........
示例3: widget
//.........这里部分代码省略.........
$layers_post_meta_to_display[] = 'tags';
}
/**
* Generate the widget container class
*/
$widget_container_class = array();
$widget_container_class[] = 'widget';
$widget_container_class[] = 'row';
$widget_container_class[] = 'content-vertical-massive';
$widget_container_class[] = $this->check_and_return($widget, 'design', 'advanced', 'customclass');
$widget_container_class[] = $this->get_widget_spacing_class($widget);
$widget_container_class = implode(' ', apply_filters('layers_post_widget_container_class', $widget_container_class));
?>
<section class=" <?php
echo $widget_container_class;
?>
" id="<?php
echo $widget_id;
?>
">
<?php
if ('' != $this->check_and_return($widget, 'title') || '' != $this->check_and_return($widget, 'excerpt')) {
?>
<div class="container clearfix">
<?php
/**
* Generate the Section Title Classes
*/
$section_title_class = array();
$section_title_class[] = 'section-title clearfix';
$section_title_class[] = $this->check_and_return($widget, 'design', 'fonts', 'size');
$section_title_class[] = $this->check_and_return($widget, 'design', 'fonts', 'align');
$section_title_class[] = $this->check_and_return($widget, 'design', 'background', 'color') && 'dark' == layers_is_light_or_dark($this->check_and_return($widget, 'design', 'background', 'color')) ? 'invert' : '';
$section_title_class = implode(' ', $section_title_class);
?>
<div class="<?php
echo $section_title_class;
?>
">
<?php
if ('' != $widget['title']) {
?>
<h3 class="heading"><?php
echo $widget['title'];
?>
</h3>
<?php
}
?>
<?php
if ('' != $widget['excerpt']) {
?>
<div class="excerpt"><?php
echo $widget['excerpt'];
?>
</div>
<?php
}
?>
</div>
</div>
<?php
}
?>
<div class="row <?php
示例4: layers_get_light_or_dark
function layers_get_light_or_dark($color, $if_dark, $if_light)
{
if ('dark' == layers_is_light_or_dark($color)) {
return $if_light;
} elseif ('light' == layers_is_light_or_dark($color)) {
return $if_dark;
}
}
示例5: widget
//.........这里部分代码省略.........
// Make sure we've got a column going on here
if (!isset($widget['slides'][$slide_key])) {
continue;
}
// Setup the relevant slide
$slide = $widget['slides'][$slide_key];
// Set the background styling
if (!empty($slide['design']['background'])) {
layers_inline_styles('#' . $widget_id . '-' . $slide_key, 'background', array('background' => $slide['design']['background']));
}
if (!empty($slide['design']['fonts']['color'])) {
layers_inline_styles('#' . $widget_id . '-' . $slide_key, 'color', array('selectors' => array('h3.heading', 'h3.heading a', 'div.excerpt'), 'color' => $slide['design']['fonts']['color']));
}
if (!empty($slide['design']['fonts']['shadow'])) {
layers_inline_styles('#' . $widget_id . '-' . $slide_key, 'text-shadow', array('selectors' => array('h3.heading', 'h3.heading a', 'div.excerpt'), 'text-shadow' => $slide['design']['fonts']['shadow']));
}
// Set Featured Media
$featureimage = $this->check_and_return($slide, 'design', 'featuredimage');
$featurevideo = $this->check_and_return($slide, 'design', 'featuredvideo');
// Set Image Sizes
if (isset($slide['design']['imageratios'])) {
// Translate Image Ratio into something usable
$image_ratio = layers_translate_image_ratios($slide['design']['imageratios']);
$use_image_ratio = $image_ratio . '-medium';
} else {
$use_image_ratio = 'large';
}
/**
* Set Individual Slide CSS
*/
$slide_class = array();
$slide_class[] = 'swiper-slide';
if ($this->check_and_return($slide, 'design', 'background', 'color')) {
if ('dark' == layers_is_light_or_dark($this->check_and_return($slide, 'design', 'background', 'color'))) {
$slide_class[] = 'invert';
}
} else {
$slide_class[] = 'invert';
}
if (false != $this->check_and_return($slide, 'image') || 'image-left' == $slide['design']['imagealign'] || 'image-top' == $slide['design']['imagealign']) {
$slide_class[] = 'has-image';
}
if (isset($slide['design']['imagealign']) && '' != $slide['design']['imagealign']) {
$slide_class[] = $slide['design']['imagealign'];
}
if (isset($slide['design']['fonts']['align']) && '' != $slide['design']['fonts']['align']) {
$slide_class[] = $slide['design']['fonts']['align'];
}
$slide_class = implode(' ', $slide_class);
// Set link entire slide or not
$slide_wrapper_tag = 'div';
$slide_wrapper_href = '';
if ($this->check_and_return($slide, 'link') && !$this->check_and_return($slide, 'link_text')) {
$slide_wrapper_tag = 'a';
$slide_wrapper_href = 'href="' . esc_url($slide['link']) . '"';
}
?>
<<?php
echo $slide_wrapper_tag;
?>
<?php
echo $slide_wrapper_href;
?>
class="<?php
echo $slide_class;
?>
示例6: layers_inline_button_styles
function layers_inline_button_styles($container_id = NULL, $type = 'background', $args = array())
{
// Auto text color based on background color
if (isset($args['button']['background-color']) && NULL !== layers_is_light_or_dark($args['button']['background-color'])) {
// temporarily darken the background color, so we only switch text color if very light
$background_darker = layers_hex_darker($args['button']['background-color'], 28);
if ('light' == layers_is_light_or_dark($background_darker)) {
$args['button']['color'] = 'rgba(0,0,0,.85)';
} else {
if ('dark' == layers_is_light_or_dark($background_darker)) {
$args['button']['color'] = '#FFFFFF';
}
}
}
// Add styling for the standard colors
layers_inline_styles($container_id, $type, $args);
// Add styling for the hover colors
if (isset($args['selectors'])) {
if (!is_array($args['selectors'])) {
// Make sure selectors is array if comma seperated string is passed
$args['selectors'] = explode(',', $args['selectors']);
$args['selectors'] = array_map('trim', $args['selectors']);
}
$hover_args = $args;
foreach ($args['selectors'] as $selector) {
$new_selectors[] = $selector . ':hover';
}
$hover_args['selectors'] = $new_selectors;
}
// Generate a lighter text background color
if (isset($args['button']['background-color'])) {
$hover_args['button']['background-color'] = layers_hex_lighter($args['button']['background-color']);
}
// Apply hover colors
if (isset($hover_args)) {
layers_inline_styles($container_id, $type, $hover_args);
}
}
示例7: widget
/**
* Widget front end display
*/
function widget($args, $instance)
{
global $wp_customize;
$this->backup_inline_css();
// Turn $args array into variables.
extract($args);
// Use defaults if $instance is empty.
if (empty($instance) && !empty($this->defaults)) {
$instance = wp_parse_args($instance, $this->defaults);
}
// Mix in new/unset defaults on every instance load (NEW)
$instance = $this->apply_defaults($instance);
// Check if we have a map present
if (isset($instance['show_google_map']) && ('' != $instance['google_maps_location'] || '' != $instance['google_maps_long_lat'])) {
$hasmap = true;
}
// Set the background styling
if (!empty($instance['design']['background'])) {
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'background', array('background' => $instance['design']['background']));
}
if (!empty($instance['design']['fonts']['color'])) {
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'color', array('selectors' => array('.section-title .heading', '.section-title div.excerpt', '.section-title small', '.form.content', 'form p', 'form label'), 'color' => $instance['design']['fonts']['color']));
}
// Set the map & form widths
if (isset($hasmap)) {
$form_class = 'span-6';
} else {
$form_class = 'span-12';
}
$mapwidth = 'span-12';
// Set Display Variables
$show_address_or_contactform = '' != $instance['address_shown'] && isset($instance['show_address']) || $this->check_and_return($instance, 'contact_form') && $this->check_and_return($instance, 'show_contact_form') ? TRUE : FALSE;
$show_title_or_excerpt = '' != $instance['title'] || '' != $instance['excerpt'] ? TRUE : FALSE;
// Apply the advanced widget styling
$this->apply_widget_advanced_styling($widget_id, $instance);
/**
* Generate the widget container class
*/
$widget_container_class = array();
$widget_container_class[] = 'widget';
$widget_container_class[] = 'layers-contact-widget';
$widget_container_class[] = 'clearfix';
$widget_container_class[] = 'content-vertical-massive';
$widget_container_class[] = 'layers-contact-widget';
$widget_container_class[] = 'on' == $this->check_and_return($instance, 'design', 'background', 'darken') ? 'darken' : '';
$widget_container_class[] = $this->check_and_return($instance, 'design', 'advanced', 'customclass');
// Apply custom class from design-bar's advanced control.
$widget_container_class[] = $this->get_widget_spacing_class($instance);
if (!$show_title_or_excerpt && !$show_address_or_contactform) {
$widget_container_class[] = 'no-inset-top no-inset-bottom';
}
$widget_container_class = apply_filters('layers_contact_widget_container_class', $widget_container_class, $this, $instance);
$widget_container_class = implode(' ', $widget_container_class);
// Custom Anchor
echo $this->custom_anchor($instance);
?>
<div id="<?php
echo esc_attr($widget_id);
?>
" class="<?php
echo esc_attr($widget_container_class);
?>
" <?php
$this->selective_refresh_atts($args);
?>
>
<?php
do_action('layers_before_contact_widget_inner', $this, $instance);
?>
<?php
if ($show_title_or_excerpt) {
?>
<div class="container clearfix">
<?php
/**f
* Generate the Section Title Classes
*/
$section_title_class = array();
$section_title_class[] = 'section-title clearfix';
$section_title_class[] = $this->check_and_return($instance, 'design', 'fonts', 'size');
$section_title_class[] = $this->check_and_return($instance, 'design', 'fonts', 'align');
$section_title_class[] = $this->check_and_return($instance, 'design', 'background', 'color') && 'dark' == layers_is_light_or_dark($this->check_and_return($instance, 'design', 'background', 'color')) ? 'invert' : '';
$section_title_class = implode(' ', $section_title_class);
?>
<div class="<?php
echo $section_title_class;
?>
">
<?php
if ('' != $this->check_and_return($instance, 'title')) {
?>
<<?php
echo $this->check_and_return($instance, 'design', 'fonts', 'heading-type');
?>
//.........这里部分代码省略.........
示例8: widget
//.........这里部分代码省略.........
if (!empty($item_instance['design']['fonts']['color'])) {
$this->inline_css .= layers_inline_styles('#' . $widget_id . '-' . $slide_key, 'color', array('selectors' => array('.heading', '.heading a', 'div.excerpt'), 'color' => $item_instance['design']['fonts']['color']));
}
if (!empty($item_instance['design']['fonts']['shadow'])) {
$this->inline_css .= layers_inline_styles('#' . $widget_id . '-' . $slide_key, 'text-shadow', array('selectors' => array('.heading', '.heading a', 'div.excerpt'), 'text-shadow' => $item_instance['design']['fonts']['shadow']));
}
// Set the button styling
$button_size = '';
if (function_exists('layers_pro_apply_widget_button_styling')) {
$button_size = $this->check_and_return($item_instance, 'design', 'buttons-size') ? 'btn-' . $this->check_and_return($item_instance, 'design', 'buttons-size') : '';
$this->inline_css .= layers_pro_apply_widget_button_styling($this, $item_instance, array("#{$widget_id}-{$slide_key} .button"));
}
// Set Featured Media
$featureimage = $this->check_and_return($item_instance, 'design', 'featuredimage');
$featurevideo = $this->check_and_return($item_instance, 'design', 'featuredvideo');
// Set Image Sizes
if (isset($item_instance['design']['imageratios'])) {
// Translate Image Ratio into something usable
$image_ratio = layers_translate_image_ratios($item_instance['design']['imageratios']);
$use_image_ratio = $image_ratio . '-medium';
} else {
$use_image_ratio = 'large';
}
// Get the button array.
$link_array = $this->check_and_return_link($item_instance, 'button');
$link_href_attr = $link_array['link'] ? 'href="' . esc_url($link_array['link']) . '"' : '';
$link_target_attr = '_blank' == $link_array['target'] ? 'target="_blank"' : '';
/**
* Set Individual Slide CSS
*/
$slide_class = array();
$slide_class[] = 'swiper-slide';
if ($this->check_and_return($item_instance, 'design', 'background', 'color')) {
if ('dark' == layers_is_light_or_dark($this->check_and_return($item_instance, 'design', 'background', 'color'))) {
$slide_class[] = 'invert';
}
} else {
$slide_class[] = 'invert';
}
if (false != $this->check_and_return($item_instance, 'image') || 'image-left' == $item_instance['design']['imagealign'] || 'image-top' == $item_instance['design']['imagealign']) {
$slide_class[] = 'has-image';
}
if (isset($item_instance['design']['imagealign']) && '' != $item_instance['design']['imagealign']) {
$slide_class[] = $item_instance['design']['imagealign'];
}
if (isset($item_instance['design']['fonts']['align']) && '' != $item_instance['design']['fonts']['align']) {
$slide_class[] = $item_instance['design']['fonts']['align'];
}
$slide_class[] = $this->check_and_return($item_instance, 'design', 'advanced', 'customclass');
// Apply custom class from design-bar's advanced control.
$slide_class = apply_filters('layers_slider_widget_item_class', $slide_class, $this, $item_instance, $instance);
$slide_class = implode(' ', $slide_class);
// Set link entire slide or not
$slide_wrapper_tag = 'div';
$slide_wrapper_href = '';
if ($link_array['link'] && !$link_array['text']) {
$slide_wrapper_tag = 'a';
$slide_wrapper_href = $link_href_attr;
}
?>
<<?php
echo $slide_wrapper_tag;
?>
<?php
echo $slide_wrapper_href;
?>
示例9: widget
/**
* Widget front end display
*/
function widget($args, $instance)
{
global $wp_customize;
$this->backup_inline_css();
// Turn $args array into variables.
extract($args);
// Use defaults if $instance is empty.
if (empty($instance) && !empty($this->defaults)) {
$instance = wp_parse_args($instance, $this->defaults);
}
// Mix in new/unset defaults on every instance load (NEW)
$instance = $this->apply_defaults($instance);
// Enqueue Masonry if need be
if ('list-masonry' == $this->check_and_return($instance, 'design', 'liststyle')) {
wp_enqueue_script(LAYERS_THEME_SLUG . '-layers-masonry-js');
}
// Set the background styling
if (!empty($instance['design']['background'])) {
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'background', array('background' => $instance['design']['background']));
}
if (!empty($instance['design']['fonts']['color'])) {
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'color', array('selectors' => array('.section-title .heading', '.section-title div.excerpt'), 'color' => $instance['design']['fonts']['color']));
}
// Apply the advanced widget styling
$this->apply_widget_advanced_styling($widget_id, $instance);
/**
* Generate the widget container class
*/
$widget_container_class = array();
$widget_container_class[] = 'widget';
$widget_container_class[] = 'layers-content-widget';
$widget_container_class[] = 'content-vertical-massive';
$widget_container_class[] = 'on' == $this->check_and_return($instance, 'design', 'background', 'darken') ? 'darken' : '';
$widget_container_class[] = $this->check_and_return($instance, 'design', 'advanced', 'customclass');
// Apply custom class from design-bar's advanced control.
$widget_container_class[] = $this->get_widget_spacing_class($instance);
$widget_container_class = apply_filters('layers_content_widget_container_class', $widget_container_class, $this, $instance);
$widget_container_class = implode(' ', $widget_container_class);
// Custom Anchor
echo $this->custom_anchor($instance);
?>
<div id="<?php
echo esc_attr($widget_id);
?>
" class="<?php
echo esc_attr($widget_container_class);
?>
" <?php
$this->selective_refresh_atts($args);
?>
>
<?php
do_action('layers_before_content_widget_inner', $this, $instance);
?>
<?php
if (NULL !== $this->check_and_return($instance, 'title') || NULL !== $this->check_and_return($instance, 'excerpt')) {
?>
<div class="container clearfix">
<?php
/**
* Generate the Section Title Classes
*/
$section_title_class = array();
$section_title_class[] = 'section-title clearfix';
$section_title_class[] = $this->check_and_return($instance, 'design', 'fonts', 'size');
$section_title_class[] = $this->check_and_return($instance, 'design', 'fonts', 'align');
$section_title_class[] = $this->check_and_return($instance, 'design', 'background', 'color') && 'dark' == layers_is_light_or_dark($this->check_and_return($instance, 'design', 'background', 'color')) ? 'invert' : '';
$section_title_class = implode(' ', $section_title_class);
?>
<div class="<?php
echo $section_title_class;
?>
">
<?php
if ('' != $this->check_and_return($instance, 'title')) {
?>
<<?php
echo $this->check_and_return($instance, 'design', 'fonts', 'heading-type');
?>
class="heading">
<?php
echo $instance['title'];
?>
</<?php
echo $this->check_and_return($instance, 'design', 'fonts', 'heading-type');
?>
>
<?php
}
?>
<?php
if ('' != $this->check_and_return($instance, 'excerpt')) {
?>
//.........这里部分代码省略.........
示例10: widget
//.........这里部分代码省略.........
$widget_container_class = apply_filters('layers_post_widget_container_class', $widget_container_class, $this, $instance);
$widget_container_class = implode(' ', $widget_container_class);
// Custom Anchor
echo $this->custom_anchor($instance);
?>
<div id="<?php
echo esc_attr($widget_id);
?>
" class="<?php
echo esc_attr($widget_container_class);
?>
" <?php
$this->selective_refresh_atts($args);
?>
>
<?php
do_action('layers_before_post_widget_inner', $this, $instance);
?>
<?php
if ('' != $this->check_and_return($instance, 'title') || '' != $this->check_and_return($instance, 'excerpt')) {
?>
<div class="container clearfix">
<?php
/**
* Generate the Section Title Classes
*/
$section_title_class = array();
$section_title_class[] = 'section-title clearfix';
$section_title_class[] = $this->check_and_return($instance, 'design', 'fonts', 'size');
$section_title_class[] = $this->check_and_return($instance, 'design', 'fonts', 'align');
$section_title_class[] = $this->check_and_return($instance, 'design', 'background', 'color') && 'dark' == layers_is_light_or_dark($this->check_and_return($instance, 'design', 'background', 'color')) ? 'invert' : '';
$section_title_class = implode(' ', $section_title_class);
?>
<div class="<?php
echo $section_title_class;
?>
">
<?php
if ('' != $this->check_and_return($instance, 'title')) {
?>
<<?php
echo $this->check_and_return($instance, 'design', 'fonts', 'heading-type');
?>
class="heading">
<?php
echo $instance['title'];
?>
</<?php
echo $this->check_and_return($instance, 'design', 'fonts', 'heading-type');
?>
>
<?php
}
?>
<?php
if ('' != $this->check_and_return($instance, 'excerpt')) {
?>
<div class="excerpt"><?php
echo layers_the_content($instance['excerpt']);
?>
</div>
<?php
}
示例11: widget
/**
* 4 - Widget front end display
* http://docs.layerswp.com/development-tutorials-layers-builder-widgets/#4-widget-front-end
*/
function widget($args, $instance)
{
// Turn $args array into variables.
extract($args);
// $instance Defaults
$instance_defaults = $this->defaults;
// If we have information in this widget, then ignore the defaults
if (!empty($instance)) {
$instance_defaults = array();
}
// Parse $instance
$widget = wp_parse_args($instance, $instance_defaults);
// Apply Styling
// http://docs.layerswp.com/development-tutorials-layers-builder-widgets/#colors-and-font-settings
layers_inline_styles('#' . $widget_id, 'background', array('background' => $widget['design']['background']));
layers_inline_styles('#' . $widget_id, 'color', array('selectors' => array('.section-title h3.heading', '.section-title div.excerpt'), 'color' => $widget['design']['fonts']['color']));
layers_inline_styles('#' . $widget_id, 'background', array('selectors' => array('.thumbnail:not(.with-overlay) .thumbnail-body'), 'background' => array('color' => $this->check_and_return($widget, 'design', 'column-background-color'))));
layers_inline_button_styles('#' . $widget_id, 'button', array('selectors' => array('.thumbnail-body a.button'), 'button' => $this->check_and_return($widget, 'design', 'buttons')));
// Apply the advanced widget styling
$this->apply_widget_advanced_styling($widget_id, $widget);
// Begin query arguments
// http://docs.layerswp.com/development-tutorials-layers-builder-widgets/#query-and-display-post-content
$query_args = array();
// Generate the widget container class
// Do not edit
$widget_container_class = array();
$widget_container_class[] = 'widget row content-vertical-massive';
$widget_container_class[] = $this->check_and_return($widget, 'design', 'advanced', 'customclass');
$widget_container_class[] = $this->get_widget_spacing_class($widget);
$widget_container_class = implode(' ', apply_filters('layers_post_widget_container_class', $widget_container_class));
/**
* Widget Markup
* http://docs.layerswp.com/development-tutorials-layers-builder-widgets/#widget-html
*/
?>
<section class=" <?php
echo $widget_container_class;
?>
" id="<?php
echo $widget_id;
?>
">
<?php
if ('' != $this->check_and_return($widget, 'title') || '' != $this->check_and_return($widget, 'excerpt')) {
?>
<div class="container clearfix">
<?php
// Generate the Section Title Classes
$section_title_class = array();
$section_title_class[] = 'section-title clearfix';
$section_title_class[] = $this->check_and_return($widget, 'design', 'fonts', 'size');
$section_title_class[] = $this->check_and_return($widget, 'design', 'fonts', 'align');
$section_title_class[] = $this->check_and_return($widget, 'design', 'background', 'color') && 'dark' == layers_is_light_or_dark($this->check_and_return($widget, 'design', 'background', 'color')) ? 'invert' : '';
$section_title_class = implode(' ', $section_title_class);
?>
<div class="<?php
echo $section_title_class;
?>
">
<?php
if ('' != $widget['title']) {
?>
<h3 class="heading"><?php
echo esc_html($widget['title']);
?>
</h3>
<?php
}
?>
<?php
if ('' != $widget['excerpt']) {
?>
<div class="excerpt"><?php
echo $widget['excerpt'];
?>
</div>
<?php
}
?>
</div>
</div>
<?php
}
// Begin Post Structure
?>
<div class="row <?php
echo $this->get_widget_layout_class($widget);
?>
">
<?php
//.........这里部分代码省略.........