Support » Plugin: The Events Calendar » Remove next/previous event link

  • Resolved palmerct

    (@palmerct)


    I am currently using the Category= option to just display events by a couple of different categories that I’ve defined. That part is working great!

    However, at the bottom of an individual event page the next and previous events display from the whole events database, not just that particular event’s category. Obviously, this can be confusing. Is it possible to just display the Next/Previous events for that specific category by using a bit of custom css?

    If it involves something more complicated than that – e.g. creating a custom template or page — can those event links just be removed from the page?

    Thanks!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Sorry for the typo above! I didn’t mean “Category=” but rather “events/category/<category-name>”

    Also, I think I may have figured out the css code to remove the links but I am definitely NOT a css programmer so I wanted to run them by you in case it’s not possible to just filter on the category. This is what I added in my test environment and it seemed to work OK. Not sure if it might screw something else up though-:)

    .tribe-events-nav-next {
    display: none !important;
    }
    .tribe-events-nav-previous {
    display: none !important;
    }
    .tribe-events-back {
    display: none !important;
    }

    Thanks again!!

    I’d also be curious as to how to do this on the events page — not remove the next/previous events but to show just the ones specific to the /events/category/. We setup locations as categories so that users can just view events by the location (neighborhood recreation center) near them. However, when looking at a specific event on the events page for a particular location – eg. event/category/<location1> – while the header of the page says “Upcoming Events > <location1>”, the next/previous events listed in the footer may be from other locations. Would be great to be able to show just the ones specific to that location.

    Hey there @palmerct!

    Thanks for reaching out — that’s a great question, I can help with that 🙂

    You’ll have to crack open the The Events Calendar 📅 template files following our Themer’s Guide.

    You’ll want to target single-event.php and remove the code for previous and next pagination.

    The code starts on line 79, you’ll want to remove this block:

    		<!-- Navigation -->
    <nav class="tribe-events-nav-pagination" aria-label="<?php printf( esc_html__( '%s Navigation', 'the-events-calendar' ), $events_label_singular ); ?>">
    <ul class="tribe-events-sub-nav">
    <li class="tribe-events-nav-previous"><?php tribe_the_prev_event_link( '<span>&laquo;</span> %title%' ) ?></li>
    <li class="tribe-events-nav-next"><?php tribe_the_next_event_link( '%title% <span>&raquo;</span>' ) ?></li>
    </ul>

    Let me know how that goes!
    Ed ✌

    Thanks, Ed! I’ll definitely check out that single-event.php file. I’m just starting to learn php so it will be a good learning experience. I already removed the next/previous pagination via that custom css I mentioned in my follow-up post.

    But it would be a lot nicer looking and more user-friendly if those pagination links were there but only showed the category of events the user selected. Do you think that is something that can be done in that file?

    Thanks again!
    -chuck

    How did that work out for you?

    ??? How did what work out? Not sure what you’re referring to. I’m still looking for a solution that will let me have the Next/Previous navigation on the events page when I filter by category. I looked at that single-event.php file but I don’t know enough php to decipher its references to the navigation when the /<category-name> is used to display just a certain category of event.

    So I’ll just limp along with the custom css code I mentioned in my 2nd post above.
    Oh well…still learning!

    Plugin Contributor Andras Guseo

    (@aguseo)

    Hi @palmerct and @tvaug,

    Sorry for the misunderstanding.

    Creating the prev/next links that would point to the appropriate event in the same category would require some serious customization / coding, which is unfortunately beyond the scope of support we can provide here.

    To get you started:

    The links are generated in this file:
    the-events-calendar/src/views/single-event.php

    And this is used to generate the URL to the next event:
    https://theeventscalendar.com/function/tribe_the_next_event_link/

    I think you would need to create a custom function that would pull the next event from the same category, or pull all events, check if it’s in the category, if not check the next… when you hit one print out the url.

    Hope this helps.

    Cheers,
    Andras

    Ed

    (@erishel)

    Hey there,

    Since this topic has been inactive for a while, I’m going to go ahead and mark as resolved. Don’t hesitate to reopen or create a new topic if you still need help! 😄

    Take care,
    Ed 🤟

    Wow, this seems like such a basic function. I too was expecting the prev/next to filter on the category. Why bother creating the categories. I would think a simple sql query to get the list before falling into the navigation. All were doing is traversing a list.

    Hi! I’d like to make the ‘<<All events’ button at the top of single events pages go to a different page other than the Calendar view. It should take back to the Events listing page I created. It gets confusing for users currently.

    How can I do this?

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Remove next/previous event link’ is closed to new replies.