• Resolved amtino

    (@amtino)


    I put between 50-100 scores into my SportsPress site every night and would like to automate the process of changing the title of events after the games go final. I do not know how to change the relevant code to get the desired outcome, but I’d like SportsPress to write the event title in the following format:
    LEAGUE: WINNING TEAM xx, LOSING TEAM xx
    if the title field is blank and score information is entered when the event is updated. That way all titles are entered correctly and uniformly every time, we get the final scores listed in the title of Google search results and the score can be automatically tweeted upon editing the event.

    Here is the relevant section of code that generates the team names in the event title.

    * Auto-generate an event title based on the team playing if left blank.
    	 *
    	 * @param array $data
    	 * @return array
    	 */
    	public function wp_insert_post_data( $data, $postarr ) {
    		if ( $data['post_type'] == 'sp_event' && $data['post_title'] == '' ):
    			$teams = sp_array_value( $postarr, 'sp_team', array() );
    			$teams = array_filter( $teams );
    			$team_names = array();
    			foreach ( $teams as $team ):
    				while ( is_array( $team ) ) {
    					$team = array_shift( array_filter( $team ) );
    				}
    				if ( $team > 0 ) $team_names[] = get_the_title( $team );
    			endforeach;
    			$team_names = array_unique( $team_names );
    			$data['post_title'] = implode( ' ' . get_option( 'sportspress_event_teams_delimiter', 'vs' ) . ' ', $team_names );
    		endif;
    		return $data;
    	}

    https://www.ads-software.com/plugins/sportspress/

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

    (@rochesterj)

    Hi!

    This will require more custom code than we can provide in the free support unfortunately.

    Kind Regards,
    -Roch

    Thread Starter amtino

    (@amtino)

    We have a Club license for our site, please let me know if there’s a more appropriate avenue for reaching out for help on this. ??

    Roch

    (@rochesterj)

    Hi!

    Oh, then the right place will be this one: https://support.themeboy.com/ ??

    Let me know how it works there!

    Kind Regards,
    -Roch

    Since we haven’t heard back from you, I’ll set this one as resolved.

    Please, let us know if you need anything else.

    Kind Regards,
    -Roch

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Automatically generate final scores in title’ is closed to new replies.