sikicz
Forum Replies Created
Viewing 1 replies (of 1 total)
-
Forum: Plugins
In reply to: [Football Pool] Different Match Template User Page/PredictionsThank you, it works perfectly!
Bellow is the full code for another users who are looking for something simillar:<?php /******************************************************* * HOW TO USE THIS PLUGIN * * 1. Save this plugin in the /wp-content/plugins folder * 2. Activate it via the Plugins screen in the WP admin * *******************************************************/ add_filter( 'plugins_loaded', array( 'FootballPoolUserPage', 'init_extension' ) ); class FootballPoolUserPage { public static function init_extension() { add_filter( 'footballpool_predictionform_match_template', array( __CLASS__, 'prediction_page_matches' ), null, 2 ); } public static function prediction_page_matches ( $matches, $is_user_page ) { if ( $is_user_page ) { /* Define Match template for User Page e.g. different CSS, reorder div... */ $match_template = '<div id="match-%match_id%" class="%css_class% match-card match-type-%match_type_id%" title="' . __( 'match', 'football-pool' ) . ' %match_id%"> <div class="match-card-header"> <span class="matchdate">%match_datetime_formatted%</span><span class="time">%match_time%</span> </div> <div class="user-score">%user_score_txt%</div> <div class="flag">%home_team_flag%</div> <div class="score"> <a title="' . __( 'Match statistics', 'football-pool' ) . '" href="%match_stats_url%">%home_score%</a> </div> <div class="score"> <a title="' . __( 'Match statistics', 'football-pool' ) . '" href="%match_stats_url%">%away_score%</a> </div> <div class="flag">%away_team_flag%</div> <div class="home">%home_team%</div> <div class="away">%away_team%</div> <div class="stadium-name">%stadium_name%</div> <div class="predikce">%user_name%</div> <div class="score">%home_input%</div> <div class="score">%away_input%</div> <div class="match-card-footer"> <div class="fp-icon">%stats_link%</div> <div class="fp-icon">%joker%</div> </div> </div>'; } else { /* Define Match template for Prediction Page e.g. different CSS, reorder div... */ $match_template = '<div id="match-%match_id%" class="%css_class% match-card match-type-%match_type_id%" title="' . __( 'match', 'football-pool' ) . ' %match_id%"> <div class="match-card-header"> <span class="matchdate">%match_datetime_formatted%</span><span class="time">%match_time%</span> </div> <div class="user-score">%user_score_txt%</div> <div class="flag">%home_team_flag%</div> <div class="score"> <a title="' . __( 'Match statistics', 'football-pool' ) . '" href="%match_stats_url%">%home_score%</a> </div> <div class="score"> <a title="' . __( 'Match statistics', 'football-pool' ) . '" href="%match_stats_url%">%away_score%</a> </div> <div class="flag">%away_team_flag%</div> <div class="home">%home_team%</div> <div class="away">%away_team%</div> <div class="stadium-name">%stadium_name%</div> <div class="predikce">%user_name%</div> <div class="score">%home_input%</div> <div class="score">%away_input%</div> <div class="match-card-footer"> <div class="fp-icon">%stats_link%</div> <div class="fp-icon">%joker%</div> </div> </div>'; } return $match_template; } } ?>
Viewing 1 replies (of 1 total)