How can I assign templates to pages -please help!

WordPress Event Management, Calendars & Registration Forums General Question How can I assign templates to pages -please help!

This topic contains 3 replies, has 3 voices, and was last updated by  Stephen Harris 11 years ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #5492

    Here is the problem:

    The sidebar om the single event page here is wrong: http://d26596123.u48.surftown.dk/kalender/comfort-in-living/#.UWVlllePZrk

    It has to be this sidebar used on the page displaying the calendar
    http://d26596123.u48.surftown.dk/kalender-4/

    The thing is, that the single event page is using my themes post template and the calendar page is using the left-sidebar template.

    I get the picture, but my php skills are poor and I don´t know what templates to combine, to get the right result.

    And yes I have read: http://wp-event-organiser.com/documentation/editing-the-templates/

    So please, if you can, help.

    Cool Plugin!

    http://wordpress.org/extend/plugins/event-organiser/

    Steffen Innonet
    #5496

    Hi Steffen,

    If you open up your page template you should find a function which says the_content(). Now this may not be in that file, because some themes break up their templates into different parts to keep things a bit more organised. So keep any eye out for get_template_part(), which includes other template files.

    In any case, the_content() function is responsible for printing the page content – and we want the event page to look pretty much identical but with the event content (and perhaps a map, dates etc) where the normal ‘page content’ would be.

    So first create a template for a single event in your theme: single-event.php, which is an exact copy of the page template.

    Next try viewing an event. It should look like your page – but now there is no event data present. We can add this – just above your the the_content(), put

    <?php eo_get_template_part('event-meta','event-single'); ?>
    

    (or where ever you want it).

    If get stuck, feel free to post a link to a gist or pastebin of your template file.

    Stephen Harris
    #5594

    Ok. I have tried different things and reached the conclusion, that customizing my own single-event.php.

    I have a few questions:

    Will Event organizer by default choose single-event-php to display single events, or do I have to declare that somewhere? I belive that it takes partes of single.php within the theme aswell?
    Can you tell me what to do, if I want to customize the template, so that I can use say ” sidebar left 3″ which is a sidebar created within the theme. Right now I have been copying some sidebar php code from other templates whish has caused me some problems.

    Regards Steffen

    Steffen
    #5600

    Hi Steffen,

    The plug-in will first look in your child (and then parent theme) for the appropriate templates. If they’re not there it will use the default templates. So if you wish to use your own – just create them in your theme, there is no need to declare them anyway.

    A slight exception is the single event page. Over-riding default behaviour is the same as above, but if you do not have single-event.php in your theme, it will actually use single.php and insert event details before the main body of the text.

    If you wish to just edit the event details, the best template to edit is event-meta-single-event.php.

    However, if you want to alter the structure of the single event page – edit single-event.php. To display a sidebar you can use get_sidebar() – passing the ID of the sidebar (see codex). Typically you would call this at the bottom of the template, just above get_footer() – but this may vary in different themes. The easiest way is to look at your theme’s single.php to see how its done there.

    Hope that helps!

    Stephen Harris
Viewing 4 posts - 1 through 4 (of 4 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.