예제 #1
2
    function shortcode_callback($atts, $content = null, $function_name)
    {
        /**
         * Cached $wp_filter so it can be restored at the end of the callback.
         * This is needed because this callback uses the_content filter / calls a function
         * which uses the_content filter. WordPress doesn't support nested filter
         */
        global $wp_filter;
        $wp_filter_cache = $wp_filter;
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $show_arrows = $this->shortcode_atts['show_arrows'];
        $show_pagination = $this->shortcode_atts['show_pagination'];
        $parallax = $this->shortcode_atts['parallax'];
        $parallax_method = $this->shortcode_atts['parallax_method'];
        $auto = $this->shortcode_atts['auto'];
        $auto_speed = $this->shortcode_atts['auto_speed'];
        $auto_ignore_hover = $this->shortcode_atts['auto_ignore_hover'];
        $top_padding = $this->shortcode_atts['top_padding'];
        $body_font_size = $this->shortcode_atts['body_font_size'];
        $bottom_padding = $this->shortcode_atts['bottom_padding'];
        $remove_inner_shadow = $this->shortcode_atts['remove_inner_shadow'];
        $hide_content_on_mobile = $this->shortcode_atts['hide_content_on_mobile'];
        $hide_cta_on_mobile = $this->shortcode_atts['hide_cta_on_mobile'];
        $show_image_video_mobile = $this->shortcode_atts['show_image_video_mobile'];
        $background_position = $this->shortcode_atts['background_position'];
        $background_size = $this->shortcode_atts['background_size'];
        $posts_number = $this->shortcode_atts['posts_number'];
        $include_categories = $this->shortcode_atts['include_categories'];
        $show_more_button = $this->shortcode_atts['show_more_button'];
        $more_text = $this->shortcode_atts['more_text'];
        $content_source = $this->shortcode_atts['content_source'];
        $background_color = $this->shortcode_atts['background_color'];
        $show_image = $this->shortcode_atts['show_image'];
        $image_placement = $this->shortcode_atts['image_placement'];
        $background_image = $this->shortcode_atts['background_image'];
        $background_layout = $this->shortcode_atts['background_layout'];
        $use_bg_overlay = $this->shortcode_atts['use_bg_overlay'];
        $bg_overlay_color = $this->shortcode_atts['bg_overlay_color'];
        $use_text_overlay = $this->shortcode_atts['use_text_overlay'];
        $text_overlay_color = $this->shortcode_atts['text_overlay_color'];
        $orderby = $this->shortcode_atts['orderby'];
        $show_meta = $this->shortcode_atts['show_meta'];
        $button_custom = $this->shortcode_atts['custom_button'];
        $custom_icon = $this->shortcode_atts['button_icon'];
        $use_manual_excerpt = $this->shortcode_atts['use_manual_excerpt'];
        $excerpt_length = $this->shortcode_atts['excerpt_length'];
        $text_border_radius = $this->shortcode_atts['text_border_radius'];
        $dot_nav_custom_color = $this->shortcode_atts['dot_nav_custom_color'];
        $arrows_custom_color = $this->shortcode_atts['arrows_custom_color'];
        $top_padding_tablet = $this->shortcode_atts['top_padding_tablet'];
        $top_padding_phone = $this->shortcode_atts['top_padding_phone'];
        $bottom_padding_tablet = $this->shortcode_atts['bottom_padding_tablet'];
        $bottom_padding_phone = $this->shortcode_atts['bottom_padding_phone'];
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        $hide_on_mobile_class = self::HIDE_ON_MOBILE;
        if ('' !== $top_padding || '' !== $top_padding_tablet || '' !== $top_padding_phone) {
            $padding_values = array('desktop' => $top_padding, 'tablet' => $top_padding_tablet, 'phone' => $top_padding_phone);
            et_pb_generate_responsive_css($padding_values, '%%order_class%% .et_pb_slide_description', 'padding-top', $function_name);
        }
        if ('' !== $bottom_padding || '' !== $bottom_padding_tablet || '' !== $bottom_padding_phone) {
            $padding_values = array('desktop' => $bottom_padding, 'tablet' => $bottom_padding_tablet, 'phone' => $bottom_padding_phone);
            et_pb_generate_responsive_css($padding_values, '%%order_class%% .et_pb_slide_description', 'padding-bottom', $function_name);
        }
        if ('' !== $bottom_padding || '' !== $top_padding) {
            ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide_description', 'declaration' => 'padding-right: 0; padding-left: 0;'));
        }
        if ('default' !== $background_position && 'off' === $parallax) {
            $processed_position = str_replace('_', ' ', $background_position);
            ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide', 'declaration' => sprintf('background-position: %1$s;', esc_html($processed_position))));
        }
        if ('default' !== $background_size && 'off' === $parallax) {
            ET_Builder_Module::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide', 'declaration' => sprintf('-moz-background-size: %1$s;
					-webkit-background-size: %1$s;
					background-size: %1$s;', esc_html($background_size))));
            if ('initial' === $background_size) {
                ET_Builder_Module::set_style($function_name, array('selector' => 'body.ie %%order_class%% .et_pb_slide', 'declaration' => sprintf('-moz-background-size: %1$s;
						-webkit-background-size: %1$s;
						background-size: %1$s;', 'auto')));
            }
        }
        if ('' !== $background_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_post_slider', 'declaration' => sprintf('background-color: %1$s;', esc_html($background_color))));
        }
        if ('' !== $background_image) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%, %%order_class%%.et_pb_bg_layout_dark, %%order_class%%.et_pb_bg_layout_light', 'declaration' => sprintf('background-image: url(%1$s);', esc_url($background_image))));
        }
        if ('on' === $use_bg_overlay && '' !== $bg_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide .et_pb_slide_overlay_container', 'declaration' => sprintf('background-color: %1$s;', esc_html($bg_overlay_color))));
        }
        if ('on' === $use_text_overlay && '' !== $text_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_pb_slide .et_pb_slide_title, %%order_class%% .et_pb_slide .et_pb_slide_content', 'declaration' => sprintf('background-color: %1$s;', esc_html($text_overlay_color))));
        }
        if ('' !== $text_border_radius) {
            $border_radius_value = et_builder_process_range_value($text_border_radius);
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_slider_with_text_overlay h2.et_pb_slide_title', 'declaration' => sprintf('-webkit-border-top-left-radius: %1$s;
					-webkit-border-top-right-radius: %1$s;
					-moz-border-radius-topleft: %1$s;
					-moz-border-radius-topright: %1$s;
					border-top-left-radius: %1$s;
					border-top-right-radius: %1$s;', esc_html($border_radius_value))));
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_slider_with_text_overlay .et_pb_slide_content', 'declaration' => sprintf('-webkit-border-bottom-right-radius: %1$s;
					-webkit-border-bottom-left-radius: %1$s;
					-moz-border-radius-bottomright: %1$s;
					-moz-border-radius-bottomleft: %1$s;
					border-bottom-right-radius: %1$s;
					border-bottom-left-radius: %1$s;', esc_html($border_radius_value))));
        }
        $fullwidth = 'et_pb_fullwidth_post_slider' === $function_name ? 'on' : 'off';
        $class = '';
        $class .= 'off' === $fullwidth ? ' et_pb_slider_fullwidth_off' : '';
        $class .= 'off' === $show_arrows ? ' et_pb_slider_no_arrows' : '';
        $class .= 'off' === $show_pagination ? ' et_pb_slider_no_pagination' : '';
        $class .= 'on' === $parallax ? ' et_pb_slider_parallax' : '';
        $class .= 'on' === $auto ? ' et_slider_auto et_slider_speed_' . esc_attr($auto_speed) : '';
        $class .= 'on' === $auto_ignore_hover ? ' et_slider_auto_ignore_hover' : '';
        $class .= 'on' === $remove_inner_shadow ? ' et_pb_slider_no_shadow' : '';
        $class .= 'on' === $show_image_video_mobile ? ' et_pb_slider_show_image' : '';
        $class .= ' et_pb_post_slider_image_' . $image_placement;
        $class .= 'on' === $use_bg_overlay ? ' et_pb_slider_with_overlay' : '';
        $class .= 'on' === $use_text_overlay ? ' et_pb_slider_with_text_overlay' : '';
        $data_dot_nav_custom_color = '' !== $dot_nav_custom_color ? sprintf(' data-dots_color="%1$s"', esc_attr($dot_nav_custom_color)) : '';
        $data_arrows_custom_color = '' !== $arrows_custom_color ? sprintf(' data-arrows_color="%1$s"', esc_attr($arrows_custom_color)) : '';
        $args = array('posts_per_page' => (int) $posts_number);
        if ('' !== $include_categories) {
            $args['cat'] = $include_categories;
        }
        if ('date_desc' !== $orderby) {
            switch ($orderby) {
                case 'date_asc':
                    $args['orderby'] = 'date';
                    $args['order'] = 'ASC';
                    break;
                case 'title_asc':
                    $args['orderby'] = 'title';
                    $args['order'] = 'ASC';
                    break;
                case 'title_desc':
                    $args['orderby'] = 'title';
                    $args['order'] = 'DESC';
                    break;
                case 'rand':
                    $args['orderby'] = 'rand';
                    break;
            }
        }
        ob_start();
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                $slide_class = 'off' !== $show_image && in_array($image_placement, array('left', 'right')) && has_post_thumbnail() ? ' et_pb_slide_with_image' : '';
                $slide_class .= " et_pb_bg_layout_{$background_layout}";
                ?>
			<div class="et_pb_slide et_pb_media_alignment_center<?php 
                echo esc_attr($slide_class);
                ?>
" <?php 
                if ('on' !== $parallax && 'off' !== $show_image && 'background' === $image_placement) {
                    printf('style="background-image:url(%1$s)"', esc_url(wp_get_attachment_url(get_post_thumbnail_id())));
                }
                echo $data_dot_nav_custom_color;
                echo $data_arrows_custom_color;
                ?>
>
				<?php 
                if ('on' === $parallax && 'off' !== $show_image && 'background' === $image_placement) {
                    ?>
					<div class="et_parallax_bg<?php 
                    if ('off' === $parallax_method) {
                        echo ' et_pb_parallax_css';
                    }
                    ?>
" style="background-image: url(<?php 
                    echo esc_url(wp_get_attachment_url(get_post_thumbnail_id()));
                    ?>
);"></div>
				<?php 
                }
                ?>
				<?php 
                if ('on' === $use_bg_overlay) {
                    ?>
					<div class="et_pb_slide_overlay_container"></div>
				<?php 
                }
                ?>
				<div class="et_pb_container clearfix">
					<?php 
                if ('off' !== $show_image && has_post_thumbnail() && !in_array($image_placement, array('background', 'bottom'))) {
                    ?>
						<div class="et_pb_slide_image">
							<?php 
                    the_post_thumbnail();
                    ?>
						</div>
					<?php 
                }
                ?>
					<div class="et_pb_slide_description">
						<h2 class="et_pb_slide_title"><a href="<?php 
                esc_url(the_permalink());
                ?>
"><?php 
                the_title();
                ?>
</a></h2>
						<div class="et_pb_slide_content <?php 
                if ('on' === $hide_content_on_mobile) {
                    echo esc_attr($hide_on_mobile_class);
                }
                ?>
">
							<?php 
                if ('off' !== $show_meta) {
                    printf('<p class="post-meta">%1$s | %2$s | %3$s | %4$s</p>', et_get_safe_localization(sprintf(__('by %s', 'et_builder'), '<span class="author vcard">' . et_pb_get_the_author_posts_link() . '</span>')), et_get_safe_localization(sprintf(__('%s', 'et_builder'), '<span class="published">' . esc_html(get_the_date()) . '</span>')), get_the_category_list(', '), sprintf(esc_html(_nx('1 Comment', '%s Comments', get_comments_number(), 'number of comments', 'et_builder')), number_format_i18n(get_comments_number())));
                }
                ?>
							<?php 
                $post_content = get_the_content();
                // do not display the content if it contains Blog, Post Slider, Fullwidth Post Slider, or Portfolio modules to avoid infinite loops
                if (!has_shortcode($post_content, 'et_pb_blog') && !has_shortcode($post_content, 'et_pb_portfolio') && !has_shortcode($post_content, 'et_pb_post_slider') && !has_shortcode($post_content, 'et_pb_fullwidth_post_slider')) {
                    if ('on' === $content_source) {
                        global $more;
                        $post_content = et_strip_shortcodes($post_content);
                        // page builder doesn't support more tag, so display the_content() in case of post made with page builder
                        if (et_pb_is_pagebuilder_used(get_the_ID())) {
                            $more = 1;
                            echo apply_filters('the_content', $post_content);
                        } else {
                            $more = null;
                            echo apply_filters('the_content', et_strip_shortcodes(get_the_content(esc_html__('read more...', 'et_builder'))));
                        }
                    } else {
                        if (has_excerpt() && 'off' !== $use_manual_excerpt) {
                            the_excerpt();
                        } else {
                            truncate_post(intval($excerpt_length), true, '', true);
                        }
                    }
                } else {
                    if (has_excerpt()) {
                        the_excerpt();
                    }
                }
                ?>
						</div>
						<?php 
                if ('off' !== $show_more_button && '' !== $more_text) {
                    printf('<a href="%1$s" class="et_pb_more_button et_pb_button%4$s%5$s"%3$s>%2$s</a>', esc_url(get_permalink()), esc_html($more_text), '' !== $custom_icon && 'on' === $button_custom ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($custom_icon))) : '', '' !== $custom_icon && 'on' === $button_custom ? ' et_pb_custom_button_icon' : '', 'on' === $hide_cta_on_mobile ? esc_attr(" {$hide_on_mobile_class}") : '');
                }
                ?>
					</div> <!-- .et_pb_slide_description -->
					<?php 
                if ('off' !== $show_image && has_post_thumbnail() && 'bottom' === $image_placement) {
                    ?>
						<div class="et_pb_slide_image">
							<?php 
                    the_post_thumbnail();
                    ?>
						</div>
					<?php 
                }
                ?>
				</div> <!-- .et_pb_container -->
			</div> <!-- .et_pb_slide -->
		<?php 
            }
            // end while
            wp_reset_query();
        }
        // end if
        $content = ob_get_contents();
        ob_end_clean();
        $output = sprintf('<div%3$s class="et_pb_module et_pb_slider et_pb_post_slider%1$s%4$s">
				<div class="et_pb_slides">
					%2$s
				</div> <!-- .et_pb_slides -->
			</div> <!-- .et_pb_slider -->
			', $class, $content, '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '');
        // Restore $wp_filter
        $wp_filter = $wp_filter_cache;
        unset($wp_filter_cache);
        return $output;
    }
예제 #2
0
파일: main-modules.php 프로젝트: acchs/test
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $title = $this->shortcode_atts['title'];
        $subhead = $this->shortcode_atts['subhead'];
        $background_layout = $this->shortcode_atts['background_layout'];
        $text_orientation = $this->shortcode_atts['text_orientation'];
        $title_font = $this->shortcode_atts['title_font'];
        $title_font_color = $this->shortcode_atts['title_font_color'];
        $title_font_size = $this->shortcode_atts['title_font_size'];
        $subhead_font = $this->shortcode_atts['subhead_font'];
        $subhead_font_color = $this->shortcode_atts['subhead_font_color'];
        $subhead_font_size = $this->shortcode_atts['subhead_font_size'];
        $content_font = $this->shortcode_atts['content_font'];
        $content_font_color = $this->shortcode_atts['content_font_color'];
        $content_font_size = $this->shortcode_atts['content_font_size'];
        $button_one_text = $this->shortcode_atts['button_one_text'];
        $button_one_url = $this->shortcode_atts['button_one_url'];
        $button_two_text = $this->shortcode_atts['button_two_text'];
        $button_two_url = $this->shortcode_atts['button_two_url'];
        $header_fullscreen = $this->shortcode_atts['header_fullscreen'];
        $header_scroll_down = $this->shortcode_atts['header_scroll_down'];
        $scroll_down_icon = $this->shortcode_atts['scroll_down_icon'];
        $scroll_down_icon_color = $this->shortcode_atts['scroll_down_icon_color'];
        $scroll_down_icon_size = $this->shortcode_atts['scroll_down_icon_size'];
        $background_url = $this->shortcode_atts['background_url'];
        $background_color = $this->shortcode_atts['background_color'];
        $background_overlay_color = $this->shortcode_atts['background_overlay_color'];
        $parallax = $this->shortcode_atts['parallax'];
        $parallax_method = $this->shortcode_atts['parallax_method'];
        $logo_image_url = $this->shortcode_atts['logo_image_url'];
        $header_image_url = $this->shortcode_atts['header_image_url'];
        $content_orientation = $this->shortcode_atts['content_orientation'];
        $image_orientation = $this->shortcode_atts['image_orientation'];
        $custom_icon_1 = $this->shortcode_atts['button_one_icon'];
        $button_custom_1 = $this->shortcode_atts['custom_button_one'];
        $custom_icon_2 = $this->shortcode_atts['button_two_icon'];
        $button_custom_2 = $this->shortcode_atts['custom_button_two'];
        $max_width = $this->shortcode_atts['max_width'];
        $logo_title = $this->shortcode_atts['logo_title'];
        $logo_alt_text = $this->shortcode_atts['logo_alt_text'];
        if (is_rtl() && 'left' === $text_orientation) {
            $text_orientation = 'right';
        }
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        if ('' !== $max_width) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .header-content', 'declaration' => sprintf('max-width: %1$s !important;', esc_html(et_builder_process_range_value($max_width)))));
        }
        if ('' !== $title_font) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1', 'declaration' => sprintf('%1$s', et_builder_set_element_font($title_font))));
        }
        if ('' !== $title_font_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1', 'declaration' => sprintf('color: %1$s !important;', esc_html($title_font_color))));
        }
        if ('' !== $title_font_size) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .header-content h1', 'declaration' => sprintf('font-size: %1$s;', esc_html(et_builder_process_range_value($title_font_size)))));
        }
        if ('' !== $subhead_font) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead', 'declaration' => sprintf('%1$s', et_builder_set_element_font($subhead_font))));
        }
        if ('' !== $subhead_font_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead', 'declaration' => sprintf('color: %1$s !important;', esc_html($subhead_font_color))));
        }
        if ('' !== $subhead_font_size) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_subhead', 'declaration' => sprintf('font-size: %1$s;', esc_html(et_builder_process_range_value($subhead_font_size)))));
        }
        if ('' !== $content_font) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header p', 'declaration' => sprintf('%1$s', et_builder_set_element_font($content_font))));
        }
        if ('' !== $content_font_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header p', 'declaration' => sprintf('color: %1$s !important;', esc_html($content_font_color))));
        }
        if ('' !== $content_font_size) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header p', 'declaration' => sprintf('font-size: %1$s;', esc_html(et_builder_process_range_value($content_font_size)))));
        }
        if ('' !== $scroll_down_icon_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_scroll a .et-pb-icon', 'declaration' => sprintf('color: %1$s;', esc_html($scroll_down_icon_color))));
        }
        if ('' !== $scroll_down_icon_size) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_scroll a .et-pb-icon', 'declaration' => sprintf('font-size: %1$s;', esc_html(et_builder_process_range_value($scroll_down_icon_size)))));
        }
        if ('' !== $background_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header', 'declaration' => sprintf('background-color: %1$s;', esc_html($background_color))));
        }
        if ('' !== $background_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header .et_pb_fullwidth_header_overlay', 'declaration' => sprintf('background-color: %1$s;', esc_html($background_overlay_color))));
        }
        if ('' !== $background_url && 'off' === $parallax) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%%.et_pb_fullwidth_header', 'declaration' => sprintf('background-image: url(%1$s);', esc_html($background_url))));
        }
        $button_output = '';
        if ('' !== $button_one_text) {
            $button_output .= sprintf('<a href="%2$s" class="et_pb_more_button et_pb_button et_pb_button_one%4$s"%3$s>%1$s</a>', '' !== $button_one_text ? esc_attr($button_one_text) : '', '' !== $button_one_url ? esc_attr($button_one_url) : '#', '' !== $custom_icon_1 && 'on' === $button_custom_1 ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($custom_icon_1))) : '', '' !== $custom_icon_1 && 'on' === $button_custom_1 ? ' et_pb_custom_button_icon' : '');
        }
        if ('' !== $button_two_text) {
            $button_output .= sprintf('<a href="%2$s" class="et_pb_more_button et_pb_button et_pb_button_two%4$s"%3$s>%1$s</a>', '' !== $button_two_text ? esc_attr($button_two_text) : '', '' !== $button_two_url ? esc_attr($button_two_url) : '#', '' !== $custom_icon_2 && 'on' === $button_custom_2 ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($custom_icon_2))) : '', '' !== $custom_icon_2 && 'on' === $button_custom_2 ? ' et_pb_custom_button_icon' : '');
        }
        $class = " et_pb_module et_pb_bg_layout_{$background_layout} et_pb_text_align_{$text_orientation}";
        $header_content = '';
        if ('' !== $title || '' !== $subhead || '' !== $content || '' !== $button_output || '' !== $logo_image_url) {
            $logo_image = '';
            if ('' !== $logo_image_url) {
                $logo_image = sprintf('<img src="%1$s" alt="%2$s"%3$s />', esc_attr($logo_image_url), esc_attr($logo_alt_text), '' !== $logo_title ? sprintf(' title="%1$s"', esc_attr($logo_title)) : '');
            }
            $header_content = sprintf('<div class="header-content-container%6$s">
					<div class="header-content">
						%3$s
						%1$s
						%2$s
						%4$s
						%5$s
					</div>
				</div>', $title ? sprintf('<h1>%1$s</h1>', $title) : '', $subhead ? sprintf('<span class="et_pb_fullwidth_header_subhead">%1$s</span>', $subhead) : '', $logo_image, '' !== $content ? sprintf('<p>%1$s</p>', $this->shortcode_content) : '', '' !== $button_output ? $button_output : '', '' !== $content_orientation ? sprintf(' %1$s', $content_orientation) : '');
        }
        $header_image = '';
        if ('' !== $header_image_url) {
            $header_image = sprintf('<div class="header-image-container%2$s">
					<div class="header-image">
						<img src="%1$s" />
					</div>
				</div>', '' !== $header_image_url ? esc_attr($header_image_url) : '', '' !== $image_orientation ? sprintf(' %1$s', $image_orientation) : '');
            $module_class .= ' et_pb_header_with_image';
        }
        $scroll_down_output = '';
        if ('off' !== $header_scroll_down || '' !== $scroll_down_icon) {
            $scroll_down_output .= sprintf('<a href="#"><span class="scroll-down et-pb-icon">%1$s</span></a>', esc_html(et_pb_process_font_icon($scroll_down_icon, 'et_pb_get_font_down_icon_symbols')));
        }
        $output = sprintf('<section%9$s class="et_pb_fullwidth_header%1$s%7$s%8$s%10$s">
				%6$s
				<div class="et_pb_fullwidth_header_container%5$s">
					%2$s
					%3$s
				</div>
				<div class="et_pb_fullwidth_header_overlay"></div>
				<div class="et_pb_fullwidth_header_scroll">%4$s</div>
			</section>', 'off' !== $header_fullscreen ? ' et_pb_fullscreen' : '', '' !== $header_content ? $header_content : '', '' !== $header_image ? $header_image : '', 'off' !== $header_scroll_down ? $scroll_down_output : '', '' !== $text_orientation ? sprintf(' %1$s', esc_attr($text_orientation)) : '', '' !== $background_url && 'on' === $parallax ? sprintf('<div class="et_parallax_bg%2$s" style="background-image: url(%1$s);"></div>', esc_attr($background_url), 'off' === $parallax_method ? ' et_pb_parallax_css' : '') : '', '' !== $background_url && 'on' === $parallax ? ' et_pb_section_parallax' : '', esc_attr($class), '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '');
        return $output;
    }
예제 #3
0
    function process_advanced_button_options($function_name)
    {
        if (!isset($this->advanced_options['button'])) {
            return;
        }
        foreach ($this->advanced_options['button'] as $option_name => $option_settings) {
            $button_custom = $this->shortcode_atts["custom_{$option_name}"];
            $button_text_size = $this->shortcode_atts["{$option_name}_text_size"];
            $button_text_color = $this->shortcode_atts["{$option_name}_text_color"];
            $button_bg_color = $this->shortcode_atts["{$option_name}_bg_color"];
            $button_border_width = $this->shortcode_atts["{$option_name}_border_width"];
            $button_border_color = $this->shortcode_atts["{$option_name}_border_color"];
            $button_border_radius = $this->shortcode_atts["{$option_name}_border_radius"];
            $button_font = $this->shortcode_atts["{$option_name}_font"];
            $button_letter_spacing = $this->shortcode_atts["{$option_name}_letter_spacing"];
            $button_use_icon = $this->shortcode_atts["{$option_name}_use_icon"];
            $button_icon = $this->shortcode_atts["{$option_name}_icon"];
            $button_icon_color = $this->shortcode_atts["{$option_name}_icon_color"];
            $button_icon_placement = $this->shortcode_atts["{$option_name}_icon_placement"];
            $button_on_hover = $this->shortcode_atts["{$option_name}_on_hover"];
            $button_text_color_hover = $this->shortcode_atts["{$option_name}_text_color_hover"];
            $button_bg_color_hover = $this->shortcode_atts["{$option_name}_bg_color_hover"];
            $button_border_color_hover = $this->shortcode_atts["{$option_name}_border_color_hover"];
            $button_border_radius_hover = $this->shortcode_atts["{$option_name}_border_radius_hover"];
            $button_letter_spacing_hover = $this->shortcode_atts["{$option_name}_letter_spacing_hover"];
            if ('on' === $button_custom) {
                $button_text_size = '' === $button_text_size || 'px' === $button_text_size ? '20px' : $button_text_size;
                $button_text_size = '' !== $button_text_size && false === strpos($button_text_size, 'px') ? $button_text_size . 'px' : $button_text_size;
                $css_element = !empty($option_settings['css']['main']) ? $option_settings['css']['main'] : $this->main_css_element . ' .et_pb_button';
                $main_element_styles = sprintf('%1$s
					%2$s
					%3$s
					%4$s
					%5$s
					%6$s
					%7$s
					%8$s
					%9$s', '' !== $button_text_color ? sprintf('color:%1$s;', $button_text_color) : '', '' !== $button_bg_color ? sprintf('background:%1$s;', $button_bg_color) : '', '' !== $button_border_width && 'px' !== $button_border_width ? sprintf('border-width:%1$s !important;', et_builder_process_range_value($button_border_width)) : '', '' !== $button_border_color ? sprintf('border-color:%1$s;', $button_border_color) : '', '' !== $button_border_radius && 'px' !== $button_border_radius ? sprintf('border-radius:%1$s;', et_builder_process_range_value($button_border_radius)) : '', '' !== $button_letter_spacing && 'px' !== $button_letter_spacing ? sprintf('letter-spacing:%1$s;', et_builder_process_range_value($button_letter_spacing)) : '', '' !== $button_text_size && 'px' !== $button_text_size ? sprintf('font-size:%1$s;', et_builder_process_range_value($button_text_size)) : '', '' !== $button_font ? et_builder_set_element_font($button_font, true) : '', 'off' === $button_on_hover ? sprintf('padding-left:%1$s; padding-right: %2$s;', 'left' === $button_icon_placement ? '2em' : '0.7em', 'left' === $button_icon_placement ? '0.7em' : '2em') : '');
                self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element, 'declaration' => rtrim($main_element_styles)));
                $main_element_styles_hover = sprintf('%1$s
					%2$s
					%3$s
					%4$s
					%5$s
					%6$s', '' !== $button_text_color_hover ? sprintf('color:%1$s !important;', $button_text_color_hover) : '', '' !== $button_bg_color_hover ? sprintf('background:%1$s !important;', $button_bg_color_hover) : '', '' !== $button_border_color_hover ? sprintf('border-color:%1$s !important;', $button_border_color_hover) : '', '' !== $button_border_radius_hover ? sprintf('border-radius:%1$s;', et_builder_process_range_value($button_border_radius_hover)) : '', '' !== $button_letter_spacing_hover ? sprintf('letter-spacing:%1$spx;', $button_letter_spacing_hover) : '', 'off' === $button_on_hover ? '' : sprintf('padding-left:%1$s; padding-right: %2$s;', 'left' === $button_icon_placement ? '2em' : '0.7em', 'left' === $button_icon_placement ? '0.7em' : '2em'));
                self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ':hover', 'declaration' => rtrim($main_element_styles_hover)));
                if ('off' === $button_use_icon) {
                    $main_element_styles_after = 'display:none !important;';
                    $no_icon_styles = 'padding: 0.3em 1em !important;';
                    self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ',' . $css_element . ':hover', 'declaration' => rtrim($no_icon_styles)));
                } else {
                    $button_icon_code = '' !== $button_icon ? str_replace(';', '', str_replace('&#x', '', html_entity_decode(et_pb_process_font_icon($button_icon)))) : '';
                    $int_font_size = intval(str_replace('px', '', $button_text_size));
                    if ('' !== $button_text_size) {
                        $button_icon_size = '35' !== $button_icon_code ? $button_text_size : $int_font_size * 1.6 . 'px';
                    }
                    $main_element_styles_after = sprintf('%1$s
						%2$s
						%3$s
						%4$s
						%5$s
						%6$s
						%7$s', '' !== $button_icon_color ? sprintf('color:%1$s;', $button_icon_color) : '', '' !== $button_icon_code ? sprintf('line-height:%1$s;', '35' !== $button_icon_code ? '1.7em' : '1em') : '', '' !== $button_icon_code ? sprintf('font-size:%1$s !important;', $button_icon_size) : '', sprintf('opacity:%1$s;', 'on' === $button_on_hover ? '0' : '1'), 'off' !== $button_on_hover && '' !== $button_icon_code ? sprintf('margin-left:%1$s;left:%2$s;', 'left' === $button_icon_placement ? '0' : '-1em', 'left' === $button_icon_placement ? '1em' : 'auto') : '', 'off' === $button_on_hover ? sprintf('margin-left:%1$s;left:%2$s;', 'left' === $button_icon_placement ? '0' : '.3em', 'left' === $button_icon_placement ? '0.15em' : 'auto') : '', 'on' === $button_use_icon ? 'display: inline-block;' : '');
                    $hover_after_styles = sprintf('%1$s
						%2$s
						%3$s', '' !== $button_icon_code ? sprintf('margin-left:%1$s;', '35' !== $button_icon_code ? '.3em' : '0') : '', '' !== $button_icon_code ? sprintf('left:%1$s;margin-left:%2$s;', 'left' === $button_icon_placement ? '0.15em' : 'auto', '35' !== $button_icon_code ? '.3em' : '0') : '', 'on' === $button_on_hover ? 'opacity: 1;' : '');
                    self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ':hover:after', 'declaration' => rtrim($hover_after_styles)));
                    if ('' === $button_icon) {
                        $default_icons_size = $int_font_size * 1.6 . 'px';
                        $custom_icon_size = $button_text_size;
                        self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ':after', 'declaration' => sprintf('font-size:%1$s;', $default_icons_size)));
                        self::set_style($function_name, array('selector' => 'body.et_button_custom_icon #page-container ' . $css_element . ':after', 'declaration' => sprintf('font-size:%1$s;', $custom_icon_size)));
                    }
                }
                self::set_style($function_name, array('selector' => 'body #page-container ' . $css_element . ':after', 'declaration' => rtrim($main_element_styles_after)));
            }
        }
    }
예제 #4
0
if ($module_posts->have_posts()) {
    $module_posts->the_post();
    ?>
	<div class="main-post">
		<article id="post-<?php 
    the_ID();
    ?>
" <?php 
    post_class();
    ?>
>
			<div class="header">
			<?php 
    $thumbnail_size = extra_sidebar() ? 'extra-image-medium' : 'extra-image-small';
    $overlay = !empty($hover_overlay_icon) ? '<span class="et_pb_extra_overlay et_pb_inline_icon" data-icon="' . esc_attr(et_pb_process_font_icon($hover_overlay_icon)) . '"></span>' : '<span class="et_pb_extra_overlay"></span>';
    $thumb_args = array('size' => $thumbnail_size, 'img_after' => $overlay);
    $score_bar = extra_get_the_post_score_bar();
    require locate_template('post-top-content.php');
    ?>
			</div>
			<div class="post-content">
				<?php 
    $color = !empty($term_color) ? $term_color : extra_get_post_category_color();
    ?>
				<h2><a class="et-accent-color" style="color:<?php 
    echo esc_attr($color);
    ?>
;" href="<?php 
    the_permalink();
    ?>
예제 #5
0
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $fullwidth = $this->shortcode_atts['fullwidth'];
        $posts_number = $this->shortcode_atts['posts_number'];
        $include_categories = $this->shortcode_atts['include_categories'];
        $show_title = $this->shortcode_atts['show_title'];
        $show_categories = $this->shortcode_atts['show_categories'];
        $show_pagination = $this->shortcode_atts['show_pagination'];
        $background_layout = $this->shortcode_atts['background_layout'];
        $zoom_icon_color = $this->shortcode_atts['zoom_icon_color'];
        $hover_overlay_color = $this->shortcode_atts['hover_overlay_color'];
        $hover_icon = $this->shortcode_atts['hover_icon'];
        global $paged;
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        if ('' !== $zoom_icon_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_overlay:before', 'declaration' => sprintf('color: %1$s !important;', esc_html($zoom_icon_color))));
        }
        if ('' !== $hover_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_overlay', 'declaration' => sprintf('background-color: %1$s;', esc_html($hover_overlay_color))));
        }
        $container_is_closed = false;
        $args = array('posts_per_page' => (int) $posts_number, 'post_type' => 'staff');
        $et_paged = is_front_page() ? get_query_var('page') : get_query_var('paged');
        if (is_front_page()) {
            $paged = $et_paged;
        }
        if ('' !== $include_categories) {
            $args['tax_query'] = array(array('taxonomy' => 'project_category', 'field' => 'id', 'terms' => explode(',', $include_categories), 'operator' => 'IN'));
        }
        if (!is_search()) {
            $args['paged'] = $et_paged;
        }
        $main_post_class = sprintf('et_pb_portfolio_item%1$s', 'on' !== $fullwidth ? ' et_pb_grid_item' : '');
        ob_start();
        query_posts($args);
        if (have_posts()) {
            while (have_posts()) {
                the_post();
                ?>

				<div id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class($main_post_class);
                ?>
>

			<?php 
                $thumb = '';
                $width = 'on' === $fullwidth ? 1080 : 400;
                $width = (int) apply_filters('et_pb_portfolio_image_width', $width);
                $height = 'on' === $fullwidth ? 9999 : 284;
                $height = (int) apply_filters('et_pb_portfolio_image_height', $height);
                $classtext = 'on' === $fullwidth ? 'et_pb_post_main_image' : '';
                $titletext = get_the_title();
                $thumbnail = get_thumbnail($width, $height, $classtext, $titletext, $titletext, false, 'Blogimage');
                $thumb = $thumbnail["thumb"];
                if ('' !== $thumb) {
                    ?>
					<a href="<?php 
                    the_permalink();
                    ?>
">
					<?php 
                    if ('on' !== $fullwidth) {
                        ?>
						<span class="et_portfolio_image">
					<?php 
                    }
                    ?>
							<?php 
                    print_thumbnail($thumb, $thumbnail["use_timthumb"], $titletext, $width, $height);
                    ?>
					<?php 
                    if ('on' !== $fullwidth) {
                        $data_icon = '' !== $hover_icon ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($hover_icon))) : '';
                        printf('<span class="et_overlay%1$s"%2$s></span>', '' !== $hover_icon ? ' et_pb_inline_icon' : '', $data_icon);
                        ?>
						</span>
					<?php 
                    }
                    ?>
					</a>
			<?php 
                }
                ?>

				<?php 
                if ('on' === $show_title) {
                    ?>
					<h2><a href="<?php 
                    the_permalink();
                    ?>
"><?php 
                    the_title();
                    ?>
</a></h2>
					<h3>et_pb_position</h3>
				<?php 
                }
                ?>

				<?php 
                if ('on' === $show_categories) {
                    ?>
					<p class="post-meta"><?php 
                    echo get_the_term_list(get_the_ID(), 'project_category', '', ', ');
                    ?>
</p>
				<?php 
                }
                ?>

				</div> <!-- .et_pb_portfolio_item -->
	<?php 
            }
            if ('on' === $show_pagination && !is_search()) {
                echo '</div> <!-- .et_pb_portfolio -->';
                $container_is_closed = true;
                if (function_exists('wp_pagenavi')) {
                    wp_pagenavi();
                } else {
                    get_template_part('includes/navigation', 'index');
                }
            }
            wp_reset_query();
        } else {
            get_template_part('includes/no-results', 'index');
        }
        $posts = ob_get_contents();
        ob_end_clean();
        $class = " et_pb_module et_pb_bg_layout_{$background_layout}";
        $output = sprintf('<div%5$s class="%1$s%3$s%6$s">
				%2$s
			%4$s', 'on' === $fullwidth ? 'et_pb_portfolio' : 'et_pb_portfolio_grid clearfix', $posts, esc_attr($class), !$container_is_closed ? '</div> <!-- .et_pb_portfolio -->' : '', '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '');
        return $output;
    }
    function shortcode_callback($atts, $content = null, $function_name)
    {
        $title = $this->shortcode_atts['title'];
        $module_id = $this->shortcode_atts['module_id'];
        $module_class = $this->shortcode_atts['module_class'];
        $fullwidth = $this->shortcode_atts['fullwidth'];
        $include_categories = $this->shortcode_atts['include_categories'];
        $posts_number = $this->shortcode_atts['posts_number'];
        $show_title = $this->shortcode_atts['show_title'];
        $show_date = $this->shortcode_atts['show_date'];
        $background_layout = $this->shortcode_atts['background_layout'];
        $auto = $this->shortcode_atts['auto'];
        $auto_speed = $this->shortcode_atts['auto_speed'];
        $zoom_icon_color = $this->shortcode_atts['zoom_icon_color'];
        $hover_overlay_color = $this->shortcode_atts['hover_overlay_color'];
        $hover_icon = $this->shortcode_atts['hover_icon'];
        $module_class = ET_Builder_Element::add_module_order_class($module_class, $function_name);
        if ('' !== $zoom_icon_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_overlay:before', 'declaration' => sprintf('color: %1$s !important;', esc_html($zoom_icon_color))));
        }
        if ('' !== $hover_overlay_color) {
            ET_Builder_Element::set_style($function_name, array('selector' => '%%order_class%% .et_overlay', 'declaration' => sprintf('background-color: %1$s;
					border-color: %1$s;', esc_html($hover_overlay_color))));
        }
        $args = array();
        if (is_numeric($posts_number) && $posts_number > 0) {
            $args['posts_per_page'] = $posts_number;
        } else {
            $args['nopaging'] = true;
        }
        if ('' !== $include_categories) {
            $args['tax_query'] = array(array('taxonomy' => 'project_category', 'field' => 'id', 'terms' => explode(',', $include_categories), 'operator' => 'IN'));
        }
        $projects = et_divi_get_projects($args);
        ob_start();
        if ($projects->post_count > 0) {
            while ($projects->have_posts()) {
                $projects->the_post();
                ?>
				<div id="post-<?php 
                the_ID();
                ?>
" <?php 
                post_class('et_pb_portfolio_item et_pb_grid_item ');
                ?>
>
				<?php 
                $thumb = '';
                $width = 320;
                $width = (int) apply_filters('et_pb_portfolio_image_width', $width);
                $height = 241;
                $height = (int) apply_filters('et_pb_portfolio_image_height', $height);
                list($thumb_src, $thumb_width, $thumb_height) = wp_get_attachment_image_src(get_post_thumbnail_id(get_the_ID()), array($width, $height));
                $orientation = $thumb_height > $thumb_width ? 'portrait' : 'landscape';
                if ('' !== $thumb_src) {
                    ?>
						<div class="et_pb_portfolio_image <?php 
                    echo esc_attr($orientation);
                    ?>
">
							<a href="<?php 
                    the_permalink();
                    ?>
">
								<img src="<?php 
                    echo esc_attr($thumb_src);
                    ?>
" alt="<?php 
                    echo esc_attr(get_the_title());
                    ?>
"/>
								<div class="meta">
								<?php 
                    $data_icon = '' !== $hover_icon ? sprintf(' data-icon="%1$s"', esc_attr(et_pb_process_font_icon($hover_icon))) : '';
                    printf('<span class="et_overlay%1$s"%2$s>%3$s</span>', '' !== $hover_icon ? ' et_pb_inline_icon' : '', $data_icon, the_excerpt());
                    ?>
									<?php 
                    if ('on' === $show_title) {
                        ?>
										<h3><?php 
                        the_title();
                        ?>
</h3>
									<?php 
                    }
                    ?>

									<?php 
                    if ('on' === $show_date) {
                        ?>
										<p class="post-meta"><?php 
                        echo get_the_date();
                        ?>
</p>
									<?php 
                    }
                    ?>
								</div>
							</a>
						</div>
				<?php 
                }
                ?>
				</div>
				<?php 
            }
        }
        wp_reset_postdata();
        $posts = ob_get_clean();
        $class = " et_pb_module et_pb_bg_layout_{$background_layout}";
        $output = sprintf('<div%4$s class="et_pb_fullwidth_portfolio %1$s%3$s%5$s" data-auto-rotate="%6$s" data-auto-rotate-speed="%7$s">
				%8$s
				<div class="et_pb_portfolio_items clearfix" data-portfolio-columns="">
					%2$s
				</div><!-- .et_pb_portfolio_items -->
			</div> <!-- .et_pb_fullwidth_portfolio -->', 'on' === $fullwidth ? 'et_pb_fullwidth_portfolio_carousel' : 'et_pb_fullwidth_portfolio_grid clearfix', $posts, esc_attr($class), '' !== $module_id ? sprintf(' id="%1$s"', esc_attr($module_id)) : '', '' !== $module_class ? sprintf(' %1$s', esc_attr($module_class)) : '', '' !== $auto && in_array($auto, array('on', 'off')) ? esc_attr($auto) : 'off', '' !== $auto_speed && is_numeric($auto_speed) ? esc_attr($auto_speed) : '7000', '' !== $title ? sprintf('<h2>%s</h2>', esc_html($title)) : '');
        return $output;
    }
            if (has_excerpt()) {
                the_excerpt();
            } else {
                if (in_array($post_format, array('audio', 'map'))) {
                    $excerpt_length = '100';
                } else {
                    $excerpt_length = get_post_thumbnail_id() ? '100' : '230';
                }
                echo wpautop(et_truncate_post($excerpt_length, false));
            }
            if ($show_more) {
                $read_more_class = 'read-more-button';
                $data_icon = '';
                if (isset($custom_read_more) && 'on' === $custom_read_more && isset($read_more_icon) && '' !== $read_more_icon) {
                    $read_more_class .= ' et_pb_inline_icon';
                    $data_icon = et_pb_process_font_icon($read_more_icon);
                }
                ?>

						<a class="<?php 
                echo esc_attr($read_more_class);
                ?>
" data-icon="<?php 
                echo esc_attr($data_icon);
                ?>
" href="<?php 
                the_permalink();
                ?>
"><?php 
                esc_html_e('Read More', 'extra');
                ?>