Event pagination not working and urls question
-
So, pagination: I have turned on pagination for event blocks and lists in the sportspress setting, and also tried adding
pagination="1"
to the shortcodes, but neither seem to work, and the list just continues beyond the set limit.Urls: as I am only using shortcodes, I do not want users to be able to access any of the generated urls. How can I make them inaccessible?
-
@mike.chiv Thanks for your patience! I hope I can help you.
Have you changed the Event Blocks Limit under SportsPress > Settings > Events? Pagination uses jQuery, so there is a chance that a Javascript error is preventing event blocks from paginating. Are there any errors in the console?
There is a filter that you can hook into to prevent post types from being accessed directly. Try this:
function hide_post_type( $args = array() ) { $args['publicly_queryable'] = false; return $args; } add_filter( 'sportspress_register_post_type_event', 'hide_post_type' ); add_filter( 'sportspress_register_post_type_calendar', 'hide_post_type' ); add_filter( 'sportspress_register_post_type_team', 'hide_post_type' ); add_filter( 'sportspress_register_post_type_table', 'hide_post_type' ); add_filter( 'sportspress_register_post_type_player', 'hide_post_type' ); add_filter( 'sportspress_register_post_type_list', 'hide_post_type' ); add_filter( 'sportspress_register_post_type_staff', 'hide_post_type' );
Please excuse the delay in my reply. I had to work on another site for a while and then my daughter was born, so I had some time off!
I checked the events settings, and the event block limit was changed already to 5. I had more than 5 events, and still no pagination.
There are no errors showing up in the console on the relevant pages.
That filter hook seems to work, so thanks for that ??
Any suggestions re: the pagination issue?
Hey @mike.chiv no worries ??
Regarding the pagination, it could be a JavaScript issue. Could you please send me details of your site via https://sportspresspro.com/support
Unfortunately the site is only on a local server at the moment. Is there anything you can suggest that I look for myself? Or would it be best to simply upload to a dev server and have you take a look then?
I have one more thing to ask, and I realise that this doesn’t necessarily fall within the parameters of what you might support but I was hoping that you might be able to assist me all the same: at the moment, each “match” appears at the url “https://localhost/match/%5BID%5D”. I would like them to appear at the URL “https://localhost/first-team/%5Bteam1%5D-vs-%5Bteam2%5D”. I don’t have any experience of URL rewrites if this is what is required, so if you wouldn’t mind guiding me then I would be extremely grateful. If you wish me to open this as a new topic, then I am happy to do so.
@mike.chiv If you could send me the output of SportsPress > System Status I might be able to spot the issue. Otherwise, we may need to see it on a dev server.
*be sure to use the “code” button below when posting the system status output.
Regarding the URL rewrite, you’ll need to do a couple things:
1. From WP Admin > Settings > Permalinks, change the Events permalink to “first-team” (assuming all events will fall under first team. If not, there’s no way to have different permalinks for a single post type, so it’s best to keep it as “match” or “event”.
2. When editing an event, you can edit the permalink by clicking the “Edit” button directly below the title. If you delete the permalink and click “OK”, a permalink will automatically be generated based on the event title. Note that this field only becomes visible once a title has been entered or the event has been saved once.
Here is the output for System Status:
### Environment ### Home URL: https://localhost Site URL: https://localhost SP Version: 1.3.2 WP Version: 4.0.1 WP Multisite Enabled: No Web Server Info: Apache/2.4.9 (Win64) PHP/5.5.12 PHP Version: 5.5.12 WP Memory Limit: 40 MB - We recommend setting memory to at least 64MB. See: Increasing memory allocated to PHP WP Debug Mode: No WP Language: Default WP Max Upload Size: 3 MB PHP Post Max Size: 3 MB PHP Time Limit: 120 PHP Max Input Vars: 2500 SUHOSIN Installed: No Default Timezone: Default timezone is UTC fsockopen/cURL: Your server has fsockopen and cURL enabled. SOAP Client: Your server has the SOAP Client class enabled. ### Plugins ### Installed Plugins: Spider Event Calendar by https://web-dorado.com/ version 2.3.7 SportsPress by ThemeBoy version 1.3.2 ### SP Configuration ### Sport: soccer Event Outcomes: Win (win) [10] Draw (draw) [20] Loss (loss) [30] Team Results: 1st Half (firsthalf) [10] 2nd Half (secondhalf) [20] PK (pk) [30] Goals (goals) [40] Player Performance: Goals (goals) [10] Assists (assists) [20] Yellow Cards (yellowcards) [30] Red Cards (redcards) [40] Table Columns: P (p = $eventsplayed) [10] W (w = $win) [20] D (d = $draw) [30] L (l = $loss) [40] F (f = $goalsfor) [50] A (a = $goalsagainst) [60] GD (gd = $goalsfor - $goalsagainst) [70] Pts (pts = $win * 3 + $draw) [80] Player Metrics: Height (height) [10] Weight (weight) [20] Player Statistics: Appearances (appearances = $eventsplayed) [10] Win Ratio (winratio = $win / $eventsplayed * 1 0 0) [20] Draw Ratio (drawratio = $draw / $eventsplayed * 1 0 0) [30] Loss Ratio (lossratio = $loss / $eventsplayed * 1 0 0) [40] ### SP Taxonomies ### Leagues: Canterbury & District League (canterbury-and-district-league) Kent County League Division 1 East (kent-county-league-division-1-east) Seasons: 2014-2015 (2014-2015) Venues: Positions: Defender (defender) Goalkeeper (goalkeeper) Midfielder (midfielder) Striker (striker) ### SP Post Types ### Events: 10 publish 2 future 0 draft 0 private 0 trash 0 auto-draft 0 inherit Calendars: 3 publish 0 future 0 draft 0 private 0 trash 0 auto-draft 0 inherit Teams: 22 publish 0 future 0 draft 0 private 0 trash 0 auto-draft 0 inherit League Tables: 2 publish 0 future 0 draft 0 private 0 trash 0 auto-draft 0 inherit Players: 1 publish 0 future 0 draft 0 private 0 trash 0 auto-draft 0 inherit Player Lists: 1 publish 0 future 0 draft 0 private 0 trash 0 auto-draft 0 inherit Staff: 0 publish 0 future 0 draft 0 private 0 trash 0 auto-draft 0 inherit ### Theme ### Theme Name: DCSFC Theme Version: Author URL: ### Templates ### Template Overrides: No overrides present in theme.
Regarding the URLs, basically the club has two teams: “first team” and “reserves”. Each has its own section within the site, so “https://localhost/first-team/stuff” and “https://localhost/reserves/stuff”. What I was aiming for with the match URLs was something along the lines of “https://localhost/%5Bteam-name%5D/fixtures/%5Bteam1%5D-vs-%5Bteam2%5D-%5Bmatch-date%5D”. I should mention that “first-team” and “reserves” are already existing pages.
I suppose the “fixtures” part of this URL structure would be achieved by following your instructions in point 1, but are you saying that I cannot make the “[team-name]” part dynamic? Is it maybe possible to set the event page template to be either a child of “first-team” or “reserves”?
@mike.chiv Thanks for the System Status. I’ll look into the pagination issue by referring to your setup.
You might be able to use the Custom Permalinks plugin to achieve the permalink structure you’ve described.
- The topic ‘Event pagination not working and urls question’ is closed to new replies.