Last 5 matches
-
Hi,
i have a problem… i’ll want show the last 5 matches (see this example -> LINK ) in the standing template. Who can help me?Thanks!
-
great job, I do not work very well, I get the last 5 but can not see anything. if I can not put a link to my website
If you test and don’t mind, please put a link to a page that you’ve got set up to test so I can see how it looks on your page.
Thanks robsanders – let me know if there’s anything that can make it better. I have a few ideas, but am interested in getting more.
Cargov – I’m not sure I understand your message. You can’t see anything? Can you post a link so I can see it on your page?
Hi LaMonte, thanks for every thing you are doing a good job with the plugin
i need some help to show matcheswhat is the code to show matches (prev) and next
i put this code:[matches league_id=1 limit=10 time=prev order=”date DESC”]
[matches league_id=1 limit=10 time=next order=”date ASC”]
example now the italian “31 days” matches is not finish in the sunday it’s missing one match that they will play today
if i put the code for next match “32 days” this game it’s already included there is some thing wrong.
an other question can i have the title “num_match_days” to put before the code in automaticYeah, I actually added a new ‘time’ code called ‘prev1’ to fix that a few months ago. What I did was if the game was scheduled, but there’s no winner (obviously wasn’t played), then it will still show up in the list. Otherwise the shortcode is looking for games in the past without checking if they’ve been played or not…
Try this code and see if it works for you (make a copy of your ‘shortcodes.php’ file first!)
Open the ‘shortcode.php’ file in the ‘libs’ folder. Around line 250-260 you’ll see:
if ( $time ) { if ( $time == 'next' ) $search .= " AND DATEDIFF(NOW(), <code>date</code>) <= 0"; elseif ( $time == 'prev' ) $search .= " AND DATEDIFF(NOW(), <code>date</code>) > 0"; }
Change that with this:
if ( $time ) { if ( $time == 'next' ) $search .= " AND DATEDIFF(NOW(), <code>date</code>) <= 0"; elseif ( $time == 'prev' ) $search .= " AND DATEDIFF(NOW(), <code>date</code>) > 0"; elseif ( $time == 'prev1' ) $search .= " AND (DATEDIFF(NOW(), <code>date</code>) > 0) AND (<code>winner_id</code> != 0) "; }
Then, around line 275 (probably 285 or so) find:
$matches = $leaguemanager->getMatches( $search, $limit, $order );
after that line, add these:
foreach ( $matches AS $key => $row ) { $matchdate[$key] = $row->date; } if ($time=='prev1'){ array_multisort( $matchdate, SORT_ASC, $matches ); }
That will come right before:
$i=0;
foreach ( $matches AS $match ){There are two other things that could make it work better, but try that first and we’ll go from there. I haven’t touched this code in awhile since it’w working for me.
Sorry, forgot the most important line:
[matches league_id=1 limit=10 time=prev1 order=”date DESC”]
See how that works, and let me know.
it gives me an error
‘
date
) > 0) AND (winner_id
!= 0) ORDER BY date DESC LI’ at line 1]Warning: array_multisort() [function.array-multisort]: Argument #1 is expected to be an array or a sort flag in /home/xxxxxx/public_html/wp-content/plugins/leaguemanager/lib/shortcodes.php on line 277
This:
if ($time==’prev1′){ array_multisort( $matchdate, SORT_ASC, $matches ); }Yeah, sorry, that’s my fault I didn’t notice that the code didn’t copy over right. Make a copy of your shortcode.php file in the libs folder and put the following in it’s place.
Here’s the file on pastebin:
See how that works…
It works (of course) but it will add the last game in the schedule that is even unplayed. I have default last 5 games, not 6.
<a class="N last5-bg" href="?match=8"> </a>
– not yet played
<a class="L last5-bg" href="?match=6"> </a>
<a class="L last5-bg" href="?match=5"> </a>
<a class="L last5-bg" href="?match=4"> </a>
<a class="W last5-bg" href="?match=3"> </a>
<a class="D last5-bg" href="?match=2"> </a>
That’s by design, the first icon is the next game to be played…
Being this is something new, we have the opportunity to make various things optional, such as number of games to show, to show the next game or not, what icons to use, etc. I saw an implementation of a similar feature on a site the other day that had simple green and red bullets. It was very clean but very easily identifiable.
Just some thoughts, I’d encourage anyone to jot down some thoughts as well…
Thanks LaMonte,
Error is gone and with this code is showing:
[matches league_id=1 limit=10 time=prev1 order=”date DESC”]
i dont know if it’s working, because all the matches are played yeti will see for the next week, because i will get the same thing in the date of matches (Sunday and Monday)
but pls. can you do some thing for example when i put the code
[matches league_id=1 limit=10 time=prev1 order=”date DESC”]
before or on the top must have the number of “$league->match_days” as per title.
thanks a lotI’m not 100% clear on what you’re looking for…
Can you put the code on a page and post a link so I can see it? Or can you take a screen shot and write on it what is or isn’t working and what you need.
Dear LaMonte,
on top of match table next or prev matches i want to put a title:
$league->num_match_days
how can i post the screen shot????wrong icons in a draw and defeat
how I can add a screenshot???Hi LaMonte,
i modify matches php templates for showing a table like this:
<tr>
<th class=’date’><?php _e( ‘Data’, ‘leaguemanager’ ) ?></th>
<th class=’match’><?php _e( ‘Partita’, ‘leaguemanager’ ) ?></th>
<th class=’score’><?php _e( ‘Ris.’, ‘leaguemanager’ ) ?></th>
</tr>my problem is that i want to make a <th> with the following code to show
the match_day (day number)<?php printf(__( ‘%d. Match Day’, ‘leaguemanager’), $i) ?>
like in the widget for next and prev matches, i add this code:
if ( !empty($match->match_day) )
$out .= “<p class=’match_day’>”.sprintf(__(“%d. Match Day”, ‘leaguemanager’), $match->match_day).”</p>”;
but is not working
any help pls.
thanks
- The topic ‘Last 5 matches’ is closed to new replies.