Support Forums

Calendar page title shows title of an event (continued)

  • Posts: 21 Topics: 5 Answers: 1
    | Permalink

    My Calendar page title shows title of the next upcoming event instead of “Calendar of Events” – as reported by other uses, e.g. in this closed thread: https://theeventscalendar.com/support/forums/topic/calendar-page-title-shows-title-of-an-event-and-wont-change/#post-19270

    I’ve read Jonah’s reply, but am not exactly sure how to fix it in my specific situation:

    (1) My ECP Template Settings: default page template (WordPress). (I have to use that setting because the default Events template would not display my events calendar in a reasonble way)

    (2) the_title() is executed in page.php of my Theme:
    ?php $page_title = ss_framework_get_custom_field(‘ss_page_title’) ? ss_framework_get_custom_field(‘ss_page_title’) : get_the_title(); ?

    Now, I’ve also seen Jonah’s conditional wrappers code. I tried to add that to the page.php file, but it didn’t make any difference. It’s the first time I am hard coding with my site, so chances are good there is a mistake on my side. Would you be so kind and specify what exactly I need to do?

    I guess, my first step is to make a copy of original page.php file of my theme and place it under my “childtheme” folder. What’s next?

    Thanks in advance!

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Hi Philipp,

    The instructions are different from theme to theme but yes if you have a child theme, you’ll want to first make a copy of page.php and then use the conditional code to override the display of the title in the template. So as an example if this is what you have:

    $page_title = ss_framework_get_custom_field(‘ss_page_title’) ? ss_framework_get_custom_field(‘ss_page_title’) : get_the_title(); ?
    

    You would want to replace it with something like this:

    if( tribe_is_month() && !is_tax() ) { // The Main Calendar Page
    	echo 'Events Calendar';
    } elseif( tribe_is_month() && is_tax() ) { // Calendar Category Pages
    	echo 'Events Calendar';
    } elseif( tribe_is_event() && !tribe_is_day() && !is_single() ) { // The Main Events List
    	echo 'Events List';
    } else {
    $page_title = ss_framework_get_custom_field(‘ss_page_title’);
    ss_framework_get_custom_field(‘ss_page_title’) : get_the_title();
    }
    

    Looks like the code you pasted got a little chopped up but hopefully that gives you the right idea…

    Cheers,
    Jonah

    Posts: 21 Topics: 5 Answers: 1
    | Permalink

    Hi Jonah,

    Thank you for the reply. I proceeded as suggested. My code in the page.php file now looks as follows: http://d.pr/i/m1cE

    Unfortunately, that wasn’t succesful. The whole site returns an erroe due to wrongly configured coding. Can you kindly advise further, Jonah? Anything wrgong in my code?

    Thank you,
    Philipp

    Posts: 21 Topics: 5 Answers: 1
    | Permalink

    Jonah,

    My next question is probable related to the same (at least similar) issue. When I click on the details of a specific event in the frontend, I two navigation links show up at the bottom screen which list again the titles of the prvevious event (left side) and next event (right side). Here’s the screenshot: http://d.pr/i/WKJv

    Instead of the event titles, I guess the right behavior would be to show “previous event” and “next event” – am I right? If yes, can you advise on where I need to adapt this kind of code?

    Thanks you very much.

    Philipp

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Hi Philipp,

    Can you please post the stock contents of your page.php file without any changes?

    To answer your other question about the links at the bottom of single events, you can easily change this by making a copy of /wp-content/plugins/the-events-calendar/views/single.php and placing in an ‘events’ folder in your theme and then modifying the template tags on lines 109 & 111 so it looks like so:

    tribe_previous_event_link('Prev');
    tribe_next_event_link('Next');
    

    I hope that helps but let me know if you need anything else.

    – Jonah

    Posts: 21 Topics: 5 Answers: 1
    | Permalink

    Hi Jonah,

    I greatly appreciate your reply. My second question was indeed very easy to solve. It worked! Thank you so much.

    Back to my main question: What is really the best way to share larger code snippets? I would love hear how you create these yellow boxed with code.

    Alternatively, please let me know if you would be interested in receiving my page.php files (old and new one) via mail.

    Thank you much.
    Philipp

    Posts: 21 Topics: 5 Answers: 1
    | Permalink
    Correct Answer

    Update: Here is my code on gist:

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Hi Philipp, I posted a comment on the Gist, please take a look, try it out and let me know if that works.

    You can post code here in the forums but it’s temperamental and only recommended for short snippets. To do so just wrap whatever you want to highlight in < code > < / code > tags.

    – Jonah

    Posts: 21 Topics: 5 Answers: 1
    | Permalink

    Hi Jonah,

    We almost made it. “Events Calendar” now shows up. (It’s in English, so I’m sure I will yet find a way how to translate that into German, but that’s not the main problem). The new problem is, that the this title shows up in the wrong area. Not where the page headers 1 would normally show up. See this screenshot: http://d.pr/i/6U1W.

    Do you know how we can solve that?

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Hi Philipp,

    Just posted another update to the Gist that should work.

    Cheers,
    Jonah

    Posts: 21 Topics: 5 Answers: 1
    | Permalink

    Jonah, You’re the Man! It works perfectly now. I even found out how easy it is to adapt/translate the ‘Events Calendar’ and ‘Events List’ (I’ve almost overseen that in the code snippet itself). Great.

    Now, I deeply apologize, but there is one more refinement we need. The ‘Events List’ tite now shows up for every category (instead of the category title itself). If we fix that, I think we’re done.

    Really, this not urgent, Jonah. So enjoy your weekend and come back to me next week. Greatly appreciate your great help.

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Hi Philipp,

    I just posted another update to account for categories in both the grid and list views. Please try it out and let me know whether or not it works for you.

    Cheers,
    Jonah

    Posts: 21 Topics: 5 Answers: 1
    | Permalink

    Hi Jonah. Thanks for another post. Someting must be wrong with the code (color codings in my tool tell me so and the site would not not work). I did try your “correction” code.

    Cheers,
    Philipp

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Hi Philipp, the correction code had issues. Try my latest correction.

    Cheers,
    Jonah

    Posts: 21 Topics: 5 Answers: 1
    | Permalink

    Jonah, awesome. This works brilliantly! Thank you so very much!!!

    Posts: 4021 Topics: 4 Answers: 763
    | Permalink

    Sweet! I’m closing this thread then.

    Thanks,
    Jonah

This thread hasn’t seen any activity for quite some time and we are not accepting further replies.

If you need further help with this or any other issue, please create a new topic (you can of course include a link to this one if that helps to provide additional context) and one of the team will be only too happy to help.