Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Allow filtering for multiple leagues #424

Open
sgurlt opened this issue Nov 22, 2021 · 1 comment
Open

Feature: Allow filtering for multiple leagues #424

sgurlt opened this issue Nov 22, 2021 · 1 comment

Comments

@sgurlt
Copy link

sgurlt commented Nov 22, 2021

Within my custom theme, I would like to be able to get data from the calendar for one, or multiple leagues.
At the Moment this is not possible due to the fact that the handled $this->league variable, always gets casted into an array.

To be able to handle one or multiple values, I would like to add a check if the handed in data is already an array, or not.

This might also be useful for seasons and venues, but is currently outside the scope of my project.

Pull Request: #423

Detailed explanation
The Theme I am using is "Goodlayers - BigSlam" - https://goodlayers.com/portfolio/bigslam/
It is providing a layout builder block that allows to show events. The events can be filtered by: league, venue, season and more.
The block can be used within a shortcode, like e.g.:

[event_list title="" team="5383" league="150" season="45" venue="0" status="future" date="default" day="" number="4" order="ASC" columns="event,teams,time,league,season,venue,article" show_all_events_link="0" align="none" item_style="featured" recap_button="no"]

For the league it is possible to filter by exactly one league, or show them all:

league="150" or league=""

In addition, I would like to have the possibility to filter by multiple leagues: league="150,148,145"

To allow that, I have adjusted the themes template within my child theme to process the data as follows:

.
.
.
if ( $league ) {
	if ( strpos($league, ',') ) {
		$calendar->league = explode(',', $league);
    } else {
		$calendar->league = $league;
    }
}
.
.
.
$data       = $calendar->data();
.
.
.

// handle data ....

The last step that is missing in the chain is the adjustment of the data() method within sportspress to alllow handling multiple leagues.

@sgurlt
Copy link
Author

sgurlt commented Mar 14, 2022

Any news on that?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant