From eddd71da11c44cdef4ad0b5c793baaf084c6b0d2 Mon Sep 17 00:00:00 2001 From: Giucu Date: Tue, 17 Oct 2017 12:16:27 +0300 Subject: [PATCH 1/9] #158 --- assets/js/customizer-preview.js | 34 ++++ assets/js/customizer.js | 171 ++++++++++++++---- functions.php | 1 + .../class-shapely-logo-dimensions.php | 76 ++++++++ inc/customizer.php | 50 ++++- inc/extras.php | 50 ++++- style.css | 26 ++- 7 files changed, 356 insertions(+), 52 deletions(-) create mode 100644 assets/js/customizer-preview.js create mode 100644 inc/custom-controls/class-shapely-logo-dimensions.php diff --git a/assets/js/customizer-preview.js b/assets/js/customizer-preview.js new file mode 100644 index 0000000..f34faa5 --- /dev/null +++ b/assets/js/customizer-preview.js @@ -0,0 +1,34 @@ +(function( $ ) {// jscs:ignore validateLineBreaks + + if ( 'undefined' !== typeof( wp ) ) { + if ( 'undefined' !== typeof( wp.customize ) ) { + wp.customize.bind( 'preview-ready', function() { + wp.customize.preview.bind( 'update-inline-css', function( object ) { + var data = { + 'action': object.action, + 'args': object.data, + 'id': object.id + }; + + jQuery.ajax({ + dataType: 'json', + type: 'POST', + url: WPUrls.ajaxurl, + data: data, + complete: function( json ) { + var sufix = object.action + object.id; + var style = $( '#shapely-style-' + sufix ); + + if ( ! style.length ) { + style = $( 'head' ).append( ' - - - - 'custom-logo logo', + 'itemprop' => 'logo', + ); + /* + * If the logo alt attribute is empty, get the site title and explicitly + * pass it to the attributes used by wp_get_attachment_image(). + */ + $image_alt = get_post_meta( $custom_logo_id, '_wp_attachment_image_alt', true ); + if ( empty( $image_alt ) ) { + $custom_logo_attr['alt'] = get_bloginfo( 'name', 'display' ); + } + /* + * If the alt attribute is not empty, there's no need to explicitly pass + * it because wp_get_attachment_image() already adds the alt attribute. + */ + $html = sprintf( '', + esc_url( home_url( '/' ) ), + wp_get_attachment_image( $custom_logo_id, $dimension, false, $custom_logo_attr ) + ); + } + // If no logo is set but we're in the Customizer, leave a placeholder (needed for the live preview). + elseif ( is_customize_preview() ) { + $html = sprintf( '', + esc_url( home_url( '/' ) ), + esc_html( get_bloginfo( 'name' ) ) + ); + } + + echo $html; + } /* diff --git a/style.css b/style.css index 732c5ac..2e79ee6 100644 --- a/style.css +++ b/style.css @@ -447,8 +447,8 @@ a, a:visited, a:active, a:hover { .main-navigation { clear: both; display: block; - float: left; width: 100%; + padding: 10px 0; } .main-navigation ul { @@ -560,6 +560,11 @@ a, a:visited, a:active, a:hover { #site-navigation .module.left { padding-left: 15px; } +#site-navigation .container > .row { + display: flex; + align-items: center; + justify-content: space-between; +} /*-------------------------------------------------------------- # Accessibility @@ -1366,8 +1371,6 @@ nav .btn, .nav-bar .btn { } .nav-bar { - height: 55px; - max-height: 55px; line-height: 53px; } @@ -1375,19 +1378,16 @@ nav { border-bottom: 1px solid rgba(0, 0, 0, 0.1); } -.nav-bar .module, .nav-bar .module-group { +.nav-bar .module:not( .site-title-container ), +.nav-bar .module-group { height: 55px; } -.nav-bar a { +.nav-bar a:not( .custom-logo-link ) { display: inline-block; height: 55px; } -.logo { - max-height: 60%; -} - .menu > li.dropdown { padding-right: 18px; } @@ -1835,7 +1835,7 @@ nav.fixed.scrolled { width: 84%; } - .nav-bar, .nav-bar .module-group, .nav-bar .module { + .nav-bar, .nav-bar .module-group, .nav-bar .module, .nav-bar .module:not( .site-title-container ) { height: auto; } @@ -1957,6 +1957,12 @@ nav.fixed.scrolled { .mobile-toggle i { line-height: 53px !important; } + #site-navigation .container > .row { + flex-wrap: wrap; + } + .navbar-collapse { + margin-top: 20px; + } } /*!---------- 8. FORMS ----------*/ From c16d71c9543ddf36db0222a2d581beb1b89c2e3c Mon Sep 17 00:00:00 2001 From: Giucu Date: Tue, 17 Oct 2017 14:48:05 +0300 Subject: [PATCH 2/9] #201 #224 --- style.css | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/style.css b/style.css index 2e79ee6..70ded4c 100644 --- a/style.css +++ b/style.css @@ -2948,6 +2948,25 @@ iframe { .project .image-tile { margin: 0; } +.project:not( .masonry-item ) .image-tile { + background-position: center; + background-repeat: no-repeat; + background-size: cover; + height: 100%; + width: 100%; + position: absolute; + top: 0; + left: 0; +} +.project:not( .masonry-item ) .image-tile a { + display: block; + width: 100%; + height: 100%; +} +.project:not( .masonry-item ) { + padding-bottom: 25%; + position: relative; +} /*!---------- 21. FOOTER ----------*/ From eafd274d52432f998bd2692fd5a210d9de537ba1 Mon Sep 17 00:00:00 2001 From: Giucu Date: Thu, 19 Oct 2017 10:31:33 +0300 Subject: [PATCH 3/9] #221 #222 #225 --- archive-jetpack-portfolio.php | 60 ++++-- inc/class-shapely-related-posts.php | 49 ++++- inc/customizer.php | 286 ++++++++++++++++++++++++--- inc/extras.php | 38 +++- inc/template-tags.php | 11 +- single-jetpack-portfolio.php | 37 ++++ style.css | 4 +- template-parts/content-portfolio.php | 134 +++++++++++++ 8 files changed, 566 insertions(+), 53 deletions(-) create mode 100644 single-jetpack-portfolio.php create mode 100644 template-parts/content-portfolio.php diff --git a/archive-jetpack-portfolio.php b/archive-jetpack-portfolio.php index 228b626..d2f4df4 100644 --- a/archive-jetpack-portfolio.php +++ b/archive-jetpack-portfolio.php @@ -1,25 +1,35 @@ +get_header(); -
+$layout = get_theme_mod( 'projects_layout_view', 'mansonry' ); +$layout_class = shapely_get_layout_class(); + +$item_classes = 'post-snippet col-md-3 col-sm-6 project'; +if ( 'mansonry' == $layout ) { + $item_classes .= ' masonry-item'; +} + +?> + +
-
- ' . esc_html( get_theme_mod( 'portfolio_name' ) ) . '' : ''; - echo ( get_theme_mod( 'portfolio_description' ) != '' ) ? '

' . esc_html( get_theme_mod( 'portfolio_description' ) ) . '

' : ''; - ?> -
- -
-
-
+ +
+
+
+
-
-
+ + +
'names', ); $project_types = wp_get_post_terms( $post->ID, 'jetpack-portfolio-type', $projects_args ); + + $thumbnail_url = get_the_post_thumbnail_url( get_the_ID(), 'full' ); + $item_style = ''; + if ( 'mansonry' != $layout ) { + $item_style = 'background-image: url(' . $thumbnail_url . ')'; + } ?> -
- + 0, 'posts_per_page' => $number_posts, 'post__not_in' => array( $post_id ), - // 'meta_key' => '_thumbnail_id', ) ); + if ( is_singular( 'jetpack-portfolio' ) ) { + unset( $args['category__in'] ); + $args['post_type'] = 'jetpack-portfolio'; + + $terms_args = array( + 'fields' => 'ids', + ); + $types = wp_get_object_terms( get_the_ID(), 'jetpack-portfolio-type', $terms_args ); + $tags = wp_get_object_terms( get_the_ID(), 'jetpack-portfolio-tag', $terms_args ); + + $tax_query = array(); + + if ( ! empty( $types ) ) { + array_push( $tax_query, array( + 'taxonomy' => 'jetpack-portfolio-type', + 'field' => 'term_id', + 'terms' => $types, + )); + } + + if ( ! empty( $tags ) ) { + array_push( $tax_query, array( + 'taxonomy' => 'jetpack-portfolio-tag', + 'field' => 'term_id', + 'terms' => $tags, + )); + } + + if ( ! empty( $tax_query ) ) { + $args['tax_query'] = $tax_query; + } + + + } + $related_postquery = new WP_Query( $args ); // reset post query @@ -129,6 +163,13 @@ public function get_related_posts( $post_id, $number_posts = - 1 ) { * @return string HTML markup to display related posts **/ function output_related_posts() { + + if ( is_singular( 'jetpack-portfolio' ) ) { + if ( ! get_theme_mod( 'related_projects_area', true ) ) { + return; + } + } + // Check if related posts should be shown $related_posts = $this->get_related_posts( get_the_ID(), get_option( 'posts_per_page' ) ); @@ -150,7 +191,11 @@ function output_related_posts() { * Heading */ echo ''; echo '
'; diff --git a/inc/customizer.php b/inc/customizer.php index 8316b63..fd1738e 100644 --- a/inc/customizer.php +++ b/inc/customizer.php @@ -275,28 +275,7 @@ function shapely_customizer( $wp_customize ) { 'section' => 'shapely_blog_section', ) ); - if ( post_type_exists( 'jetpack-portfolio' ) ) { - $wp_customize->add_setting( 'portfolio_name', array( - 'default' => '', - 'sanitize_callback' => 'wp_kses_stripslashes', - ) ); - $wp_customize->add_control( 'portfolio_name', array( - 'label' => esc_html__( 'Portfolio Archive Title', 'shapely' ), - 'description' => esc_html__( 'Add a title on the Portfolio Archive Page.', 'shapely' ), - 'section' => 'shapely_main_section', - ) ); - - $wp_customize->add_setting( 'portfolio_description', array( - 'default' => '', - 'sanitize_callback' => 'wp_kses_stripslashes', - ) ); - $wp_customize->add_control( 'portfolio_description', array( - 'type' => 'textarea', - 'label' => esc_html__( 'Portfolio Archive Description', 'shapely' ), - 'description' => esc_html__( 'Add a description on the Portfolio Archive Page.', 'shapely' ), - 'section' => 'shapely_main_section', - ) ); - } + $wp_customize->add_setting( 'footer_callout_text', array( 'default' => '', @@ -569,6 +548,269 @@ function shapely_customizer( $wp_customize ) { ) ); } + if ( post_type_exists( 'jetpack-portfolio' ) ) { + + // Add Projects Settings + $wp_customize->add_panel( 'shapely_projects_options', array( + 'capability' => 'edit_theme_options', + 'theme_supports' => '', + 'title' => esc_html__( 'Projects Settings', 'shapely' ), + 'description' => esc_html__( 'Panel to update projects related options', 'shapely' ), + 'priority' => 10, + ) ); + $wp_customize->add_section( 'shapely_projects_section', array( + 'title' => esc_html__( 'Projects Page Settings', 'shapely' ), + 'panel' => 'shapely_projects_options', + 'priority' => 33, + ) ); + + $wp_customize->add_section( 'shapely_single_project_section', array( + 'title' => esc_html__( 'Project Single Settings', 'shapely' ), + 'panel' => 'shapely_projects_options', + 'priority' => 35, + ) ); + + // Projects Archive Page + $wp_customize->add_setting( 'portfolio_archive_title', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + if ( class_exists( 'Epsilon_Control_Toggle' ) ) { + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'portfolio_archive_title', array( + 'label' => esc_html__( 'Show Portfolio Archive Title', 'shapely' ), + 'description' => esc_html__( 'Show/hide the title from the Portfolio Archive Page', 'shapely' ), + 'section' => 'shapely_projects_section', + ) ) ); + } else { + $wp_customize->add_control( 'portfolio_archive_title', array( + 'label' => esc_html__( 'Show Portfolio Archive Title', 'shapely' ), + 'description' => esc_html__( 'Show/hide the title from the Portfolio Archive Page', 'shapely' ), + 'section' => 'shapely_projects_section', + 'type' => 'checkbox', + ) ); + } + $wp_customize->add_setting( 'portfolio_name', array( + 'default' => '', + 'sanitize_callback' => 'wp_kses_stripslashes', + ) ); + $wp_customize->add_control( 'portfolio_name', array( + 'label' => esc_html__( 'Portfolio Archive Title', 'shapely' ), + 'description' => esc_html__( 'Add a title on the Portfolio Archive Page.', 'shapely' ), + 'section' => 'shapely_projects_section', + ) ); + + $wp_customize->add_setting( 'portfolio_description', array( + 'default' => '', + 'sanitize_callback' => 'wp_kses_post', + ) ); + $wp_customize->add_control( 'portfolio_description', array( + 'type' => 'textarea', + 'label' => esc_html__( 'Portfolio Archive Description', 'shapely' ), + 'description' => esc_html__( 'Add a description on the Portfolio Archive Page.', 'shapely' ), + 'section' => 'shapely_projects_section', + ) ); + + $wp_customize->add_setting( 'projects_layout_view', array( + 'default' => 'mansonry', + 'sanitize_callback' => 'wp_kses_stripslashes', + ) ); + + $wp_customize->add_control( 'projects_layout_view', array( + 'label' => esc_html__( 'Projects Layout', 'shapely' ), + 'description' => esc_html__( 'Choose how you want to display projects', 'shapely' ), + 'section' => 'shapely_projects_section', + 'type' => 'select', + 'choices' => array( + 'mansonry' => esc_html__( 'Masonry', 'shapely' ), + 'grid' => esc_html__( 'Grid', 'shapely' ), + ), + ) ); + + $wp_customize->add_setting( 'projects_layout_template', array( + 'default' => 'full-width', + 'sanitize_callback' => 'shapely_sanitize_blog_layout', + ) ); + + $wp_customize->add_control( 'projects_layout_template', array( + 'label' => esc_html__( 'Projects Template', 'shapely' ), + 'description' => esc_html__( 'Choose the template for your projects archive page', 'shapely' ), + 'section' => 'shapely_projects_section', + 'type' => 'select', + 'choices' => array( + 'full-width' => esc_html__( 'Full Width', 'shapely' ), + 'no-sidebar' => esc_html__( 'No Sidebar', 'shapely' ), + 'sidebar-left' => esc_html__( 'Sidebar Left', 'shapely' ), + 'sidebar-right' => esc_html__( 'Sidebar Right', 'shapely' ), + ), + ) ); + } + + // Single Project + $wp_customize->add_setting( 'project_title_in_header', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'title_above_project', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'project_date', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'project_category', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'project_author', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + + $wp_customize->add_setting( 'project_first_letter_caps', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'project_tags_project_meta', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'related_projects_area', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'project_author_area', array( + 'default' => 1, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'project_author_left_side', array( + 'default' => 0, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + $wp_customize->add_setting( 'project_author_email', array( + 'default' => 0, + 'sanitize_callback' => 'shapely_sanitize_checkbox', + ) ); + + // Single Project Settings + if ( class_exists( 'Epsilon_Control_Toggle' ) ) { + + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'project_title_in_header', array( + 'label' => esc_html__( 'Show title in header', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the project title from callout', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'title_above_project', array( + 'label' => esc_html__( 'Show title above project', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the project title above project content', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'project_date', array( + 'label' => esc_html__( 'Show the date', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the date when project was published', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'project_author', array( + 'label' => esc_html__( 'Show the author', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the author who written the project under the project title', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'project_category', array( + 'label' => esc_html__( 'Show the project type', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the type of project', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'project_first_letter_caps', array( + 'label' => esc_html__( 'First Letter Caps', 'shapely' ), + 'description' => esc_html__( 'This will transform your first letter from a project into uppercase', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'tags_project_meta', array( + 'label' => esc_html__( 'Tags Project Meta', 'shapely' ), + 'description' => esc_html__( 'This will show/hide tags from the end of project', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'related_projects_area', array( + 'label' => esc_html__( 'Related Projects Area', 'shapely' ), + 'description' => esc_html__( 'This will enable/disable the related projects', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'project_author_area', array( + 'label' => esc_html__( 'Project Author Area', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the author box', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'project_author_left_side', array( + 'label' => esc_html__( 'Project Author Left Side', 'shapely' ), + 'description' => esc_html__( 'This will move the author box from the bottom of the project on top on the left side', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + $wp_customize->add_control( new Epsilon_Control_Toggle( $wp_customize, 'project_author_email', array( + 'label' => esc_html__( 'Show Author Email', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the author\'s email from the author box', 'shapely' ), + 'section' => 'shapely_single_project_section', + ) ) ); + } else { + $wp_customize->add_control( 'project_first_letter_caps', array( + 'label' => esc_html__( 'First Letter Caps', 'shapely' ), + 'description' => esc_html__( 'This will transform your first letter from a project into uppercase', 'shapely' ), + 'section' => 'shapely_single_project_section', + 'type' => 'checkbox', + ) ); + $wp_customize->add_control( 'tags_project_meta', array( + 'label' => esc_html__( 'Tags Project Meta', 'shapely' ), + 'description' => esc_html__( 'This will show/hide tags from the end of project', 'shapely' ), + 'section' => 'shapely_single_project_section', + 'type' => 'checkbox', + ) ); + $wp_customize->add_control( 'related_projects_area', array( + 'label' => esc_html__( 'Related Projects Area', 'shapely' ), + 'description' => esc_html__( 'This will enable/disable the related projects', 'shapely' ), + 'section' => 'shapely_single_project_section', + 'type' => 'checkbox', + ) ); + $wp_customize->add_control( 'project_author_area', array( + 'label' => esc_html__( 'Project Author Area', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the author box', 'shapely' ), + 'section' => 'shapely_single_project_section', + 'type' => 'checkbox', + ) ); + $wp_customize->add_control( 'project_author_left_side', array( + 'label' => esc_html__( 'Project Author Left Side', 'shapely' ), + 'description' => esc_html__( 'This will move the author box from the bottom of the project on top on the left side', 'shapely' ), + 'section' => 'shapely_single_project_section', + 'type' => 'checkbox', + ) ); + $wp_customize->add_control( 'project_author_email', array( + 'label' => esc_html__( 'Show Author Email', 'shapely' ), + 'description' => esc_html__( 'This will show/hide the author\'s email from the author box', 'shapely' ), + 'section' => 'shapely_single_project_section', + 'type' => 'checkbox', + ) ); + } // End if(). + $wp_customize->add_setting( 'single_project_layout_template', array( + 'default' => 'sidebar-right', + 'sanitize_callback' => 'shapely_sanitize_blog_layout', + ) ); + + $wp_customize->add_control( 'single_project_layout_template', array( + 'label' => esc_html__( 'Single Project Template', 'shapely' ), + 'description' => esc_html__( 'Set the default template for single project', 'shapely' ), + 'section' => 'shapely_single_project_section', + 'type' => 'select', + 'choices' => array( + 'full-width' => esc_html__( 'Full Width', 'shapely' ), + 'no-sidebar' => esc_html__( 'No Sidebar', 'shapely' ), + 'sidebar-left' => esc_html__( 'Sidebar Left', 'shapely' ), + 'sidebar-right' => esc_html__( 'Sidebar Right', 'shapely' ), + ), + ) ); + } add_action( 'customize_register', 'shapely_customizer' ); diff --git a/inc/extras.php b/inc/extras.php index 01878b2..ae090be 100644 --- a/inc/extras.php +++ b/inc/extras.php @@ -311,6 +311,7 @@ function shapely_author_bio() { $author_description = get_the_author_meta( 'description' ); $author_name = ( '' != trim( $author_nickname ) ) ? $author_nickname : ( trim( $author_displayname ) != '' ) ? $author_displayname : $author_fullname; $show_athor_email = get_theme_mod( 'post_author_email', false ); + $show_project_athor_email = get_theme_mod( 'project_author_email', false ); ?>
@@ -327,7 +328,7 @@ function shapely_author_bio() { echo esc_html( $author_description ); } ?>

- +
', $prev ); + $next = get_next_post_link(); + $next = str_replace( '»', '', $next ); + $next = str_replace( ' +
+
+ +
+
+ +
+
+ + ' . $tags_list . '' : ''; + endif; + ?> + + + From ae1de8e495345531d76cf111ff9dd3a90480c4e0 Mon Sep 17 00:00:00 2001 From: Giucu Date: Thu, 19 Oct 2017 12:48:40 +0300 Subject: [PATCH 4/9] #228 Fixed some header alignment --- assets/js/shapely-scripts.js | 76 ++++++++++++++++++++++++++++++++++-- header.php | 2 +- inc/extras.php | 7 +++- style.css | 2 +- 4 files changed, 80 insertions(+), 7 deletions(-) diff --git a/assets/js/shapely-scripts.js b/assets/js/shapely-scripts.js index 8b30e80..6521516 100644 --- a/assets/js/shapely-scripts.js +++ b/assets/js/shapely-scripts.js @@ -117,10 +117,44 @@ }); $( '.slider-paging-controls' ).flexslider({ animation: 'slide', - directionNav: false + directionNav: false, + after: function (slider){ + if (!slider.playing){ + slider.pause(); + slider.play(); + slider.off( "mouseenter mouseleave" ); + slider.off( "mouseover mouseout" ); + slider.mouseover( function() { + if ( !slider.manualPlay && !slider.manualPause ){ + slider.pause(); + } + }).mouseout( function() { + if (!slider.manualPause && !slider.manualPlay && !slider.stopped){ + slider.play(); + } + }); + } + } }); $( '.slider-arrow-controls' ).flexslider({ - controlNav: false + controlNav: false, + after: function (slider){ + if (!slider.playing){ + slider.pause(); + slider.play(); + slider.off( "mouseenter mouseleave" ); + slider.off( "mouseover mouseout" ); + slider.mouseover( function() { + if ( !slider.manualPlay && !slider.manualPause ){ + slider.pause(); + } + }).mouseout( function() { + if (!slider.manualPause && !slider.manualPlay && !slider.stopped){ + slider.play(); + } + }); + } + } }); $( '.slider-thumb-controls .slides li' ).each(function() { var imgSrc = $( this ).find( 'img' ).attr( 'src' ); @@ -129,7 +163,24 @@ $( '.slider-thumb-controls' ).flexslider({ animation: 'slide', controlNav: 'thumbnails', - directionNav: true + directionNav: true, + after: function (slider){ + if (!slider.playing){ + slider.pause(); + slider.play(); + slider.off( "mouseenter mouseleave" ); + slider.off( "mouseover mouseout" ); + slider.mouseover( function() { + if ( !slider.manualPlay && !slider.manualPause ){ + slider.pause(); + } + }).mouseout( function() { + if (!slider.manualPause && !slider.manualPlay && !slider.stopped){ + slider.play(); + } + }); + } + } }); $( '.logo-carousel' ).flexslider({ minItems: 1, @@ -141,7 +192,24 @@ slideshow: true, slideshowSpeed: 3000, directionNav: false, - controlNav: false + controlNav: false, + after: function (slider){ + if (!slider.playing){ + slider.pause(); + slider.play(); + slider.off( "mouseenter mouseleave" ); + slider.off( "mouseover mouseout" ); + slider.mouseover( function() { + if ( !slider.manualPlay && !slider.manualPause ){ + slider.pause(); + } + }).mouseout( function() { + if (!slider.manualPause && !slider.manualPlay && !slider.stopped){ + slider.play(); + } + }); + } + } }); // Lightbox gallery titles diff --git a/header.php b/header.php index 6dc33d3..1c0c7a6 100644 --- a/header.php +++ b/header.php @@ -28,7 +28,7 @@