How do I include Calendar templates in my header.php?

Home Forums Calendar Products Events Calendar PRO How do I include Calendar templates in my header.php?

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #1049503
    Cynthia Lockley
    Participant

    I 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.

    #1049770
    George
    Participant

    Hey @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,
    George

    #1049977
    Cynthia Lockley
    Participant

    Well, 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.

    #1050029
    George
    Participant

    Thanks 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!
    George

    #1076448
    Support Droid
    Keymaster

    This 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.

Viewing 5 posts - 1 through 5 (of 5 total)
  • The topic ‘How do I include Calendar templates in my header.php?’ is closed to new replies.