How to change title depends of Event Type?

Home Forums Calendar Products Events Calendar PRO How to change title depends of Event Type?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #962380
    Gabriel
    Participant

    Hello,
    Our events are divided in 2 types. We created these types as Event Tags.

    So we have 2 mainly urls:
    – Events type 1: site.com/events/?tribe_event_display=list&tribe_tags=137
    – Events Type 2: site.com/events/?tribe_event_display=list&tribe_tags=138

    How to change the title “Upcoming Events” depends of Event Type?

    Actually I did it with this jQuery:

    	jQuery( document ).ready(function() {
    		var actualUrl = window.location.href.toLowerCase();
        if (actualUrl.indexOf("/events/") > -1) {
        	var eventType = getUrlParameter("tribe_tags");
        	var newTitle = "" ;
          if (eventType=="137") {
          	newTitle = "Events Type 1" ;
          };
          if (eventType=="138") {
          	newTitle = "Events Type 1" ;
          };
          if (newTitle!="") {
          	jQuery( "h2.tribe-events-page-title" ).text(newTitle);
          };
        };
    

    This code works OK when the events page is loaded, but when we click into “Next Events »” link or the previous one, we lose the new title. Its because the next events are loaded via Ajax, so our code isn’t load again.

    Any idea to do it?

    Thanks

    #962592
    Barry
    Member

    Hi Gabriel,

    Great question!

    So some code running server-side should ensure your change persists even when the user pages forward/backwards by ajax. The basic form would be as follows (and you might add this either to your theme’s functions.php file, a custom plugin or some other suitable place):

    https://gist.github.com/anonymous/c2c9c2d5bb5c84df9796

    Of course, you would need to expand it and test to see if a certain tag had been applied before making your modifications, but that should give you a basic outline you can build on 🙂

    #966023
    Barry
    Member

    Hi!

    It’s been a while so I’m going to go ahead and close this topic.

    • Need help with anything else? Go right ahead and post a new topic, one of the team will be only too happy to help
    • Still need help with this issue and need to re-open it? Again, please simply create a new topic and link to this one to provide the team with some context

    Thanks!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘How to change title depends of Event Type?’ is closed to new replies.