Plugin Directory

Changeset 3278222


Ignore:
Timestamp:
04/21/2025 01:55:28 PM (10 months ago)
Author:
duncanwhite
Message:

fix bug of multiple matchcards

Location:
english-chess-data/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • english-chess-data/trunk/README.txt

    r3189723 r3278222  
    55Requires at least: 6.4.3
    66Tested up to: 6.7
    7 Stable tag: 1.0.1
     7Stable tag: 1.0.2
    88Requires PHP: 7.4
    99License: GPLv2 or later
     
    5757* Adds Matchcards
    5858* Allows filtering of Fixtures and Results by Event
     59= 1.0.2 =
     60* Fixes Bug where Matchcards are duplicated, if multiple shortcodes are used on the same page.
    5961
    6062== Limitations / Improvements ==
  • english-chess-data/trunk/public/class-echd-league-data-public-fixtures.php

    r3189723 r3278222  
    1717     */
    1818    private string $event_name;
     19
     20    private int $match_cards = 0;
    1921
    2022    /**
     
    5456            $this->event_name = esc_attr(sanitize_text_field($atts['event_name']));
    5557        }
     58        $match_title = get_query_var('match');
     59        $league_name = get_query_var('league');
     60        if ($match_title && $league_name) {
     61            return "";
     62        }
    5663        return $this->get_fixture_list(false);
    5764    }
     
    6572        $league_name = get_query_var('league');
    6673        if ($match_title && $league_name) {
     74            if ($this->match_cards >= 1) {
     75                return ""; // Avoid repeating matchcards if page is using multiple shortcodes
     76            }
     77            $this->match_cards++;
    6778            return $this->get_match($match_title, $league_name);
    6879        }
  • english-chess-data/trunk/public/class-echd-league-data-public-table.php

    r3189723 r3278222  
    5050    public function display_league_table($atts): string
    5151    {
     52
     53        $match_title = get_query_var('match');
     54        $league_name = get_query_var('league');
     55        if ($match_title && $league_name) {
     56            return "";
     57        }
    5258
    5359        if (is_array($atts) && array_key_exists('event_name', $atts)) {
Note: See TracChangeset for help on using the changeset viewer.