From 0e4bfd6bc4393f438cbb913d7957d19e530c7511 Mon Sep 17 00:00:00 2001 From: Eric Eschenbach Date: Thu, 23 Sep 2021 21:59:39 -0400 Subject: [PATCH 1/2] Added efn_reset short code for manually resetting plug Added efn_reset short code for manually resetting plug, which resolves the issue of references duplicating with certain plug-ins. See https://github.com/jasonyingling/easy-footnotes/issues/9 for more information. --- easy-footnotes.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/easy-footnotes.php b/easy-footnotes.php index c0d204a..b1b6a71 100644 --- a/easy-footnotes.php +++ b/easy-footnotes.php @@ -58,6 +58,7 @@ public function __construct() { add_option( 'easy_footnotes_options', $this->footnoteSettings ); add_shortcode( 'note', array( $this, 'easy_footnote_shortcode' ) ); add_shortcode( 'efn_note', array( $this, 'easy_footnote_shortcode' ) ); + add_shortcode( 'efn_reset', array( $this, 'short_code_reset' ) ); add_filter( 'the_content', array( $this, 'easy_footnote_after_content' ), 20 ); add_filter( 'the_content', array( $this, 'easy_footnote_reset' ), 999 ); add_action( 'wp_enqueue_scripts', array( $this, 'register_qtip_scripts' ) ); @@ -241,6 +242,15 @@ public function easy_footnotes_admin_scripts() { wp_enqueue_style( 'easy-footnotes-admin-styles', plugins_url( '/assets/easy-footnotes-admin.css', __FILE__ ), '', '1.0.13' ); wp_enqueue_script( 'easy-footnotes-admin-scripts', plugins_url( '/assets/js/easy-footnotes-admin.js', __FILE__ ), array( 'jquery' ), '1.0.1', true ); } + + /** + * Manually reset footnotes and counter + */ + public function short_code_reset() { + $this->footnoteCount = 0; + $this->footnotes = array(); + return ""; + } } $easyFootnotes = new easyFootnotes(); From 2be9c96bef6fd35803408dac7d2b8212b159dff4 Mon Sep 17 00:00:00 2001 From: Jason Yingling Date: Mon, 11 Nov 2024 23:48:44 -0600 Subject: [PATCH 2/2] updating changelogs --- readme.txt | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/readme.txt b/readme.txt index f734e98..1a2f946 100644 --- a/readme.txt +++ b/readme.txt @@ -63,6 +63,12 @@ Place the following code in your functions.php file to disable the qTip features add_action( 'wp_enqueue_scripts', 'efn_deregister_scripts' ); += How can I reset the footnote count? = + +Use on the beginning of your page with the short code: `[efn_reset][/efn_reset]` + +This is a hard reset to fix a bug with themes/plugins using `do_shortcode( get_the_content() )` outside the main loop and causing duplicate footnotes. 1.1.9 should have updates to not require this. + == Screenshots == 1. Displaying a footnote on hover. @@ -74,6 +80,7 @@ add_action( 'wp_enqueue_scripts', 'efn_deregister_scripts' ); * Adds support for duplicate footnotes using the same number * Fixes a bug with multiple footnotes showing at the bottom when do_shortcode() is run on the_content outside the main loop. * Add better i18n support for the plugin +* Adds [efn_reset] shortcode to reset the footnote count = 1.1.8 = * WordPress 6.6 support