Skip to content

Commit

Permalink
Merge pull request #47 from gravityview/develop
Browse files Browse the repository at this point in the history
Prevent smooth-scrolling in Divi and Kadence
  • Loading branch information
zackkatz authored Sep 27, 2022
2 parents a9d83a1 + bee5a42 commit f135cf6
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 7 deletions.
6 changes: 3 additions & 3 deletions gravityview-az-filters.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,20 @@
* Plugin Name: GravityView - A-Z Filters Extension
* Plugin URI: https://www.gravitykit.com/extensions/a-z-filter/
* Description: Filter your entries by letters of the alphabet.
* Version: 1.3.2
* Version: 1.3.3
* Author: GravityKit
* Author URI: https://www.gravitykit.com
* Author Email: [email protected]
* Requires at least: 4.4
* Tested up to: 6.0.1
* Tested up to: 6.0.2
* Text Domain: gravityview-az-filters
* Domain Path: languages
*/

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/** @since 1.2 */
define( 'GRAVITYVIEW_AZ_FILTER_VERSION', '1.3.2' );
define( 'GRAVITYVIEW_AZ_FILTER_VERSION', '1.3.3' );

/** @since 1.3.2 */
define( 'GRAVITYVIEW_AZ_FILTER_FILE', __FILE__ );
Expand Down
6 changes: 5 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
=== GravityView - A-Z Filters Extension ===
Tags: gravityview
Requires at least: 4.3
Tested up to: 6.0.1
Tested up to: 6.0.2
Stable tag: trunk
Contributors: The GravityKit Team
License: GPL 3 or higher
Expand All @@ -16,6 +16,10 @@ Alphabetically filter your entries by letters of the alphabet.

== Changelog ==

= 1.3.3 on September 27, 2022 =

* Fixed: In Divi and Kadence themes, clicking a filter would not filter results (it would scroll the page instead)

= 1.3.2 on July 31, 2022 =

* Fixed: Issues with plugin auto-updates that was introduced in version 1.2
Expand Down
20 changes: 17 additions & 3 deletions widget/gravityview-a-z-entry-filter-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,15 @@ public function render_alphabet_letters( $args = '', $charset = 'en_US', $upperc
*/
$az_widget_anchor = apply_filters( 'gravityview/az_filter/anchor', '#' . $widget_id_attr, $context );

$output = '<ul class="gravityview-az-filter" id="' . esc_attr( $widget_id_attr ) . '">';
$ul_classes = array(
'gravityview-az-filter',
);

if ( defined( 'ET_CORE_VERSION' ) ) {
$ul_classes[] = 'et_smooth_scroll_disabled';
}

$output = '<ul class="' . gravityview_sanitize_html_class( $ul_classes ) . '" id="' . esc_attr( $widget_id_attr ) . '">';

$output .= $args['before_first_letter'];

Expand All @@ -404,6 +412,12 @@ public function render_alphabet_letters( $args = '', $charset = 'en_US', $upperc

$zero_through_nine = $this->get_zero_through_nine( $charset );

$anchor_classes = array();

if ( defined( 'KADENCE_VERSION' ) ) {
$anchor_classes[] = 'scroll-ignore';
}

foreach ( $alphabet_chars as $char ) { // This is more suited for any alphabet

// If entries exist then change the link for the letter.
Expand Down Expand Up @@ -437,7 +451,7 @@ public function render_alphabet_letters( $args = '', $charset = 'en_US', $upperc

// Outputs the letter to filter the results on click.
$output .= '<li class="' . gravityview_sanitize_html_class( $classes ) . '">';
$output .= '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '">' . esc_html( $char ) . '</a>';
$output .= '<a href="' . esc_url( $link ) . '" title="' . esc_attr( $title ) . '" class="' . gravityview_sanitize_html_class( $anchor_classes ) . '">' . esc_html( $char ) . '</a>';
$output .= '</li>';

}
Expand All @@ -455,7 +469,7 @@ public function render_alphabet_letters( $args = '', $charset = 'en_US', $upperc
$show_all_text = function_exists( 'mb_strtolower' ) ? mb_strtolower( $args['show_all_text'] ) : strtolower( $args['show_all_text'] );
}

$output .= '<li class="last"><span class="show-all"><a href="' . esc_url( remove_query_arg( $pagenum_parameter, remove_query_arg( $this->letter_parameter ) ) . $az_widget_anchor ) . '">' . esc_html( $show_all_text ) . '</a></span></li>';
$output .= '<li class="last"><span class="show-all"><a href="' . esc_url( remove_query_arg( $pagenum_parameter, remove_query_arg( $this->letter_parameter ) ) . $az_widget_anchor ) . '" class="' . gravityview_sanitize_html_class( $anchor_classes ) . '">' . esc_html( $show_all_text ) . '</a></span></li>';
}

$output .= '</ul>';
Expand Down

0 comments on commit f135cf6

Please sign in to comment.