Forum Replies Created

Viewing 15 replies - 1 through 15 (of 137 total)
  • Select the goal and do not select the default. Select the one above the default and then re-enter the score in any competition and update it. This error occurs when the goal is not selected.

    Hi,

    Select Sportspress > Configure > Match Results > Goals

    Hi,

    You should select Sportspress > Settings > Match > Match Results > Automatic.

    Since you added the CVS format incorrectly, the first half is entered.

    2025/01/10,19:30:00,Berches,rot,||22,Win,Basti,2,,,,

    ,,,wei?,||18,Loss,Chris,7,,,,

    Could you please upload the sample below?

    Date,Time,Venue,Teams,Results,Outcome,Players,Goals,Eigentore,Assists,Yellow Cards,Red Cards
    2025/01/10,19:30:00,Berches,rot,||22,Win,Basti,2,,,,
    ,,,,,,Eike,4,1,,,
    ,,,,,,Jan,8,,,,
    ,,,,,,Lennard,2,,,,
    ,,,,,,Phil,2,,,,
    ,,,,,,Tom,2,,,,
    ,,,wei?,||18,Loss,Chris,7,,,,
    ,,,,,,Herthy,2,1,,,
    ,,,,,,Jose,3,,,,
    ,,,,,,Manu,3,,,,
    ,,,,,,Rene,1,1,,,
    ,,,,,,Tobi,1,,,,

    If you attach the CVS sample you use, you can try it.

    1st Half
    A Team 1-2 B Team
    2nd Half
    A Team 3-0 B Team
    Goal Result
    A Team 4-2 B Team
    Result
    A Team Win
    B Team Loss

    A Team
    1st Half|2nd Half|Goal,Result
    1|3|4,Win
    B Team
    1st Half|2nd Half|Goal,Result
    2|0|2,Loss


    Thread Starter ozgurgedikli

    (@ozgurgedikli)

    H? @savvasha ,

    Thanks, it needs some improvement
    Status is created in the editing section.
    I should include the status in the activity page view.

    Thread Starter ozgurgedikli

    (@ozgurgedikli)

    Code errors were corrected, maquee printing was perfect. I completed the played matches, SCORES, and the matches to be played, by giving them color and style in the form of a program. I used Alchemists as Marguee general css data.

    I shared the codes to make it a nice share for Sportspress users.

    Marquee output ==> SKORLAR:10 Ekim 2024 => 2.Amat?r Lig (Play-Off): Tak?m1 12 – 8 Tak?m2 | PROGRAM:11 Ekim 2024 => 2.Amat?r Lig (Play-Off): Tak?m2 vs Tak?m1 – 18:30

    https://ibb.co/Tckt7ck

    Display with shortcode [matches_ticker title=”Matches” posts_per_page=”50″]
    <?php
    // Shortcode attributes
    $atts = vc_map_get_attributes($this->getShortcode(), $atts);
    extract($atts);

    // Set class for marquee wrapper
    $css_class = isset($css) ? 'marquee-wrapper ' . vc_shortcode_custom_css_class($css, ' ') : 'marquee-wrapper';
    $css_class .= isset($el_class) ? $this->getExtraClass($el_class) : '';

    // Query SportPress events (matches)
    $args = array(
    'post_type' => 'sp_event',
    'post_status' => array('publish', 'future'),
    'posts_per_page' => 10,
    'date_query' => array(
    array(
    'after' => date('Y-m-d', strtotime('-4 days')), // 4 gün ?nce
    'before' => date('Y-m-d', strtotime('+4 days')), // 4 gün sonras?
    'inclusive' => true,
    'type' => 'DATE',
    ),
    ),
    );

    $events_query = new WP_Query($args);

    $completed_matches = [];
    $upcoming_matches = [];
    ?>

    <!-- Matches Ticker -->
    <div class="<?php echo esc_attr($css_class); ?>">
    <div class="container">

    <?php if (!empty($title)) : ?>
    <div class="marquee-label">
    <?php echo esc_html($title); ?>
    </div>
    <?php endif; ?>

    <div class="marquee" data-gap="10" data-duplicated="false">
    <ul class="posts posts--inline">
    <?php if ($events_query->have_posts()) : ?>
    <?php
    while ($events_query->have_posts()) : $events_query->the_post();
    $event_id = get_the_ID();

    // Tak?mlar?n ID'lerini al
    $teams = sp_get_teams($event_id);

    if (is_array($teams) && count($teams) > 1) {
    $team1_id = $teams[0];
    $team2_id = $teams[1];

    $team1_name = get_the_title($team1_id);
    $team2_name = get_the_title($team2_id);
    } else {
    // Tak?mlar eksikse "Bilinmiyor" olarak ayarl?yoruz
    $team1_name = $team2_name = 'Bilinmiyor';
    }

    // Ma? skoru alal?m
    $main_results = sp_get_main_results( $event_id );

    if (!empty($main_results) && count($main_results) >= 2) {
    $home_score = $main_results[0];
    $away_score = $main_results[1];
    } else {
    $home_score = 'Bilinmiyor';
    $away_score = 'Bilinmiyor';
    }

    // UTC+3 saat dilimine g?re ma? saati
    $match_time_utc = get_post_time('H:i', true, $event_id);
    $match_time_utc3 = strtotime($match_time_utc) + (3 * 3600); // UTC+3
    $formatted_time = !empty($match_time_utc) ? date('H:i', $match_time_utc3) : 'Bilinmiyor';

    // Lig ad?
    $leagues = wp_get_post_terms($event_id, 'sp_league', array('fields' => 'names'));
    $league_name = !empty($leagues) ? $leagues[0] : 'Lig Bilinmiyor';

    // Ma? tarihi
    $date_html = get_post_time('Y-m-d', false, $event_id);
    $formatted_date = !empty($date_html) ? date_i18n('j F Y', strtotime($date_html)) : 'Bilinmiyor';

    // Ma??n durumu: Yay?nlanm?? m??
    $post_status = get_post_status($event_id);
    $current_time = current_time('Y-m-d H:i');

    if ($post_status == 'publish' && !empty($home_score) && !empty($away_score) && $date_html < date('Y-m-d')) {
    // Completed matches
    $completed_matches[] = '<span style="color:#3904dd;">' . esc_html($formatted_date . ' => ' . $league_name . ': ' . $team1_name . ' ' . $home_score . ' - ' . $away_score . ' ' . $team2_name) . '</span>';
    } elseif ($post_status == 'future' || ($date_html >= date('Y-m-d') && $match_time_utc3 > strtotime($current_time))) {
    // Upcoming matches
    $upcoming_matches[] = '<span style="color:#ff0404;">' . esc_html($formatted_date . ' => ' . $league_name . ': ' . $team1_name . ' vs ' . $team2_name . ' - ' . $formatted_time) . '</span>';
    } else {
    $upcoming_matches[] = '<span style="color:#ff0404;">' . esc_html($formatted_date . ' => ' . $league_name . ': ' . $team1_name . ' vs ' . $team2_name . ' Bilinmiyor') . '</span>';
    }
    endwhile;
    ?>

    <!-- Display completed matches -->
    <?php if (!empty($completed_matches)) : ?>
    <li class="posts__item">
    <h6 class="posts__title">SKORLAR:</h6>
    <p class="posts__text">
    <?php echo implode(' | ', $completed_matches); ?>
    </p>
    </li>
    <?php endif; ?>

    <!-- Display upcoming matches -->
    <?php if (!empty($upcoming_matches)) : ?>
    <li class="posts__item">
    <h6 class="posts__title">PROGRAM:</h6>
    <p class="posts__text">
    <?php echo implode(' | ', $upcoming_matches); ?>
    </p>
    </li>
    <?php endif; ?>

    <?php else : ?>
    <!-- If no matches are available, show this message inside the marquee -->
    <li class="posts__item">
    <p class="posts__text">HAFTALIK MüSABAKALAR YAYINLANMADI</p>
    </li>
    <?php endif; ?>
    </ul>
    </div><!-- .marquee -->
    <?php wp_reset_postdata(); ?>

    </div>
    </div>
    <!-- Matches Ticker / End -->
    • This reply was modified 4 months, 3 weeks ago by ozgurgedikli.
    Thread Starter ozgurgedikli

    (@ozgurgedikli)

    Thanks @savvasha

    With debugging I see that I can now pull the data in. However, I see that I am making errors during marquee printing.

    [10-Oct-2024 20:28:56 UTC] PHP Notice:  Undefined offset: 0 in /home/duzceama/public_html/wp-includes/meta.php on line 638
    [10-Oct-2024 20:28:57 UTC] Team 1: Tak?m2, Team 2: Tak?m1
    [10-Oct-2024 20:28:57 UTC] Main Results: Array
    (
    )

    [10-Oct-2024 20:28:57 UTC] Home Score: Bilinmiyor, Away Score: Bilinmiyor
    [10-Oct-2024 20:28:57 UTC] Match Time (UTC+3): 18:30
    [10-Oct-2024 20:28:57 UTC] League Name: 2.Amat?r Lig (Play-Off)
    [10-Oct-2024 20:28:57 UTC] Post Status for Event ID 22210: publish
    [10-Oct-2024 20:28:57 UTC] Team 1: Tak?m1, Team 2: Tak?m2
    [10-Oct-2024 20:28:57 UTC] Main Results: Array
    (
    [0] => 12
    [1] => 8
    )

    [10-Oct-2024 20:28:57 UTC] Home Score: 12, Away Score: 8
    [10-Oct-2024 20:28:57 UTC] Match Time (UTC+3): 12:30
    [10-Oct-2024 20:28:57 UTC] League Name: 2.Amat?r Lig (Play-Off)
    [10-Oct-2024 20:28:57 UTC] Post Status for Event ID 22209: publish
    [10-Oct-2024 20:28:57 UTC] PHP Notice: ob_end_flush(): failed to send buffer of zlib output compression (0) in /home/duzceama/public_html/wp-includes/functions.php on line 5427
    Thread Starter ozgurgedikli

    (@ozgurgedikli)

    Yes @savvasha ,

    That was during an experiment, I tried to capture the results like this, but it didn’t work.
    I tried this first but didn’t get any results

    thanks

    $event_id = get_the_ID();
    $home_score = get_post_meta( $event_id, 'sp_results_home', true );
    $away_score = get_post_meta( $event_id, 'sp_results_away', true );
    Thread Starter ozgurgedikli

    (@ozgurgedikli)

    Hi @savvasha

    Thanks for the data details. I added the query to event-list.php to pull the match data from Sportspress

    $home_team = sp_get_team_name(get_the_ID(), 'home');
    $home_score = sp_get_team_result(get_the_ID(), 'home');

    $away_team = sp_get_team_name(get_the_ID(), 'away');
    $away_score = sp_get_team_result(get_the_ID(), 'away');

    $match_time = get_post_meta(get_the_ID(), 'sp_date', true);
    $match_date_readable = date_i18n(get_option('date_format'), strtotime($match_time));

    $league = wp_get_post_terms(get_the_ID(), 'sp_league', array('fields' => 'names'));

    I applied it for the Alchemists marquee display to pull it dynamically.

    <div class="marquee-wrapper">
    <div class="container">
    <div class="marquee">
    <div class="marquee-content">
    <?php
    // Query by date range
    $args = array(
    'post_type' => 'sp_event',
    'post_status' => array('publish', 'future'), // Both scheduled and broadcasted matches
    'posts_per_page' => 100, // Maximum matches
    'date_query' => array(
    array(
    'before' => date('Y-m-d', strtotime('+4 days')), // Up to 4 days later
    'after' => date('Y-m-d', strtotime('-4 days')), // Until 4 days ago
    'inclusive' => true,
    ),
    ),
    );

    // SportPress query to capture matches
    $events_query = new WP_Query($args);
    $matches_by_league = array(); // To group matches by leagues
    $processed_matches = array(); // To avoid showing the same match twice
    if ($events_query->have_posts()) :
    while ($events_query->have_posts()) : $events_query->the_post();

    // Get match ID
    $match_id = get_the_ID();

    // Get team names
    $home_team = sp_get_team_name($match_id, 'home');
    $away_team = sp_get_team_name($match_id, 'away');

    // Fetch post metadata for match time
    $match_time = get_post_meta($match_id, 'sp_date', true);

    // If the date information is empty or null, use a default information.
    if (empty($match_time)) {
    $match_time = null; // Default value: Unknown
    } else {
    $match_time = date('Y-m-d H:i', strtotime($match_time)); // Date format
    }

    // League information
    $league = wp_get_post_terms($match_id, 'sp_league', array('fields' => 'names'));

    // Check date format
    $formatted_time = $match_time ? date('d.m.Y H:i', strtotime($match_time)) : 'Bilinmiyor';

    // If there is league information, let's process it
    if (!empty($league)) {
    $league_output = implode(', ', $league);
    $home_score = function_exists('sp_get_team_result') ? sp_get_team_result($match_id, 'home') : null;
    $away_score = function_exists('sp_get_team_result') ? sp_get_team_result($match_id, 'away') : null;

    // Generate a unique key: Using the match ID we prevent the same match from being added twice
    $match_key = $match_id;

    // Check to avoid adding the same match twice
    if (!in_array($match_key, $processed_matches)) {
    $is_past = $match_time && strtotime($match_time) < time(); // Check if the match is past or future

    // Only show as played if the score is full and the match is in the past
    if ($is_past && $home_score !== null && $away_score !== null) {

    // If the match has been played, show the score
    $matches_by_league[$league_output][] = $home_team . ' ' . $home_score . ' - ' . $away_score . ' ' . $away_team;
    } else if (!$is_past) {
    // If in the future and there is no score, show match details
    $matches_by_league[$league_output][] = $home_team . ' vs ' . $away_team . ' (' . $formatted_time . ')';
    }

    // Add match to processed list
    $processed_matches[] = $match_key;
    }
    }
    endwhile;
    wp_reset_postdata();
    endif;

    // Show matches by league
    if (!empty($matches_by_league)) {
    foreach ($matches_by_league as $league => $matches) {
    echo $league . ': '; // Show league name
    echo implode(' | ', $matches) . ' | ';
    }
    } else {
    echo 'The weekly program was not published.';
    }
    ?>
    </div>
    </div>
    </div>
    </div>

    Flowing text on the marquee

    2.Amateur League (Play-Off): Team2 vs Team1 vs Team2 vs Team1 (Unknown) | Team1 vs Team2 vs Team1 vs Team2 (Unknown)

    The text planned to flow on the marquee

    2.Amateur League (Play-Off): Team2 5 – 4 Team1 | Team1 vs Team2 (09 October 2024 18:30)

    Matches are repeated twice in Marquee and it is not possible to pull the score and date information.
    What could be the reason for this?

    Thread Starter ozgurgedikli

    (@ozgurgedikli)

    Yes, the data came with the date filter. Thanks @savvasha

    Currently, only the title of the matches is published as “team1 vs team2”.

    I need to work on the home away objects to pull the score if the match is ‘published’ and the match date and time if it is ‘in the future’.

    Own Goal is a player performance criterion.

    Sportpress – Configure – Player Performance
    If you make the Own Goal event visible, you can enter the number of goals and minutes as player data in the box score section of the match details.

    Hi,

    One of the shortcomings of the Sportspress plugin is the lack of this fixture creation structure. In this regard, user @g6063523 mentioned that he developed a plugin, but there was no response.

    https://www.ads-software.com/support/topic/automatic-creation-of-player-list-and-league-calendars/#post-17757929

    Unfortunately, since league selection is the top criterion, this needs to be re-arranged with additional coding and import.

    Likewise, the fact that all data in the sportspress infrastructure scheme is at the same level causes the previous season data to be mixed with the new season data. For example, if a club played in the 2nd League in the 2023 season and in the 1st League in the 2024 season, the previous season league must be removed from that club’s details, otherwise all league tables will give an error.

    https://snipboard.io/bivhU7.jpg

    Sportspress | Settings | Club
    In the League Table section
    If there is a pagination check mark, remove it
    If the maximum number of teams in your leagues is 12, if you enter the limit number as 20, up to 20 teams will be seen in the league table. When there are 21 teams, it will be seen on the second page.

    Thread Starter ozgurgedikli

    (@ozgurgedikli)

    Mode changes can be made separately for each event.

Viewing 15 replies - 1 through 15 (of 137 total)