Adding page title and content

Home Forums Calendar Products Events Calendar PRO Adding page title and content

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #960676
    Matt
    Participant

    Hi! ๐Ÿ™‚

    Is it possible to include, before the calendar is displayed, the actual page title (not calendar title) and content? So…within the default template is it possible to do something like:

    <?php
    /**
     * Default Events Template
     * This file is the basic wrapper template for all the views if 'Default Events Template'
     * is selected in Events -> Settings -> Template -> Events Template.
     *
     * Override this template in your own theme by creating a file at [your-theme]/tribe-events/default-template.php
     *
     * @package TribeEventsCalendar
     *
     */
    
    if ( ! defined( 'ABSPATH' ) ) {
    	die( '-1' );
    }
    
    get_header(); ?>
    
    	<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
    
        	<h1><?php the_title(); ?></h1>
                
    		<?php the_content(); ?>
    
    	<?php endwhile; ?>
    
    	<div id="tribe-events-pg-template">
    		<?php tribe_events_before_html(); ?>
    		<?php tribe_get_view(); ?>
    		<?php tribe_events_after_html(); ?>
    	</div> <!-- #tribe-events-pg-template -->
    <?php get_footer(); ?>

    If I add the above code the <h1> and content do not show.

    #960792
    Geoff
    Member

    Hi there, Matt! Thanks for getting in touch and welcome to the forums. I hope you’ve been enjoying PRO so far. ๐Ÿ™‚

    I’m not quite sure I follow which page title and content you’re trying to add tio the template. Could you elaborate on that a little bit?

    The default template serves as the foundation for all Event pages. Some of those pages are not actually pages, but archives (such as the full calendar views). That would mean that the loop you’ve added would not always render any content. Also, you may need to attach that loop to a specific query so the loop knows what to output.

    I could be missing the point altogether, so please feel free to provide some more details on what you’re trying to do and I’d be happy to take another look.

    Cheers!
    Geoff

    #960849
    Matt
    Participant

    Hi Geoff. Loving Pro so far!

    I’ll try to explain. So within WordPress > Pages I have created the following structure:

    • Home
    • Rooms for hire
    • Availability
    • Bookings
    • Contact

    Each one of the pages above has a title (<h1>) and content added via the wysiwyg. However the availability page, which I am using to display the calendar, does not show the title and content. So the calendar appears fine – nothing wrong with this but before this I would like to add the default page title and copy. So the page would flow:

    <h1>Availability</h1>
    <p>Introduction and how to use the calendar….</p>
    <calendar>

    I could hard wire the h1 and copy into the default template but would like these to be editable through WordPress.

    I hope that makes more sense?! ๐Ÿ™‚

    #960871
    Geoff
    Member

    Gotcha! Thanks for the explanation–this help a ton. ๐Ÿ™‚

    There is an area in the Events settings that will allow you to drop your HTML in the template without having to touch the template code. If you head to Events > Settings > Display, there is an editor in the Advanced Templateย Settings section where you can add HTML before the calendar begins. Give that a shot and see if that does the trick for you.

    Cheers!
    Geoff

    #960946
    Matt
    Participant

    Of course…seems so obvious now! A wood for the trees moment. ๐Ÿ™‚

    Thank you for your help.

    #960972
    Geoff
    Member

    Awesome! I’m so glad that helped. Thanks for confirming. ๐Ÿ™‚

    Cheers!
    Geoff

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Adding page title and content’ is closed to new replies.