Viewing 8 replies - 16 through 23 (of 23 total)
  • Hi Drinkbaar!

    Give this a try:

    <?php if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
    
    $defaults = array(
    'team' => null,
    'id' => null,
    'live' => get_option( 'sportspress_enable_live_countdowns', 'yes' ) == 'yes' ? true : false,
    );
    
    if ( isset( $id ) ):
    $post = get_post( $id );
    else:
    $args = array();
    if ( isset( $team ) )
    $args = array( array( 'key' => 'sp_team', 'value' => $team ) );
    $post = sp_get_next_event( $args );
    endif;
    
    extract( $defaults, EXTR_SKIP );
    
    if ( ! isset( $post ) ) return;
    
    $id = $post->ID;
    $teams = get_post_meta( $id, 'sp_team' );
    
    ?>
    <div class="upcoming-match-item-wrapper gdlr-item" style="margin-bottom: 0px;">
    <div class="upcoming-match-overlay"></div>
    <div class="gdlr-upcoming-match-team-wrapper">
    <span class="gdlr-upcoming-match-team gdlr-left"><?php echo get_the_title( $teams[0] ); ?></span>
    <span class="gdlr-upcoming-match-versus">VS</span>
    <span class="gdlr-upcoming-match-team gdlr-right"><?php echo get_the_title( $teams[1] ); ?></span>
    </div>
    <span class="match-result-info-wrapper">
    <span class="upcoming-match-info-overlay"></span>
    <span class="match-result-info">
    <i class="icon-location-arrow"></i>
    <?php
    /* Begin venue*/
    if ( get_option( 'sportspress_event_show_venue', 'yes' ) === 'no' ) return;
    
    if ( ! isset( $id ) )
    	$id = get_the_ID();
    
    $venues = get_the_terms( $id, 'sp_venue' );
    
    if ( ! $venues )
    	return;
    
    $show_maps = get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' ? true : false;
    $link_venues = get_option( 'sportspress_link_venues', 'no' ) == 'yes' ? true : false;
    
    foreach( $venues as $venue ):
    	$t_id = $venue->term_id;
    	$meta = get_option( "taxonomy_$t_id" );
    
    	$name = $venue->name;
    	if ( $link_venues )
    		$name = '<a href="' . get_term_link( $t_id, 'sp_venue' ) . '">' . $name . '</a>';
     echo $name; /* Echoes venue name*/ ?>
    	<?php
    endforeach;
    /* End venue*/
    
    if ( isset( $show_league ) && $show_league ):
    $leagues = get_the_terms( $post->ID, 'sp_league' );
    if ( $leagues ):
    foreach( $leagues as $league ):
    $term = get_term( $league->term_id, 'sp_league' );
    echo $term->name;
    endforeach;
    endif;
    endif; ?>
    </span>
    <span class="match-result-info">
    <i class="icon-calendar"></i><?php $now = new DateTime( current_time( 'mysql', 0 ) ); $date = new DateTime( $post->post_date );
    $interval = date_diff( $now, $date );
    
    $days = $interval->invert ? 0 : $interval->days;
    $h = $interval->invert ? 0 : $interval->h;
    $i = $interval->invert ? 0 : $interval->i;
    $s = $interval->invert ? 0 : $interval->s;
    ?><time datetime="<?php echo $post->post_date; ?>"<?php if ( $live ): ?> data-countdown="<?php echo str_replace( '-', '/', $post->post_date ); ?>"<?php endif; ?>><?php echo sprintf( '%02s', $days ); ?> <small><?php _e( 'days', 'sportspress' ); ?></small><?php echo sprintf( '%02s', $h ); ?> <small><?php _e( 'hrs', 'sportspress' ); ?></small><?php echo sprintf( '%02s', $i ); ?> <small><?php _e( 'mins', 'sportspress' ); ?></small><?php echo sprintf( '%02s', $s ); ?> <small><?php _e( 'secs', 'sportspress' ); ?></small></time></span>
    </span>
    </div>

    Hope it works! I’ll leave the formatting to you. ??

    Regards,
    Richard

    You can delete the row that reads
    $show_maps = get_option( 'sportspress_event_show_maps', 'yes' ) == 'yes' ? true : false;

    /Richard

    @knut23

    Wauw, your solution works like a charm! Really nice and thank you. At this very moment I’m editing the player_list layout as well and it gives me headaches!

    /Youri

    Drinkbaar, You are welcome!
    I think you will be better off starting a new thread with your player list problem. Write a good description of your problem as subject. You will probably get more help than burying it in this thread. If you haven’t solved it by now, that is… ??

    /Richard

    is it possible to see only author’s created content on Dropdowns of sportspress in the backend?

    Plugin Author Brian

    (@brianmiyaji)

    @gianluca.tortorella Please avoid posting the same question in multiple areas. You’ve created your own topic about this and have also asked the same question again in your other topic.

    @brian

    Thanks for the answers to this page. It’s wonderful!

    You had mentioned that the API function now can recall the Results with Teams (i.e. Team A 3 – Team B 2) which is wonderful but I realized that the Team names are not displayed:
    i.e.
    Team A 3
    Team B 2

    There doesn’t some to be a shortcode function in there, do you know if one exists or do I have to write the recall myself in the .php. Thanks!

    Plugin Author Brian

    (@brianmiyaji)

    @jonchin19 we recently added more API functions to make it easier to create custom templates: https://github.com/ThemeBoy/SportsPress/blob/master/includes/sp-api-functions.php

    I think the function to use for this would be:

    <?php sp_the_main_results( $post_id ); ?>

Viewing 8 replies - 16 through 23 (of 23 total)
  • The topic ‘I need to customize the player & events template’ is closed to new replies.