本文整理汇总了PHP中layers_inline_styles函数的典型用法代码示例。如果您正苦于以下问题:PHP layers_inline_styles函数的具体用法?PHP layers_inline_styles怎么用?PHP layers_inline_styles使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了layers_inline_styles函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: layers_generate_customizer_fonts
function layers_generate_customizer_fonts()
{
global $layers_custom_fonts;
// Apply Font Styles
$customizer_options = Layers_Customizer_Config::get_instance();
foreach ($customizer_options->controls as $controls) {
foreach ($controls as $control_key => $control_data) {
if ('layers-font' == $control_data['type'] && layers_get_theme_mod($control_key)) {
// Add fonts to a bucket for registration
$layers_custom_fonts[] = layers_get_theme_mod($control_key);
layers_inline_styles($control_data['selectors'], 'font-family', array('font-family' => layers_get_theme_mod($control_key)));
}
}
}
}
示例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
/**
* 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
}
?>
//.........这里部分代码省略.........
示例4: apply_widget_advanced_styling
/**
* Apply advanced styles to widget instance
*
* @param string $widget_id id css selector of widget
* @param object $widget Widget object to use
*/
function apply_widget_advanced_styling($widget_id, $widget = NULL)
{
// We need a widget to get the settings from
if (NULL == $widget) {
return;
}
/**
* Apply Margin & Padding
*/
$types = array('margin', 'padding');
$fields = array('top', 'right', 'bottom', 'left');
// Loop the Margin & Padding
foreach ($types as $type) {
// Get the TopRightBottomLeft TRBL array of values
$values = $this->check_and_return($widget, 'design', 'advanced', $type);
if (NULL != $values && is_array($values)) {
foreach ($fields as $field) {
if (isset($values[$field]) && '' != $values[$field] && is_numeric($values[$field])) {
// If value is set, and is number, then add 'px' to it
$values[$field] .= 'px';
}
}
// Apply the TRBL styles
if ('padding' == $type && isset($widget['slides']) && 1 <= count($widget['slides'])) {
layers_inline_styles('#' . $widget_id . ' .swiper-slide > .content', $type, array($type => $values));
} else {
layers_inline_styles('#' . $widget_id, $type, array($type => $values));
}
}
}
/**
* Custom CSS
*/
if ($this->check_and_return($widget, 'design', 'advanced', 'customcss')) {
layers_inline_styles(NULL, 'css', array('css' => $this->check_and_return($widget, 'design', 'advanced', 'customcss')));
}
}
示例5: 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 span class for each column
if ('list-list' == $widget['design']['liststyle']) {
$col_count = 1;
$span_class = 'span-12';
} else {
if (isset($widget['design']['columns'])) {
$col_count = str_ireplace('columns-', '', $widget['design']['columns']);
$span_class = 'span-' . 12 / $col_count;
} else {
$col_count = 3;
$span_class = 'span-4';
}
}
// Apply Styling
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);
// Set Image Sizes
if (isset($widget['design']['imageratios'])) {
// Translate Image Ratio
$image_ratio = layers_translate_image_ratios($widget['design']['imageratios']);
if ('layout-boxed' == $this->check_and_return($widget, 'design', 'layout') && $col_count > 2) {
$use_image_ratio = $image_ratio . '-medium';
} elseif ('layout-boxed' != $this->check_and_return($widget, 'design', 'layout') && $col_count > 3) {
$use_image_ratio = $image_ratio . '-large';
} else {
$use_image_ratio = $image_ratio . '-large';
}
} else {
$use_image_ratio = 'large';
}
// Begin query arguments
$query_args = array();
if (get_query_var('paged')) {
$query_args['paged'] = get_query_var('paged');
} else {
if (get_query_var('page')) {
$query_args['paged'] = get_query_var('page');
} else {
$query_args['paged'] = 1;
}
}
$query_args['post_type'] = $this->post_type;
$query_args['posts_per_page'] = $widget['posts_per_page'];
if (isset($widget['order'])) {
$decode_order = json_decode($widget['order'], true);
if (is_array($decode_order)) {
foreach ($decode_order as $key => $value) {
$query_args[$key] = $value;
}
}
}
// Do the special taxonomy array()
if (isset($widget['category']) && '' != $widget['category'] && 0 != $widget['category']) {
$query_args['tax_query'] = array(array("taxonomy" => $this->taxonomy, "field" => "id", "terms" => $widget['category']));
} elseif (!isset($widget['hide_category_filter'])) {
$terms = get_terms($this->taxonomy);
}
// if we haven't selected which category to show, let's load the $terms for use in the filter
// Do the WP_Query
$post_query = new WP_Query($query_args);
// Set the meta to display
global $layers_post_meta_to_display;
$layers_post_meta_to_display = array();
if (isset($widget['show_dates'])) {
$layers_post_meta_to_display[] = 'date';
}
if (isset($widget['show_author'])) {
$layers_post_meta_to_display[] = 'author';
}
if (isset($widget['show_categories'])) {
$layers_post_meta_to_display[] = 'categories';
}
if (isset($widget['show_tags'])) {
$layers_post_meta_to_display[] = 'tags';
}
/**
* Generate the widget container class
//.........这里部分代码省略.........
示例6: 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 p.excerpt', '.section-title small', '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';
?>
<section class="layers-contact-widget widget content-vertical-massive row <?php
echo $this->check_and_return($widget, 'design', 'advanced', 'customclass');
?>
<?php
echo $this->get_widget_spacing_class($widget);
?>
" id="<?php
echo $widget_id;
?>
">
<?php
if ('' != $this->check_and_return($widget, 'title') || '' != $this->check_and_return($widget, 'excerpt')) {
?>
<div class="container clearfix">
<div class="section-title <?php
echo $this->check_and_return($widget, 'design', 'fonts', 'size');
?>
<?php
echo $this->check_and_return($widget, 'design', 'fonts', 'align');
?>
clearfix">
<?php
if ('' != $widget['title']) {
?>
<h3 class="heading"><?php
echo esc_html($widget['title']);
?>
</h3>
<?php
}
?>
<?php
if ('' != $widget['excerpt']) {
?>
<p class="excerpt"><?php
echo $widget['excerpt'];
?>
</p>
<?php
}
?>
</div>
</div>
<?php
}
// if title || excerpt
?>
<div class="row <?php
echo $this->get_widget_layout_class($widget);
?>
">
<?php
if ('' != $widget['address_shown'] && isset($widget['show_address']) || $this->check_and_return($widget, 'show_contact_form')) {
?>
<div class="column <?php
echo $form_class;
?>
form content">
<?php
if ($this->check_and_return($widget, 'show_address')) {
//.........这里部分代码省略.........
示例7: 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);
}
}
示例8: 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();
}
// Parse $instance
$widget = wp_parse_args($instance, $instance_defaults);
// Enqueue Scipts when needed
$this->enqueue_scripts();
// Apply the advanced widget styling
$this->apply_widget_advanced_styling($widget_id, $widget);
// Apply slider arrow color
if ($this->check_and_return($widget, 'slider_arrow_color')) {
layers_inline_styles('#' . $widget_id, 'color', array('selectors' => array('.arrows a'), 'color' => $this->check_and_return($widget, 'slider_arrow_color')));
}
if ($this->check_and_return($widget, 'slider_arrow_color')) {
layers_inline_styles('#' . $widget_id, 'border', array('selectors' => array('span.swiper-pagination-switch'), 'border' => array('color' => $this->check_and_return($widget, 'slider_arrow_color'))));
}
if ($this->check_and_return($widget, 'slider_arrow_color')) {
layers_inline_styles('#' . $widget_id, 'background', array('selectors' => array('span.swiper-pagination-switch'), 'background' => array('color' => $this->check_and_return($widget, 'slider_arrow_color'))));
}
if ($this->check_and_return($widget, 'slider_arrow_color')) {
layers_inline_styles('#' . $widget_id, 'background', array('selectors' => array('span.swiper-pagination-switch.swiper-active-switch'), 'background' => array('color' => 'transparent !important')));
}
// Get slider height css
$slider_height_css = '';
if ('layout-full-screen' != $this->check_and_return($widget, 'design', 'layout') && FALSE == $this->check_and_return($widget, 'autoheight_slides') && $this->check_and_return($widget, 'slide_height')) {
$slider_height_css = 'height: ' . $widget['slide_height'] . 'px; ';
}
/**
* Generate the widget container class
*/
$widget_container_class = array();
$widget_container_class[] = 'widget row slide swiper-container';
$widget_container_class[] = $this->get_widget_layout_class($widget);
$widget_container_class[] = $this->check_and_return($widget, 'design', 'advanced', 'customclass');
$widget_container_class[] = $this->get_widget_spacing_class($widget);
if (isset($widget['design']['layout']) && '' != $widget['design']['layout']) {
// Slider layout eg 'slider-layout-full-screen'
$widget_container_class[] = 'slider-' . $widget['design']['layout'];
}
if (!isset($widget['design']['layout']) || isset($widget['design']['layout']) && 'layout-full-screen' != $widget['design']['layout']) {
// If slider is not full screen
$widget_container_class[] = 'not-full-screen';
}
if (1 == count($widget['slides'])) {
// If only one slide
$widget_container_class[] = 'single-slide';
}
$widget_container_class = implode(' ', apply_filters('layers_slider_widget_container_class', $widget_container_class));
?>
<section class="<?php
echo $widget_container_class;
?>
" id="<?php
echo $widget_id;
?>
" style="<?php
echo esc_attr($slider_height_css);
?>
" >
<?php
if (!empty($widget['slides'])) {
?>
<?php
if (1 < count($widget['slides']) && isset($widget['show_slider_arrows'])) {
?>
<div class="arrows">
<a href="" class="l-left-arrow animate"></a>
<a href="" class="l-right-arrow animate"></a>
</div>
<?php
}
?>
<div class="<?php
echo $this->get_field_id('pages');
?>
pages animate">
<?php
for ($i = 0; $i < count($widget['slides']); $i++) {
?>
<a href="" class="page animate <?php
if (0 == $i) {
echo 'active';
}
?>
"></a>
<?php
}
?>
//.........这里部分代码省略.........
示例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 Scipts when needed
$this->enqueue_scripts();
// Apply slider arrow color
if ($this->check_and_return($instance, 'slider_arrow_color')) {
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'color', array('selectors' => array('.arrows a'), 'color' => $this->check_and_return($instance, 'slider_arrow_color')));
}
if ($this->check_and_return($instance, 'slider_arrow_color')) {
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'border', array('selectors' => array('span.swiper-pagination-switch'), 'border' => array('color' => $this->check_and_return($instance, 'slider_arrow_color'))));
}
if ($this->check_and_return($instance, 'slider_arrow_color')) {
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'background', array('selectors' => array('span.swiper-pagination-switch'), 'background' => array('color' => $this->check_and_return($instance, 'slider_arrow_color'))));
}
if ($this->check_and_return($instance, 'slider_arrow_color')) {
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'background', array('selectors' => array('span.swiper-pagination-switch.swiper-active-switch'), 'background' => array('color' => 'transparent !important')));
}
// Get slider height css
$slider_height_css = '';
if ('layout-full-screen' != $this->check_and_return($instance, 'design', 'layout') && FALSE == $this->check_and_return($instance, 'autoheight_slides') && $this->check_and_return($instance, 'slide_height')) {
$slider_height_css = 'height: ' . $instance['slide_height'] . 'px; ';
}
// 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-slider-widget';
$widget_container_class[] = 'row';
$widget_container_class[] = 'slide';
$widget_container_class[] = 'swiper-container';
$widget_container_class[] = 'loading';
// `loading` will be changed to `loaded` to fade in the slider.
$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[] = $this->get_widget_layout_class($instance);
if ($this->check_and_return($instance, 'autoheight_slides')) {
if (FALSE !== ($fullwidth = array_search('full-screen', $widget_container_class))) {
unset($widget_container_class[$fullwidth]);
}
$widget_container_class[] = 'auto-height';
}
if ($this->check_and_return($instance, 'design', 'layout')) {
// Slider layout eg 'slider-layout-full-screen'
$widget_container_class[] = 'slider-' . $instance['design']['layout'];
}
if (!isset($instance['design']['layout']) || isset($instance['design']['layout']) && 'layout-full-screen' != $instance['design']['layout']) {
// If slider is not full screen
$widget_container_class[] = 'not-full-screen';
}
if (1 == count($instance['slides'])) {
// If only one slide
$widget_container_class[] = 'single-slide';
}
$widget_container_class = apply_filters('layers_slider_widget_container_class', $widget_container_class, $this, $instance);
$widget_container_class = implode(' ', $widget_container_class);
/**
* Slider HTML
*/
if (!empty($instance['slides'])) {
?>
<?php
// Custom Anchor
echo $this->custom_anchor($instance);
?>
<div id="<?php
echo esc_attr($widget_id);
?>
" class="<?php
echo esc_attr($widget_container_class);
?>
" style="<?php
echo esc_attr($slider_height_css);
?>
" <?php
$this->selective_refresh_atts($args);
?>
>
<?php
do_action('layers_before_slider_widget_inner', $this, $instance);
?>
//.........这里部分代码省略.........
示例10: 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');
?>
//.........这里部分代码省略.........
示例11: 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')) {
?>
//.........这里部分代码省略.........
示例12: layers_child_customizer_styles
function layers_child_customizer_styles()
{
/**
* Setup the colors to use below
*/
$widget_title_color = layers_get_theme_mod('widget-title-color', TRUE);
if ('' != $widget_title_color) {
// Content - Links
layers_inline_styles(array('selectors' => array('.sidebar .section-nav-title'), 'css' => array('color' => $widget_title_color)));
}
}
示例13: 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 span class for each column
if ('list-list' == $instance['design']['liststyle']) {
$col_count = 1;
$span_class = 'span-12';
} else {
if (isset($instance['design']['columns'])) {
$col_count = str_ireplace('columns-', '', $instance['design']['columns']);
$span_class = 'span-' . 12 / $col_count;
} else {
$col_count = 3;
$span_class = 'span-4';
}
}
// Apply Styling
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'background', array('background' => $instance['design']['background']));
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'color', array('selectors' => array('.section-title .heading', '.section-title div.excerpt'), 'color' => $instance['design']['fonts']['color']));
$this->inline_css .= layers_inline_styles('#' . $widget_id, 'background', array('selectors' => array('.thumbnail-body'), 'background' => array('color' => $this->check_and_return($instance, 'design', 'column-background-color'))));
// Apply Button Styling.
$button_size = '';
if (function_exists('layers_pro_apply_widget_button_styling')) {
// Apply Layers Pro Button Styling.
$this->inline_css .= layers_pro_apply_widget_button_styling($this, $instance, array("#{$widget_id} .thumbnail-body a.button"));
$button_size = $this->check_and_return($instance, 'design', 'buttons-size') ? 'btn-' . $this->check_and_return($instance, 'design', 'buttons-size') : '';
} else {
// Apply Button Styling.
$this->inline_css .= layers_inline_button_styles("#{$widget_id}", 'button', array('selectors' => array('.thumbnail-body a.button'), 'button' => $this->check_and_return($instance, 'design', 'buttons')));
}
// Set Image Sizes
if (isset($instance['design']['imageratios'])) {
// Translate Image Ratio
$image_ratio = layers_translate_image_ratios($instance['design']['imageratios']);
if ('layout-boxed' == $this->check_and_return($instance, 'design', 'layout') && $col_count > 2) {
$use_image_ratio = $image_ratio . '-medium';
} elseif ('layout-boxed' != $this->check_and_return($instance, 'design', 'layout') && $col_count > 3) {
$use_image_ratio = $image_ratio . '-large';
} else {
$use_image_ratio = $image_ratio . '-large';
}
} else {
$use_image_ratio = 'large';
}
// Begin query arguments
$query_args = array();
if (get_query_var('paged')) {
$query_args['paged'] = get_query_var('paged');
} else {
if (get_query_var('page')) {
$query_args['paged'] = get_query_var('page');
} else {
$query_args['paged'] = 1;
}
}
$query_args['post_type'] = $this->post_type;
$query_args['posts_per_page'] = $instance['posts_per_page'];
if (isset($instance['order'])) {
$decode_order = json_decode($instance['order'], true);
if (is_array($decode_order)) {
foreach ($decode_order as $key => $value) {
$query_args[$key] = $value;
}
}
}
// Do the special taxonomy array()
if (isset($instance['category']) && '' != $instance['category'] && 0 != $instance['category']) {
$query_args['tax_query'] = array(array("taxonomy" => $this->taxonomy, "field" => "id", "terms" => $instance['category']));
} elseif (!isset($instance['hide_category_filter'])) {
$terms = get_terms($this->taxonomy);
}
// if we haven't selected which category to show, let's load the $terms for use in the filter
// Do the WP_Query
$post_query = new WP_Query($query_args);
// Set the meta to display
global $layers_post_meta_to_display;
$layers_post_meta_to_display = array();
if (isset($instance['show_dates'])) {
$layers_post_meta_to_display[] = 'date';
}
if (isset($instance['show_author'])) {
$layers_post_meta_to_display[] = 'author';
}
if (isset($instance['show_categories'])) {
//.........这里部分代码省略.........
示例14: layers_apply_customizer_styles
function layers_apply_customizer_styles()
{
// Custom CSS
if (layers_get_theme_mod('custom-css')) {
layers_inline_styles(NULL, 'css', array('css' => layers_get_theme_mod('custom-css')));
}
// Header
if (layers_get_theme_mod('header-background-color')) {
$bg_opacity = layers_get_theme_mod('header-overlay') ? 0.5 : 1;
layers_inline_styles('.header-site, .header-site.header-sticky', 'css', array('css' => 'background-color: rgba(' . implode(', ', layers_hex2rgb(layers_get_theme_mod('header-background-color'))) . ', ' . $bg_opacity . ');'));
}
// Footer
layers_inline_styles('#footer, #footer.well', 'background', array('background' => array('color' => layers_get_theme_mod('footer-background-color'), 'repeat' => layers_get_theme_mod('footer-background-repeat'), 'position' => layers_get_theme_mod('footer-background-position'), 'stretch' => layers_get_theme_mod('footer-background-stretch'), 'image' => layers_get_theme_mod('footer-background-image'), 'fixed' => false)));
layers_inline_styles('#footer h5, #footer p, #footer li, #footer .textwidget, #footer.well', 'color', array('color' => layers_get_theme_mod('footer-body-color')));
layers_inline_styles('#footer a, #footer.well a', 'color', array('color' => layers_get_theme_mod('footer-link-color')));
}
示例15: 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
//.........这里部分代码省略.........