Home › Forums › Calendar Products › Events Calendar PRO › How do I include Calendar templates in my header.php?
- This topic has 4 replies, 3 voices, and was last updated 10 years, 2 months ago by
Support Droid.
-
AuthorPosts
-
January 3, 2016 at 8:45 pm #1049503
Cynthia Lockley
ParticipantI am switching to a new theme (Aaron). It only puts the header information on the home page. I want to have it on all my pages so I changed if ( is_home() || is_front_page() ) to add singular pages. Now I’d like to add the Events Calendar templates. I tried the following but it didn’t work. How do I include them?
if ( is_home() || is_front_page() || is_singular() || is_page_template('single-day.php') || is_page_template('day.php') || is_page_template('week.php') || is_page_template('photo.php') || is_page_template('list.php') || is_page_template('map.php') ) Without the header, the Events Calendar pages start too high on the page and the fixed menu hides the top of the page. Screen capture of calendar month page https://www.flickr.com/photos/45306615@N04/23866894230/in/album-72157663010188041/ Screen capture of home page showing header with calendar on the home page https://www.flickr.com/photos/45306615@N04/23866895310/in/album-72157663010188041/ Screen capture of singular site page with header https://www.flickr.com/photos/45306615@N04/24054911752/in/dateposted-public/Thanks.
January 4, 2016 at 6:27 am #1049770George
ParticipantHey @Cynthia,
Just to mention this to get it out of the way, we can only provide extremely limited support for custom coding projects or any sort of question like “How do I make this code thing happen” – see the “Product Support” section of http://theeventscalendar.com/terms for more information.
I only mention that to set expectations, however – for your specific questions here, it sounds like what you’re looking for is a set of conditional statements for things related to The Events Calendar.
There is fortunately a whole list of such functions, with descriptions about what they do, in this “Gist” here → http://m.tri.be/18z9
Check out that Gist and use the various examples there – if you play around with things I’m sure you’ll be able to build what you need.
In closing, just to hopefully save some time, code like this will not work for templates within The Events Calendar (or any plugin):
is_page_template('photo.php')The is_page_template() function will only work for theme templates.
I hope this information helps!
Cheers,
GeorgeJanuary 4, 2016 at 11:35 am #1049977Cynthia Lockley
ParticipantWell, OK. Thanks for the note that is_page_template(‘photo;php’) won’t bring in the photo template. I’ll take those out.
Earlier, I had tried changing the top of my tribe-events child day.php template to
if ( ! defined( 'ABSPATH' ) ) { die( '-1' ); } get_header('singular'); ?>That worked for day views but the same sort of thing doesn’t work for any other views.
I looked at the sample functions, unfortunately none are setting a page type, so I’ve tried to come up with the following based on other events calendar functions I have but it just gives me a blank page.
<?php // // ************************************* // Add Site Header to Event View pages // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // function add_header_to_page( $template ) { } add_filter( 'request', 'add_header_to_page' ); if( tribe_is_event() && $query->_is_week() ) $template['page_type'] = array('week', 'tribe_events'); } get_header('singular'); ?>Hopefully trial and error will get me one that works. It seems simple if what I did for the day.php template worked in the template, maybe I just need to add one for each view in the functions.php. Frustrating that the theme doesn’t include headers on plugin pages.
-
This reply was modified 10 years, 3 months ago by
Cynthia Lockley.
January 4, 2016 at 1:31 pm #1050029George
ParticipantThanks for sharing more information here. Just to be clear, The Events Calendar views are not “real” WordPress Pages. The Events Calendar has its own templating system because it is a plugin, not a theme, and only themes can use WordPress’ built-in page template system at this time.
To learn more about The Events Calendar’s theming system, which should help, check out this guide here → https://theeventscalendar.com/knowledgebase/themers-guide/
I hope that guide helps! Since we cannot help with custom coding, I will close up this thread for now. However, if technical support questions arise at any time, open a new thread and we’ll respond as soon as possible.
Cheers!
GeorgeFebruary 18, 2016 at 8:33 am #1076448Support Droid
KeymasterThis topic has not been active for quite some time and will now be closed.
If you still need assistance please simply open a new topic (linking to this one if necessary)
and one of the team will be only too happy to help. -
This reply was modified 10 years, 3 months ago by
-
AuthorPosts
- The topic ‘How do I include Calendar templates in my header.php?’ is closed to new replies.
