• I was wanting to combine the profile page I have for my users and the player pages, I’ve tried adding the following to my profile page template, but however $current_teams ends up empty

    if ( ! isset( $id ) )
    		$id = get_the_ID();
    	$defaults = array('show_nationality_flags' => get_option( 'sportspress_player_show_flags', 'yes' ) == 'yes' ? true : false,);
    	extract( $defaults, EXTR_SKIP );
    	$player = new SP_Player( $id );
    	$current_teams = $player->current_teams();
    	$metrics_before = $player->metrics( true );
    	$metrics_after = $player->metrics( false );
    $html .='<div id="player_team_info" style="overflow:auto;margin-bottom:15px>';
    	$html .='<label id="current_team">Current Teams</label>';
    	if ( $current_teams ):
    		$teams = array();
    		$html .= '<label>WORK PLEASE</label>';
    		foreach ( $current_teams as $team ):
    			$teams[] = '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>';
    			$html .= '<a href="' . get_post_permalink( $team ) . '">' . get_the_title( $team ) . '</a>';
    		endforeach;
    		$label = _n( 'Current Team', 'Current Teams', count( $teams ) );
    		$data[ $label ] = implode( ', ', $teams );
    	endif;
    	$html .='</div>';

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been permanently damaged by the forum’s parser.]

    I was wondering if there was an easy way for me to modify the player-details.php to fit my needs, from what I can tell I would be able to add the html I want to the $output variable.

    Thanks!

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

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author ThemeBoy

    (@themeboy)

    Hi there,

    Thanks for your question.

    The current_teams() function for players is:

    public function current_teams() {
    	return get_post_meta( $this->ID, 'sp_current_team', false );
    }

    Are there any current teams selected for that player?

    The plugin is designed so that you can create your own copy of templates and put them in your theme inside a “sportspress” folder. For example,

    wp-content/themes/twentyfourteen/sportspress/player-details.php

    Will override the default player-details.php template when using the twentyfourteen theme.

    Hope this helps!

    This might be a silly question but what do you mean design your own copy themeboy? is that possible (for someone without coding knowledge)
    thanks

    Thread Starter saltandpepper

    (@saltandpepper)

    Yes the player has a team and it shows up when I am on the Player details page, but I’m wondering if it’s possible to access this information in other templates, not just sportspress ones.

    thanks for all your help!

    Plugin Author ThemeBoy

    (@themeboy)

    Not a silly question at all.

    Coding knowledge is recommended but not required for small modifications. The plugin makes it very easy to use your own templates. Similar to how you would create a template for a single post, archive, page, etc SportsPress will check a theme’s /sportspress folder before using the default templates.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Player Profile Page’ is closed to new replies.