Home › Forums › Calendar Products › Events Calendar PRO › Events Title page not ok
- This topic has 5 replies, 2 voices, and was last updated 10 years, 6 months ago by
Nico.
-
AuthorPosts
-
October 14, 2015 at 4:53 am #1014459
Brian
ParticipantHello,
I have a problem with the page supposed to display my events: the page title is “Archive”.
I added a small php code so that it now dispays “Events” but this code is not quite ok, as it will also work on 404 pages… It means that when someone will type a wrong address, he will get a 404 page with “Events” as the title…
I need some help to fix this problem.
Thanks
October 14, 2015 at 1:11 pm #1014641Nico
MemberHi there Brian.
Thanks for reaching out, hopefully this is simple to achieve ๐
Just add this snippet to your theme’s functions.php file (located at wp-content/themes/your_theme/) and it should de the trick:
https://gist.github.com/ggwicz/b8a6bceaba0edd9efa2a
Please let me know if this works for you,
Best,
NicoOctober 22, 2015 at 7:06 am #1016887Brian
ParticipantHello Nico,
Unfortunately, it doesn’t work for me, because I was not talking about the title tag of the page, but I was talking about the pagename.
In my theme, and on my pages I display the page name. So let’s say I have a page called “Our team”, it will be displayed “Our team” on the page, at the top of the page (not the title tag of the page). The problem is that with the calendar pages, instead of having something like “Calendar”, I had the word “Archive” as the page title.
So I edited my theme and I wrote some code: when the page id is 0, I display the name “Agenda” for the page title.
but the problem is that when a 404 error page is displayed, it’s written “Agenda”…Do you see my problem ?
The problem is that the pages for the agenda are not “real pages”, with a name and a slug. So when I want to add some code to display the correct title, I have no way to know which page I’m on. If i’ts a standard page, it has its own ID, but for 404 pages and calendar pages, the ID is 0…Do you have any idea of what to do to solve the problem?
October 23, 2015 at 9:04 am #1017342Nico
MemberHey Brian,
Thanks for following up and sorry for the miss understanding here!
If you are able to build a conditional to indicate the ‘title’ text you can surely re-use some of the code in the snippet and have something like:
...
if ( $page_id == 0 ) {if ( tribe_is_list_view() ) {
$title = 'Future List Events';
} else if ( tribe_is_month() ) {
$title = 'Future Month Events';
} else if ( tribe_is_day() ) {
$title = 'Future Day Events';
} else if ( is_singular( Tribe__Events__Main::POSTTYPE ) && ! tribe_is_showing_all() ) {
$title = 'A Single Event';
} else {
// catch non calendar views
$title = '404';
}
}
...
Other option is to perform a check by post_type, for example:
if ( get_post_type() == Tribe__Events__Main::POSTTYPE ) {
$title = 'Events';
}
Please let me know if any of those suggestions work for you,
Best,
NicoOctober 29, 2015 at 4:41 am #1019682Brian
ParticipantThanks Nico.
Finally I got another answer somewhere on a forum, and here’s the bit of code that I used:
if ( tribe_is_month() && ! is_tax() ) { // Month View Page .... }Thanks for taking the time to help me.
Regards,
BrianOctober 29, 2015 at 7:40 am #1019750Nico
MemberHey Brian,
Stocked to hear you could find a workaround for this ๐
Iโll go ahead and close out this thread, but if you need help with anything else please donโt hesitate to create a new one and we will be happy to assist you.
Best,
Nico -
AuthorPosts
- The topic ‘Events Title page not ok’ is closed to new replies.
