Viewing 13 replies - 1 through 13 (of 13 total)
  • Roch

    (@rochesterj)

    Hi Bart!

    Thanks for reaching out.

    It is only possible with custom code. At the moment we don’t have many edit options for the ical files in the backend.

    Thanks!

    Thread Starter Bart Van Belle

    (@bartvanbelle)

    is it possible to add this?

    Roch

    (@rochesterj)

    Hi Bart!

    It is, sure. But you’ll need a developer to do that. You need to get the title of the league taxonomy using the WordPress functions (probably using get_term)

    THanks!

    Hi Bart – you can add a hook in the ical file located here :
    /sportspress/feeds/ical.php

    If you include it in the loop here :
    // Loop through each event
    foreach ( $events as $event):

    there is already a check for the
    // Get venue term meta
    $t_id = $venue->term_id;
    $meta = get_option( “taxonomy_$t_id” );

    I’m not sure if the league needs to be accessed for each event, but I would assume so.
    It will live in each event under this array :
    tax_input[sp_league][]

    Roch

    (@rochesterj)

    Wow, great one @corrinarusso, thanks a lot for that ??

    I hope it works fine.

    Hey @rochesterj ,

    I’ve not tested it myself. But I do think it is important to include the league name in the Calendar title.
    I’ll try to implement this week at some point.
    Is there a repository you want me to put it in?
    Or I can just put the snippet in this thread.

    Roch

    (@rochesterj)

    Hi!

    We do accept contributions to our github repo.

    I’m not sure if this one, in particular, can be included, as it depends on each site.

    https://github.com/ThemeBoy/SportsPress/blob/master/CONTRIBUTING.md

    Thanks!

    Thanks @rochesterj

    Right – so League is not a required field in the event.

    I can contribute a gist at least, if people want to use it.

    Thread Starter Bart Van Belle

    (@bartvanbelle)

    i’m interested!

    Roch

    (@rochesterj)

    Hi Bart,

    For now, the quickest way to get this would be applying corrinarusso’s change in your site.

    We can’t guarantee that this for will be implemented as we need to evaluate the impact on other sites.

    Thanks!

    Thread Starter Bart Van Belle

    (@bartvanbelle)

    @corrinarusso

    if you send me the source code of the file i’d love to test it as well

    Hi @bartvanbelle
    I have not had time to test it properly yet. But I will in the next day or two.
    I’ll just provide the snippet into this thread.
    FYI that it will not be a hook, so you will need to keep a backup of the file so you can update SportsPress as they are released. But on Update the file will get overwritten and you will need to reupload the ical file every time there is a SportsPress release.
    d

    @bartvanbelle @rochesterj

    Hi Bart, this worked for me :

    Backup /wp-content/plugins/sportspress/feeds/ical.php
    Open /wp-content/plugins/sportspress/feeds/ical.php

    On line 131 :

    1. Add the function to get the sp_league field:
    $league = get_the_terms( $event->ID, ‘sp_league’ );

    2. Change the $summary to start with the league’s name:
    $summary = $league[0]->name;

    3. Modify the ‘if’ which decides if post_title or team names will be printed:
    $summary .= ‘ – ‘ . implode( ‘ ‘, $results );
    or
    $summary .= ‘ – ‘ . $event->post_title;

    Everything should look like this :

        $league = get_the_terms( $event->ID, 'sp_league' );
        $summary = $league[0]->name;
    	if ( sizeof( $results ) ) {
    		$summary .= ' - ' . implode( ' ', $results );
    	} else {
    		$summary .= ' - ' . $event->post_title;
    	}

    You can download the file from here :
    https://anonymousfiles.io/iNK84RrJ/

    Remember to keep a local copy to re-upload after you update the SportsPress plugin.

    • This reply was modified 5 years, 6 months ago by corrinarusso.
Viewing 13 replies - 1 through 13 (of 13 total)
  • The topic ‘show league in ical feed’ is closed to new replies.