0

I've been trying and failing at trying diff code snippets and searching online for something that works. Posted on the more general forum but saw recommendations to post WP questions on this forum.

I'm customizing a theme that has a Events section as a Post type.
The request is to have one page for Upcoming Events and another for Past Events. There is a way to filter Past Events using website.com//events/?period=past&order=desc so I've set up the pages and nav menu that way. But both pages have the same title "Events" which can be confusing to the user.

I contacted the theme creator to ask if there's a way to change the titles and was told it's still technically one page so it can only have one title. Is there a workaround so that one page can say "Upcoming Events" and the filtered archive page to say "Past Events"? There are two php files, the archive-header.php and archive-layout.php (screenshots attached). Apologies, my understanding of php is very limited (though learning) and would appreciate any insight or recs. thank youenter image description here

enter image description here enter image description here

0

Try this: in archive-header.php line 8 - 10 by interecepting the variable "period=past" or ( I guess) "period = future" of current URL

<?php else :
  if( !empty($_GET['period'] ) && $_GET['period'] == 'past')
  {
    echo "Past Events";
  }
  elseif( !empty($_GET['period'] ) && $_GET['period'] == 'future' /*or whatever*/){
    echo "Upcoming Events";        
  }
  else{
    echo esc_html(lsvr_pressville_get_event_archive_title());//the default output of your theme function
  }

  endif; ?>
  • finally found a solution after many probing, questions, and trying. thank you for your comment, i'll prob be posting more questions as i go. very much appreciated! – user1102824 Feb 12 at 22:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.