Disable URLs in ranking
-
Is it possible to disable the URL’s in the ranking, so that you can’t click on the usernames?
(Maybe with a simple CSS addition, not quite experienced with other things)
-
Good evening. If you changed the code in the plugin then you need to be aware that your changes will be overwritten when you upgrade the plugin.
You can also create an extension to get the same result. An extension will not be overwritten when uou upgrade the plugin. E.g. use this extension plugin as a basis.
I indeed edited it with the extension plugin. I also tried the ‘add match result to prediction page’ extension, but with that the page will change to this: https://ibb.co/tZmS82F
Any idea what goes wrong with that extension?
That plugin is really old and never updated to the new templates. If you are only trying to add what this extension was build for in the first place, then you don’t need it anymore. The function to show the actual score made it to the core: you now have an option on the settings page of the plugin that shows/hides the actual score.
If your plan is to make another change to the template, then you’ll first have to copy the template from the current version of the plugin to the extension to make sure you start with the correct base HTML structure. You can search for the filter name to get to the right place in the code. In this case the string to search for is ‘footballpool_predictionform_match_template’.
My plan is that I would like to show the actual result of the game on the predictions page, that’s not possible with the core or?
(I want to only make the predictions and ranking page available for players, so not the user page)
No, sorry, you cannot show the actual result on the prediction page without an extension.
If you are using the new layout (with divs), then you should make the template something like this:
$match_template = '<div id="match-%match_id%-%form_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="flag">%home_team_flag%</div> <div class="flag">%away_team_flag%</div> <div class="home">%home_team%</div> <div class="away">%away_team%</div> <div class="score"> %home_input% <div class="actual-score">%home_score%</div> </div> <div class="score"> %away_input% <div class="actual-score">%away_score%</div> </div> <div class="match-card-footer"> <div class="user-score">%user_score_txt%</div> <div class="fp-icon">%stats_link%</div> <div class="fp-icon">%joker%</div> </div> </div>';
You can change the HTML around the parameters
%home_score%
and%away_score%
to whatever you want.Thanks ??
But I’m not sure how to add this in the empty template. Add that part you’ve sent in the “// add your filters and actions for the frontend here, e.g.”?
But I’m not sure how to add this in the empty template. Add that part you’ve sent in the “// add your filters and actions for the frontend here, e.g.”?
No, that won’t work. You need to hook into a filter with a callback function. And in that function you have to put your logic (in this case simply return a new template string).
It’s better that you use this example as a start. You can replace the template part that looks just like this:
$match_template = '<div id="match-%match_id%-%form_id%" [..some more lines..] </div>';
With the part I posted earlier.
And since you won’t be adding extra save buttons, you can also completely remove this line from the example script:
add_filter( 'footballpool_predictionform_match_template_params', array( __CLASS__, 'change_params' ), null, 4 );
Thanks it works now ????????
Is it also possible to use this (or anyway the actual result) on the tr/td layout?
Yes, of course. Just take the tr/td layout as the basis for the template you want to override. You can find that code in the same example I gave you.
And then change the html to whatever you want and put the placeholders
%home_score%
and%away_score%
in the place where you want the actual scores to appear.Note: beware that if you change the amount of columns in the tr/td layout that you also have to override some other templates (e.g. the match type template contains a colspan parameter) to match the new column count.
- The topic ‘Disable URLs in ranking’ is closed to new replies.