Home › Forums › Calendar Products › Events Calendar PRO › Single-venues navigation
- This topic has 3 replies, 2 voices, and was last updated 10 years, 11 months ago by
George.
-
AuthorPosts
-
May 31, 2015 at 5:28 am #966267
Øystein
ParticipantHey guys!
As found in single-events (next and previous event nav-links), is there any way to have this navigation on single-venues? From “Venue X” I want my customers to be able to navigate through the other venues.
Thanks in advance, great plugin otherwise!
May 31, 2015 at 10:37 am #966302George
ParticipantHey Øystein!
You’d have to write some custom code do this, which is outside the scope of the support we can provide here, but I can happily offer some ideas that might help you get started.
First of all, Venues are just post types, so any query- or archive-related functions within WordPress that either let you specify a custom post type, or otherwise are just not post-type-specific, should be useable for you.
So with this in mind, the simplest way to go about doing what you’re talking about here would be, for example, to just use WordPress’ core next_post_link() and previous_post_link() functions in a customized version of the single-venue.php template file.
To learn about where to find this single-venue.php template file in your copy of Events Calendar PRO, check out our theme’s guide here → https://theeventscalendar.com/knowledgebase/themers-guide/.
Now, you have to be careful of where you add the next_ and previous_ post link functions in this file since the post type of the wp_query changes, but if you do something like what I show here in this Gist for you, it should work well → https://gist.github.com/ggwicz/e14378dfd67abbdda223#file-single-venue-php-L63-L64
Check out that gist, and see the code I added around lines 63 and 64.
If you play around with this, and then style the links how you want with some CSS, you should be good to go.
Learn more about these link functions here:
https://codex.wordpress.org/Function_Reference/previous_post_link
http://codex.wordpress.org/Function_Reference/next_post_linkBest of luck with your customizations!
George
-
This reply was modified 10 years, 7 months ago by
George.
May 31, 2015 at 1:06 pm #966317Øystein
ParticipantThanks man, right on spot!
Here’s how I made it so the link show the next/previous venue-title:
<div class="next-venue"><?php next_post_link( '%link', '%title' ); ?></div> <div class="prev-venue"><?php previous_post_link( '%link', '%title' ); ?></div>Love you;)
June 2, 2015 at 1:54 pm #966714George
ParticipantGreat! Be sure to keep good backups of your site and database, but also of any customizations that you make like this 🙂
Best of luck with your project!
George -
This reply was modified 10 years, 7 months ago by
-
AuthorPosts
- The topic ‘Single-venues navigation’ is closed to new replies.
