• hello

    first off all, you have no idea how much your plugin saved me!
    just exactly what i needed. than thanks a lot!

    i have a question please, about the player profiles page:
    i have more than 30 fields for statistics and performance(6 different data, for 5 type of game – Europe, domestic, cup etc.), and makes a left to right scroll at the bottom of the table, and i don’t want it.

    can i pull specific field using advanced custom fields?

    for example, i have a filed called totosubs, and i want to use this:
    <?php the_field(‘totosubs’); ?> and insert it to a table i will design.
    in that case i will be able to design different table for each type of game, and for each player.

    thanks

    https://wordpress.org/plugins/sportspress/

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

    (@themeboy)

    @ttemplate Glad to hear you’ve found the plugin useful 🙂

    There is an SP_Player class that helps retrieve values for a specific player. If you’re using the loop inside player.php, here’s how to do it:

    First, get the ID. You could also use $post->ID or just $post

    $id = get_the_ID();

    Create a new instance of SP_Player.

    $player = new SP_Player( $id );

    You will also need the ID for the league you want to display. Or loop through all leagues.

    $leagues = get_the_terms( $id, 'sp_league' );
    
    // Loop through each league
    if ( is_array( $leagues ) ):
    	foreach ( $leagues as $league ):

    Get formatted data (performance & statistics).

    $data = $player->data( $league->term_id );

    The first row of $data will contain column labels, and each row following will be statistics for a season within that league. See /templates/player-statistics.php for a complete example of how to use this data.

    Thread Starter Ttemplate

    (@ttemplate)

    hi my friend. thanks for quick replying.

    to be honest, i have try to, but nothing happens.

    i am not an expert in php.

    can you past here an example how to do display two fields – ‘fivesevenfive’, ‘fivesevensix’. from the beging if you can.

    if it is a problem, i don’t mind to pay if it is a minor job.

    thanks

    Thread Starter Ttemplate

    (@ttemplate)

    as i said, i just want to pull one specific value from the performence

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘SportsPress with custom fields’ is closed to new replies.