Пример #1
0
 private function parallax_background()
 {
     if (function_exists('ot_register_meta_box')) {
         $my_meta_box = array('id' => 'coll_parallax_meta_box', 'title' => 'Background Settings', 'desc' => __('Setup the background', 'framework'), 'pages' => array('coll-background'), 'context' => 'normal', 'priority' => 'high', 'fields' => array(array('id' => 'coll_bg_type', 'label' => __('Background Type', 'framework'), 'desc' => __('Choose the background type', 'framework'), 'std' => '', 'type' => 'radio', 'class' => '', 'choices' => array(array('value' => 'image', 'label' => __('Image', 'framework')), array('value' => 'pattern', 'label' => __('Pattern', 'framework')), array('value' => 'slider', 'label' => __('Slider', 'framework')), array('value' => 'video', 'label' => __('Video', 'framework')))), array('id' => 'coll_bg_img', 'label' => 'Background Image', 'desc' => 'Select a background image for this section', 'std' => '', 'type' => 'upload', 'class' => 'background-type-image', 'choices' => array()), array('id' => 'coll_bg_pattern', 'label' => 'Background Pattern', 'desc' => 'Select a background pattern for this section', 'std' => '', 'type' => 'upload', 'class' => 'background-type-pattern', 'choices' => array()), array('id' => 'coll_bg_slider_type', 'label' => __('Slider Type', 'framework'), 'desc' => __('Choose the slider type', 'framework'), 'std' => '', 'type' => 'radio', 'class' => 'background-type-slider', 'choices' => array(array('value' => 'flex', 'label' => __('Flex Slider', 'framework')), array('value' => 'layer', 'label' => __('Layer Slider', 'framework')))), array('id' => 'coll_bg_flexslider', 'label' => __('Flex Slider', 'framework'), 'desc' => __('Select a flex slider', 'framework'), 'std' => '', 'type' => 'custom-post-type-select', 'post_type' => 'coll-flexslider', 'class' => 'background-type-slider slider-type-flex', 'choices' => MorpheusUtils::get_flex_sliders()), array('id' => 'coll_bg_layerslider', 'label' => __('Layer Slider', 'framework'), 'desc' => __('Select a layer slider', 'framework'), 'std' => '', 'type' => 'select', 'post_type' => '', 'class' => 'background-type-slider slider-type-layer', 'choices' => MorpheusUtils::get_layer_sliders()), array('id' => 'coll_bg_video', 'label' => 'Background Video', 'desc' => __('Paste your youtube / vimeo iframe embed code here', 'framework'), 'std' => '', 'type' => 'textarea', 'class' => 'background-type-video', 'choices' => array()), array('id' => 'coll_bg_video_mute', 'label' => 'Mute Video', 'desc' => __('Check this if you want the video to be muted', 'framework'), 'std' => '', 'type' => 'checkbox', 'choices' => array(array('label' => 'Yes', 'value' => 'yes')), 'class' => 'background-type-video'), array('id' => 'coll_bg_video_button', 'label' => 'Mute Button', 'desc' => __('Check this if you want to display a mute/unmute button over the video', 'framework'), 'std' => '', 'type' => 'checkbox', 'choices' => array(array('label' => 'Yes', 'value' => 'yes')), 'class' => 'background-type-video'), array('id' => 'coll_bg_video_img', 'label' => __('Image replacement', 'framework'), 'desc' => __('Select an image as a replacement for the video on mobile devices.', 'framework'), 'std' => '', 'type' => 'upload', 'class' => 'background-type-video', 'choices' => array())));
         ot_register_meta_box($my_meta_box);
     }
 }
 public function handleShortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('group' => '', 'width' => 3, 'medium_width' => 6, 'image_type' => '', 'name_color' => '#000', 'class' => ''), $atts));
     // get first if none was provided
     if (empty($group)) {
         $cats = array();
         foreach ((array) get_terms('coll-service-group', array('hide_empty' => false)) as $cat) {
             $cats[] = $cat->slug;
         }
         $group = implode($cats, ', ');
     } else {
     }
     $Qargs = array('post_type' => 'coll-service', 'coll-service-group' => $group, 'posts_per_page' => -1);
     // build it
     $output = '';
     $output .= '<div class="coll-shortcode-services row ' . $class . '">';
     // items
     $loop = new WP_Query($Qargs);
     while ($loop->have_posts()) {
         $loop->the_post();
         global $post;
         // get info
         //$columns = 12 / $columns;
         $class = join(" ", get_post_class());
         $class .= ' large-' . $width . ' medium-' . $medium_width . ' columns';
         $tmb_html = '';
         if (has_post_thumbnail($post->ID)) {
             $data = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), 'thumbnail');
             if ($image_type == 'round') {
                 $tmb_html .= '<div  class="coll-image-wrapper round">';
             } else {
                 $tmb_html .= '<div class="coll-image-wrapper">';
             }
             $tmb_html .= '<img  class="image"
                                 src="' . $data[0] . '"
                                 alt="' . get_the_title($post->ID) . '" />';
             $tmb_html .= '</div>';
         }
         // build
         $output .= '<article id="' . $post->post_name . '" class="' . $class . '" >';
         $output .= '<div class="js-coll-inner">';
         $output .= $tmb_html;
         $output .= '<div class="title">';
         $output .= '<h4 class="text" style="color : ' . $name_color . '">' . get_the_title() . '</h4>';
         $output .= '</div>';
         $output .= '<div class="content">' . MorpheusUtils::get_the_content(get_the_ID()) . '</div>';
         $output .= '</div>';
         $output .= '</article>';
     }
     //end items
     $output .= '</div>';
     // end team ;
     wp_reset_postdata();
     return $output;
 }
 public function handleShortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('group' => ''), $atts));
     $Qargs = array('post_type' => 'coll-page-section', 'tax_query' => array(array('taxonomy' => 'coll-page-section-group', 'field' => 'slug', 'terms' => $group, 'operator' => 'IN')), 'order' => 'ASC', 'orderby' => 'menu_order', 'posts_per_page' => -1);
     global $coll_is_mobile;
     $output = '';
     $loop = new WP_Query($Qargs);
     while ($loop->have_posts()) {
         $loop->the_post();
         global $post;
         // get info
         // section
         $sclasses = array();
         $sclasses[] = 'page-section';
         $sfullh = get_post_meta(get_the_ID(), 'coll_full_height', true);
         if ($sfullh) {
             $sclasses[] = 'coll-full-height';
         }
         $sfullw = get_post_meta(get_the_ID(), 'coll_full_width', true);
         if ($sfullw) {
             $sclasses[] = 'coll-full-width';
         }
         $scontenth = get_post_meta(get_the_ID(), 'coll_content_high', true);
         if (!$scontenth) {
             $sclasses[] = 'js-coll-window-min';
         }
         // title
         $showTitle = get_post_meta(get_the_ID(), 'coll_hide_title', true) ? 'coll-hide-title' : '';
         $subtitle = get_post_meta(get_the_ID(), 'coll_subtitle', true);
         $titleColor = get_post_meta(get_the_ID(), 'coll_title_color', true);
         $subtitleColor = get_post_meta(get_the_ID(), 'coll_subtitle_color', true);
         $borderColor = get_post_meta(get_the_ID(), 'coll_border_color', true);
         $titleBorder = $borderColor ? 'style="border-bottom: 1px solid ' . $borderColor . '"' : '';
         // background
         $bgclasses = array();
         $bgclasses[] = 'coll-section-background';
         $bgclasses[] = 'js-coll-parallax';
         $bgColor = get_post_meta(get_the_ID(), 'coll_bg_color', true);
         $bgParallax = get_post_meta(get_the_ID(), 'coll_bg_parallax', true);
         $bgOverlay = get_post_meta(get_the_ID(), 'coll_bg_overlay', true);
         $bgOverlayOpacity = get_post_meta(get_the_ID(), 'coll_bg_overlay_opacity', true);
         // start background
         $bg_output = '';
         $bg_output .= '<div class="' . implode($bgclasses, ' ') . '"  style="background-color: ' . $bgColor . '" >';
         if (!empty($bgParallax)) {
             $bgtype = get_post_meta($bgParallax, 'coll_bg_type', true);
             switch ($bgtype) {
                 case 'image':
                     $bgImg = get_post_meta($bgParallax, 'coll_bg_img', true);
                     $dim = wp_get_attachment_image_src(coll_get_attachment_id($bgImg), 'full');
                     $bg_output .= '<img class="coll-bg-image js-coll-lazy"
                                 width="' . $dim[1] . '"
                                 height="' . $dim[2] . '"
                                 data-coll-ar="' . $dim[1] / $dim[2] . '"
                                 data-coll-src="' . $bgImg . '"
                                 alt="bg image" />';
                     break;
                 case 'pattern':
                     $bgPattern = get_post_meta($bgParallax, 'coll_bg_pattern', true);
                     $bg_output .= '<div class="coll-bg-pattern" style="background: url(' . $bgPattern . ') repeat" >';
                     break;
                 case 'slider':
                     $bgSliderType = get_post_meta($bgParallax, 'coll_bg_slider_type', true);
                     if ($bgSliderType == 'flex') {
                         $bgSliderId = get_post_meta($bgParallax, 'coll_bg_flexslider', true);
                         //$bg_output .= '<div class="coll-layerslider coll-bg-slider">';
                         $bg_output .= do_shortcode('[coll_flexslider id="' . $bgSliderId . '" class="coll-bg-slider"]');
                         // $bg_output .= '</div>';
                     }
                     if ($bgSliderType == 'layer') {
                         $bgSliderId = get_post_meta($bgParallax, 'coll_bg_layerslider', true);
                         $bg_output .= '<div class="coll-layerslider coll-bg-slider">';
                         $bg_output .= do_shortcode('[layerslider id="' . $bgSliderId . '"]');
                         $bg_output .= '</div>';
                     }
                     break;
                 case 'video':
                     $bgVideo = get_post_meta($bgParallax, 'coll_bg_video', true);
                     $bgMute = get_post_meta($bgParallax, 'coll_bg_video_mute', true);
                     if ($bgMute) {
                         $bgMute = 'coll-to-mute';
                     }
                     $bgMuteButton = get_post_meta($bgParallax, 'coll_bg_video_button', true);
                     $bgRepImg = get_post_meta($bgParallax, 'coll_bg_video_img', true);
                     $bgVideo = MorpheusUtils::fix_video($bgVideo);
                     $bg_output .= '<div class="coll-bg-video ' . $bgMute . '" >';
                     $bg_output .= $bgVideo;
                     $bg_output .= '<img class="coll-replacement" src="' . $bgRepImg . '" alt="bg image"/>';
                     $bg_output .= '</div>';
                     $bg_output .= '<div class="coll-bg-video-overlay"></div>';
                     if ($bgMuteButton) {
                         $bg_output .= '<div class="coll-bg-video-mute">';
                         $bg_output .= '<a href="#" class="js-coll-video-sound"><i class="fa"></i></a>';
                         $bg_output .= '</div>';
                     }
                     break;
                 default:
             }
         }
         // background overlay
         if ($bgOverlay) {
             $style = '';
             if (!empty($bgOverlay['background-color'])) {
                 $style .= "background-color: " . $bgOverlay['background-color'] . ";\n\t";
             }
             if (!empty($bgOverlay['background-repeat'])) {
                 $style .= "background-repeat: " . $bgOverlay['background-repeat'] . ";\n\t";
             }
             if (!empty($bgOverlay['background-attachment'])) {
                 $style .= "background-attachment: " . $bgOverlay['background-attachment'] . ";\n\t";
             }
             if (!empty($bgOverlay['background-position'])) {
                 $style .= "background-position: " . $bgOverlay['background-position'] . ";\n\t";
             }
             if (!empty($bgOverlay['background-image'])) {
                 $style .= "background-image: url(" . $bgOverlay['background-image'] . ");\n";
             }
             if ($bgOverlayOpacity) {
                 $style .= 'opacity:' . $bgOverlayOpacity;
             }
             $bg_output .= '<div class="overlay" style="' . $style . '" ></div>';
         }
         $bg_output .= '</div>';
         // end background
         // build  section
         $output .= '<section id="' . $post->post_name . '" class="' . implode(get_post_class($sclasses, get_the_ID()), ' ') . '">';
         $output .= $bg_output;
         $output .= '<div class="section-content row">';
         $output .= '<div class="columns entry-title ' . $showTitle . '" ' . $titleBorder . '>';
         $output .= '<h2 class="title" style="color: ' . $titleColor . '">' . get_the_title() . '</h2>';
         $output .= '<h4 class="subtitle" style="color: ' . $subtitleColor . '">' . $subtitle . '</h4>';
         $output .= '</div>';
         $output .= '<div class="entry-content columns">';
         $output .= apply_filters('the_content', get_the_content());
         $output .= '</div>';
         $output .= '</div>';
         $output .= '</section>';
     }
     wp_reset_postdata();
     return $output;
 }
                                            });
                                            </script>';
                                $bg_output .= '</div>';
                            }
                            break;
                        case 'video':
                            $bgVideo = get_post_meta($bgParallax, 'coll_bg_video', true);
                            $bgMute = get_post_meta($bgParallax, 'coll_bg_video_mute', true);
                            $bgMuteButton = get_post_meta($bgParallax, 'coll_bg_video_button', true);
                            $bgRepImg = get_post_meta($bgParallax, 'coll_bg_video_img', true);
                            if (!$coll_is_mobile) {
                                if ($bgMute) {
                                    $bgMute = 'coll-to-mute';
                                }
                                $bgVideo = MorpheusUtils::fix_video($bgVideo);
                                $bg_output .= '<div class="coll-bg-video ' . $bgMute . '" >';
                                $bg_output .= $bgVideo;
                                $bg_output .= '</div>';
                                $bg_output .= '<div class="coll-bg-video-overlay"></div>';
                                if ($bgMuteButton) {
                                    $bg_output .= '<div class="coll-bg-video-mute">';
                                    $bg_output .= '<a href="#" class="js-coll-video-sound"><i class="fa"></i></a>';
                                    $bg_output .= '</div>';
                                }
                            } else {
                                if (!empty($bgRepImg)) {
                                    $image = wp_get_attachment_image_src(coll_get_attachment_id($bgRepImg), 'full');
                                    $bg_output .= '<img class="coll-bg-image js-coll-lazy"
					                                    src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABAQMAAAAl21bKAAAAA1BMVEUAAACnej3aAAAAAXRSTlMAQObYZgAAAApJREFUCNdjYAAAAAIAAeIhvDMAAAAASUVORK5CYII="
					                                    width="' . $image[1] . '"
 public function handleShortcode($atts, $content = null)
 {
     extract(shortcode_atts(array('table' => '', 'width' => 3, 'medium_width' => 6, 'title_color' => '#000', 'text_color' => '#bbb', 'link_hover_color' => '#fff', 'link_hover_color_background' => ot_get_option('coll_accent_color'), 'bg_color' => '', 'class' => ''), $atts));
     // bg
     if (!empty($bg_color)) {
         $bg_color = 'style="background-color:' . $bg_color . '" ';
     }
     // get first if none was provided
     if (empty($table)) {
         $cats = array();
         foreach ((array) get_terms('coll-pricing-table', array('hide_empty' => false)) as $cat) {
             $cats[] = $cat->slug;
         }
         $table = implode($cats, ', ');
     } else {
     }
     $Qargs = array('post_type' => 'coll-pricing', 'coll-pricing-table' => $table, 'posts_per_page' => -1);
     // build it
     $output = '';
     $output .= '<div class="coll-shortcode-pricing-table row ' . $class . '">';
     // items
     $loop = new WP_Query($Qargs);
     while ($loop->have_posts()) {
         $loop->the_post();
         global $post;
         // get info
         $class = join(" ", get_post_class());
         $class .= ' large-' . $width . ' medium-' . $medium_width . ' columns';
         $link_url = get_post_meta(get_the_ID(), 'coll_link_url', true);
         $link_text = get_post_meta(get_the_ID(), 'coll_link_text', true);
         $price = get_post_meta(get_the_ID(), 'coll_price', true);
         $standout = get_post_meta(get_the_ID(), 'coll_standout', true);
         $standout = $standout ? 'standout' : '';
         // build
         $output .= '<article id="' . $post->post_name . '" class="' . $class . '" style="color : ' . $text_color . '">';
         $output .= '<div class="wrapper ' . $standout . '" ' . $bg_color . '>';
         $output .= '<div class="js-coll-inner">';
         $output .= '<div class="title">';
         $output .= '<h3 class="text" style="color : ' . $title_color . '">' . get_the_title() . '</h3>';
         $output .= '</div>';
         $output .= '<div class="price">';
         $output .= '<p class="text">' . $price . '</p>';
         $output .= '</div>';
         $output .= '<div class="content">' . MorpheusUtils::get_the_content(get_the_ID());
         if (!empty($link_url)) {
             $output .= '<div class="link">';
             $output .= '<a  class="coll-button js-coll-pt-purchase"
                             href="' . $link_url . '"
                             data-coll-color-hover="' . $link_hover_color . '"
                             data-coll-background-color-hover="' . $link_hover_color_background . '"
                             >' . $link_text . '</a>';
             $output .= '</div>';
         }
         $output .= '</div>';
         $output .= '</div>';
         $output .= '</div>';
         $output .= '</article>';
     }
     //end items
     $output .= '</div>';
     // end team ;
     wp_reset_postdata();
     return $output;
 }