WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: The Events Calendar] Code suggestion for including templates (6 posts)

  1. Peter Wilson
    Member
    Posted 4 years ago #

    Hello,

    In the-events-calendar.php, may I suggest that templates are loaded using the wordpress functions, as this will support child themes fully.

    The current code is:

    if (file_exists(TEMPLATEPATH.'') ) {
    	include (TEMPLATEPATH.'/events/list.php');
    }
    else {
    	include dirname( __FILE__ ) . '/views/list.php';
    }

    where as the wordpress method is:

    $templates[] = "/events/single.php";
    
    if ('' == locate_template($templates, true)) {
    	load_template( dirname( __FILE__ ) . '/views/single.php');
    }

    I'd also suggest using get_header() and get_footer() in the template files for much the same reason.

    Cheers,
    Pete Wilson

  2. wlanni
    Member
    Posted 4 years ago #

    +1 On this, thanks for posting it Pete. I was just about to post something very similar, but this could go back to my Thematic integration request elsewhere in this forum, noting that the calendar files don't get read out of the child theme, but out of the parent framework directory.

  3. Shane Pearlman
    Modern Tribe
    Posted 4 years ago #

    Fair enough. Let me check into it and get back to you. I've added a ticket to 1.6.

  4. Peter Wilson
    Member
    Posted 4 years ago #

    @shane.pearlman Thanks for the quick response, greatly appreciated.

    @wlanni Missed it by that much, chief.

  5. kkropp
    Member
    Posted 4 years ago #

    Hey Pete-

    Thank you very much for your post--I'm a first-time WP designer who's been struggling with exactly this issue while working with an iThemes Flexx child theme. Just looks like the plug in is going out to the parent theme for header and footer stuff rather than finding the edited files in the child theme. I'd like to try your suggestion above but noticed your reference to using get_header() and get_footer() and realized I was out of my depth.

    Is the code highlighted above sufficient to solve this problem on its own, or are there other changes I'd need to make elsewhere (like the get_header() and get_footer() references) for this fix to work?

    Apologies in advance for the layman's questions...

    Thanks!
    Karl

  6. Peter Wilson
    Member
    Posted 4 years ago #

    @kkropp

    Sorry for the delayed response, I've started a new topic in Themes and Templates and replied in there.

    Pete

Topic Closed

This topic has been closed to new replies.

About this Topic