Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #608165

    Hi,

    I use The Event Calendar Pro and want to display event data within standard Masonry element in Enfold theme. I have located the masonry_entries in parent theme folder. But I would like to do these changes to the functions.php in my child theme folder to be able to keep theme updates simple.

    Here’s what I have managed to do:
    on line 620 in masonry_entries I have added these two lines:

    $items .=  "<h2><span class='eventdate'> " .sp_get_start_date ( $postId = $entry['ID'], $showtime = false ); "</span>";
    $items .=  "<span class='eventcost'> " .tribe_get_cost ($post_id = $entry['ID'], $with_currency_symbol = true ); "</span> </h2>";

    This displays the event date and costs as the title in masonry view. And it works fine. But I would prefer a solution where I can run updates on parent theme without having issues of adding code each time.

    Is it a way to use add_filter to modify this in functions.php. Alternativly I can also add this info to the container, not the title/figcaption. I’m a PHP beginner and don’t hope this is to simple.

    I would also appreciate articles on add_filter if anyone have some good tips.

    Thanks!

    Best regards
    Roger

    • This topic was modified 8 years ago by lipstick.
    #609431

    Hi lipstick!

    Thank you for using Enfold.

    Use this filter in the functions.php file:

    add_filter('avf_masonry_loop_prepare', 'avf_masonry_loop_prepare_mod', 10, 2);
    function avf_masonry_loop_prepare_mod($key, $entries) {
        $key['text_after'] .=  "<h2><span class='eventdate'> " .sp_get_start_date ( $key['ID'], $showtime = false ); "</span>";
        $key['text_after'] .=  "<span class='eventcost'> " .tribe_get_cost ($key['ID'], $with_currency_symbol = true ); "</span> </h2>";
        return $key;
    }

    Best regards,
    Ismael

    #857399

    Hi Ismael hi, lipstick

    thank´s for your help with this filter. It works perfect on my site!

    Can you help me to show the category and the link to the post?

    Thanks!

    Best regards,
    Tobias

    #857647

    Hi Tobias,

    Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?

    Can you help me to show the category and the link to the post?

    – Where?

    Best regards,
    Victoria

    #857854

    Hi Vicoria,
    please look private Content. I use the masonry gallery to show the Events on 1 Site.

    Thanks for your fast answer!

    Tobias

    #857997

    Hi Tobias,

    Here is a thread for you to consider

    If you need further assistance please let us know.
    Best regards,
    Victoria

Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.