''), $atts, 'masterslider' ) ); return get_masterslider( $id ); } /*-----------------------------------------------------------------------------------*/ /* MasterSlider Page Builder Element /*-----------------------------------------------------------------------------------*/ add_shortcode( 'masterslider_pb', 'msp_masterslider_pb_shortcode' ); function msp_masterslider_pb_shortcode( $atts, $content = null ) { $mixed = shortcode_atts( array( 'id' => '', 'title' => '', 'class' => '' ), $atts, 'masterslider_pb' ); extract( $mixed ); $wrapper_open_tag = sprintf( '
'; $slider_markup = get_masterslider( $id ); $output = $wrapper_open_tag . $the_title_tag . $slider_markup . $wrapper_close_tag; return apply_filters( 'masterslider_pb_shortcode', $output, $slider_markup, $wrapper_open_tag, $the_title_tag, $wrapper_close_tag ); } /*-----------------------------------------------------------------------------------*/ /* MasterSlider Wrapper /*-----------------------------------------------------------------------------------*/ add_shortcode( 'ms_slider', 'msp_masterslider_wrapper_shortcode' ); function msp_masterslider_wrapper_shortcode( $atts, $content = null ) { $mixed = shortcode_atts( array( 'id' => '1', // slider id 'uid' => '', // an unique and temporary id 'class' => '', // a class that adds to slider wrapper 'margin' => 0, 'inline_style' => '', 'bg_color' => '', 'bg_image' => '', 'slider_type' => 'custom', // values: custom, flickr, facebook, post 'width' => 300, // base width of slides. It helps the slider to resize in correct ratio. 'height' => 150, // base height of slides, It helps the slider to resize in correct ratio. 'min_height' => 0, 'start' => 1, 'space' => 0, 'grab_cursor' => 'true', // Whether the slider uses grab mouse cursor 'swipe' => 'true', // Whether the drag/swipe navigation is enabled 'wheel' => 'false', // Enables mouse scroll wheel navigation 'mouse' => 'true', // Whether the user can use mouse drag navigation 'crop' => 'false', // Automatically crop slide images? 'autoplay' => 'false', // Enables the autoplay slideshow 'loop' => 'false', // 'shuffle' => 'false', // Enables the shuffle slide order 'preload' => 0, 'wrapper_width' => '', 'wrapper_width_unit' => 'px', 'fullwidth' => 'false', // It enables the slider to adapt width to its parent element 'fullheight' => 'false', // It enables the slider to adapt height to its parent element 'autofill' => 'false', // It enables the slider to adapt width and height to its parent element 'layout' => 'fillwidth', 'fullscreen_margin' => 0, 'height_limit' => 'false', // It force the slide to use max height value as its base specified height value. 'auto_height' => 'false', 'smooth_height' => 'true', 'end_pause' => 'false', 'over_pause' => 'false', 'fill_mode' => 'fill', 'center_controls'=> 'true', 'layers_mode' => 'center',// It accepts two values "center" and "full" 'hide_layers' => 'false', 'instant_show_layers' => 'false', 'speed' => 17, 'skin' => 'ms-skin-default', // slider skin. should be seperated by space - should be started by ms-skin 'template' => '', 'template_class'=> '', 'direction' => 'h', 'view' => 'basic', 'gfonts' => '', 'parallax_mode' => 'swipe', 'start_on_appear'=> 'false', 'flickr_key' => '', 'flickr_id' => '', 'flickr_count' => 10, 'flickr_type' => 'photos', 'flickr_size' => 'c', 'flickr_thumb_size' => 'q', 'facebook_username' => '', 'facebook_albumid' => '', 'facebook_count' => 10, 'facebook_type' => 'album', 'facebook_size' => 'orginal', 'facebook_thumb_size' => '320', 'ps_post_type' => '', 'ps_tax_term_ids' => '', 'ps_post_count' => 10, 'ps_image_from' => 'auto', 'ps_order' => 'DESC', 'ps_orderby' => 'menu_order date', 'ps_posts_not_in' => '', 'ps_excerpt_len' => 100, 'ps_offset' => 0, 'ps_link_slide' => false, 'ps_link_target' => '_self', 'ps_slide_bg' => '', 'arrows' => 'true', // display arrows? 'arrows_autohide' => 'true', // auto hide arrows? 'arrows_overvideo' => 'true', // visible over slide video while playing? 'arrows_hideunder' => '', 'bullets' => 'false', // display bullets? 'bullets_autohide' => 'true', // auto hide bullets? 'bullets_overvideo'=> 'true', // visible over slide video while playing? 'bullets_direction'=> 'h', 'bullets_align' => 'bottom', 'bullets_margin' => '', 'bullets_hideunder'=> '', 'thumbs' => 'false', // display thumbnails? 'thumbs_autohide' => 'true', // auto hide thumbs? 'thumbs_overvideo' => 'true', // visible over slide video while playing? 'thumbs_direction' => 'h', // direction of control 'thumbs_type' => 'thumbs', 'thumbs_speed' => 17, // scrolling speed. It accepts float values between 0 and 100 'thumbs_inset' => 'true', // insert thumbs inside slider 'thumbs_align' => 'bottom', 'thumbs_margin' => 0, 'thumbs_width' => 100, 'thumbs_height' => 80, 'thumbs_space' => 5, 'thumbs_hideunder' => '', 'thumbs_fillmode' => 'fill', 'thumbs_arrows' => 'false', 'thumbs_in_tab' => 'false', 'thumbs_hoverchange'=> 'false', 'scroll' => 'false', // display scrollbar? 'scroll_autohide' => 'true', // auto hide scroll? 'scroll_overvideo' => 'true', // visible over slide video while playing? 'scroll_direction' => 'h', // direction of control 'scroll_align' => 'top', 'scroll_inset' => 'true', 'scroll_margin' => '', 'scroll_color' => '#3D3D3D', 'scroll_hideunder' => '', 'scroll_width' => '', 'circletimer' => 'false', // display circletimer? 'circletimer_autohide' => 'true', // auto hide circletimer? 'circletimer_overvideo'=> 'true', // visible over slide video while playing? 'circletimer_color' => '#A2A2A2',// color of circle timer 'circletimer_radius' => 4, // radius of circle timer in pixels 'circletimer_stroke' => 10, // the stroke of circle timer in pixels 'circletimer_margin' => '', 'circletimer_hideunder'=> '', 'timebar' => 'false', // display timebar? 'timebar_autohide' => 'true', // auto hide timebar? 'timebar_overvideo'=> 'true', // visible over slide video while playing? 'timebar_align' => 'bottom', 'timebar_color' => '#FFFFFF', 'timebar_hideunder'=> '', 'timebar_width' => '', 'slideinfo' => 'false', // display timebar? 'slideinfo_autohide' => 'true', // auto hide timebar? 'slideinfo_overvideo'=> 'true', // visible over slide video while playing? 'slideinfo_direction'=> 'h', 'slideinfo_align' => 'bottom', 'slideinfo_inset' => 'false', 'slideinfo_margin' => '', 'slideinfo_hideunder'=> '', 'slideinfo_width' => '', 'slideinfo_height' => '', 'on_init' => '', 'on_change_start' => '', 'on_change_end' => '', 'on_waiting' => '', 'on_resize' => '', 'on_video_play' => '', 'on_video_close' => '', 'on_swipe_start' => '', 'on_swipe_move' => '', 'on_swipe_end' => '' ) , $atts , 'ms_slider' ); extract( $mixed ); // load masterslider script wp_enqueue_style ( 'masterslider-main'); wp_enqueue_script( 'masterslider-core'); wp_enqueue_script( 'prettyPhoto' ); // create an unique id for slider $uid = empty($uid ) ? uniqid("MS") : $uid; // unique id for parant wrapper $puid = 'P_' . $uid; // class name for slider template $template_class = empty( $template_class ) ? '' : esc_attr( $template_class ); $preload = is_numeric($preload) ? ( (int)$preload + 1 ) : "'$preload'"; // add max-width to wrapper for boxed and partialview layout if( ! empty( $wrapper_width ) && ( 'boxed' == $layout || 'partialview' == $layout ) ) { // validate wrapper_width_unit $wrapper_width_unit = in_array( $wrapper_width_unit, array( 'px', '%', 'em' ) ) ? $wrapper_width_unit : 'px'; $inline_style .= sprintf( 'max-width:%s%s;', $wrapper_width, $wrapper_width_unit ); // if wrapper_width is not set use slider width as default } elseif ( 'boxed' == $layout ) { $inline_style .= sprintf( 'max-width:%spx;', $width ); // if wrapper_width is not set the value to 100% } elseif ( 'partialview' == $layout ) { $inline_style .= 'max-width:100%;'; } $inline_style = empty( $inline_style ) ? '' : sprintf( 'style="%s" ', esc_attr( $inline_style ) ); $arrows_hideunder = empty( $arrows_hideunder ) ? '' : sprintf( ', hideUnder:%s', $arrows_hideunder ); $bullets_hideunder = empty( $bullets_hideunder ) ? '' : sprintf( ', hideUnder:%s', $bullets_hideunder ); $thumbs_hideunder = empty( $thumbs_hideunder ) ? '' : sprintf( ', hideUnder:%s', $thumbs_hideunder ); $scroll_hideunder = empty( $scroll_hideunder ) ? '' : sprintf( ', hideUnder:%s', $scroll_hideunder ); $timebar_hideunder = empty( $timebar_hideunder ) ? '' : sprintf( ', hideUnder:%s', $timebar_hideunder ); $slideinfo_hideunder = empty( $slideinfo_hideunder ) ? '' : sprintf( ', hideUnder:%s', $slideinfo_hideunder ); $circletimer_hideunder = empty( $circletimer_hideunder ) ? '' : sprintf( ', hideUnder:%s', $circletimer_hideunder ); $bullets_margin = empty( $bullets_margin ) ? '' : sprintf( ', margin:%s', $bullets_margin ); $circletimer_margin = empty( $circletimer_margin )? '' : sprintf( ', margin:%s', $circletimer_margin ); $scroll_margin = empty( $scroll_margin ) ? '' : sprintf( ', margin:%s', $scroll_margin ); $slideinfo_margin = empty( $slideinfo_margin ) ? '' : sprintf( ', margin:%s', $slideinfo_margin ); $timebar_width = empty( $timebar_width ) ? '' : sprintf( ', width:%s', $timebar_width ); $scroll_width = empty( $scroll_width ) ? '' : sprintf( ', width:%s', $scroll_width ); if ( in_array( $bullets_align, array('left', 'right') ) ) $bullets_direction = 'v'; if ( in_array( $bullets_align, array('top', 'bottom') ) ) $bullets_direction = 'h'; if ( in_array( $thumbs_align, array('left', 'right') ) ) $thumbs_direction = 'v'; if ( in_array( $thumbs_align, array('top', 'bottom') ) ) $thumbs_direction = 'h'; if ( in_array( $scroll_align, array('left', 'right') ) ) $scroll_direction = 'v'; if ( in_array( $scroll_align, array('top', 'bottom') ) ) $scroll_direction = 'h'; if ( in_array( $slideinfo_align, array('left', 'right') ) ) $slideinfo_direction = 'v'; if ( in_array( $slideinfo_align, array('top', 'bottom') ) ) $slideinfo_direction = 'h'; // set slideinfo size to spefified height is direction is horizontal, else set it to width if( empty( $slideinfo_width ) && empty( $slideinfo_height ) ) { $slideinfo_size = ''; } elseif( 'h' == $slideinfo_direction ){ $slideinfo_size = sprintf( ', size:%s', $slideinfo_height ); } else { $slideinfo_size = sprintf( ', size:%s', $slideinfo_width ); } $instance_suffix = substr($uid, -4); // slider javascript instance name $instance_name = "masterslider_".$instance_suffix; // stores inner markup for some spesific templates $inner_template_container_open_tags = ''; $inner_template_container_close_tags = ''; if( 'laptop' == $template ){ $inner_template_container_open_tags = sprintf( '