• Resolved harf4ng

    (@harf4ng)


    Hi,

    Following the doc, I wanted to have my own template, with to start a custom single event display.

    So, I have copied the event-single.pho file I found in “wp-content/plugins/events-manager/templates/templates” into “wp-content/themes/Avada/plugins/events-manager/templates” and I tried to modify it, with just at first with a little echo “hello” to check if this works, but it does nothing, it just displays the basic content of the event.

    Note that I have setup the settings to “no” in “use format”.

    Thanks

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Support angelo_nwl

    (@angelo_nwl)

    you can try something like wp-content/themes/Avada/plugins/events-manager/templates/event-single.php

    Thread Starter harf4ng

    (@harf4ng)

    But yes, this is what I said I did, but it does nothing.
    Did I miss something?

    Also, as in the event-single there is written:
    /* Your file would be named single-event.php*/

    I have tried renaming it to single-event.php, and does not work as well.

    Do I have to do something in the settings to have events manager use my template instead of the default.

    Also, I have to disable “use format” for this to works, isn’t it?

    Thanks

    Thread Starter harf4ng

    (@harf4ng)

    Ok I found what’s wrong. I have to enable “use format” ??

    Though now there is something I don’t understand… is this possible to use placeholders in the template .php file?

    The default file shows something like:
    echo $EM_Event->output_single();

    So I think this displays the event, according to the “format” in the settings.
    But what about if we want to create the whole display in the template file, without using the “format”? Can I do that? How do I put placeholders into my php file, to display event infos?

    Thanks

    • This reply was modified 8 years ago by harf4ng.
    • This reply was modified 8 years ago by harf4ng.
    caimin_nwl

    (@caimin_nwl)

    Haven’t tested this but I’m pretty sure you can do something like this:

    echo $EM_Event->output_single("#_EVENTNAME");

    Thread Starter harf4ng

    (@harf4ng)

    Seems it does not work.
    Returns nothing.

    My php code is like that:

    global $EM_Event;
    /*@var $EM_Event EM_Event;*/
    echo $EM_Event->output_single(“#_EVENTNAME”);

    And it returns nothing.
    If I try just a echo “hello” then it works, I see the text “hello”, but the php with $EM_Event does not work.

    Any idea?

    Thanks

    caimin_nwl

    (@caimin_nwl)

    I think the solution is to wrap the placeholders around the shortcode you want to use:
    https://wp-events-plugin.com/documentation/advanced-usage/

    Thread Starter harf4ng

    (@harf4ng)

    In fact I managed to do this like this…
    I have used both the “format” and template file.

    In the format I have put:

    <div class=”return-list-events”>← Retour à la liste des événements</div>
    <div class=”event-name”><h2>#_EVENTNAME</h2></div>
    <div style=”float:right; margin:0px 0px 15px 15px;”>#_LOCATIONMAP</div>
    <p>
    Date / Heure<br/>
    Date(s) – #_EVENTDATES<br /><i>#_EVENTTIMES</i>
    </p>
    {has_location}
    <p>
    Emplacement<br/>
    #_LOCATIONNAME
    </p>
    {/has_location}
    <p class=”categories”>
    Catégorie<br />
    #_CATEGORYNAME
    </p>
    <!–#_ATT{Organisateur}
    #_ATT{Nom du contact}
    #_ATT{Téléphone du contact} –>

    And in the php file I have put:

    echo $EM_Event->output_single();
    $organisateur = get_post_meta($postID, ‘Organisateur’, true);
    $contactname = get_post_meta($postID, ‘Nom du contact’, true);
    $contactphone = get_post_meta($postID, ‘Téléphone du contact’, true);

    if ($contactname != ”)
    {
    echo ‘<p class=”event-contact”>’;
    echo ‘Organisateur<br />’;
    echo ‘<span class=”event-organisateur”>’, $organisateur, ‘</span><br />’;
    echo ‘Contact : ‘, $contactname, ‘ (‘, $contactphone, ‘)’;
    echo ‘</p>’;
    }

    echo ‘<br style=”clear:both” />’;
    /*echo get_post_meta($postID, ‘#_EVENTNOTES’, true);*/
    echo get_post_field(‘post_content’, $postID);

    This way I used format, and I used the php for things that need php.

    • This reply was modified 8 years ago by harf4ng.
    Thread Starter harf4ng

    (@harf4ng)

    Note that I have put my custom attributes in comments inside the format setting, because if I omit them, even if I display them in the php file, they are not available when I create an event.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Overriding templates’ is closed to new replies.