-
AuthorPosts
-
April 5, 2016 at 10:48 am #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, 7 months ago by lipstick.
April 7, 2016 at 8:49 am #609431Hi 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,
IsmaelSeptember 27, 2017 at 9:50 am #857399Hi 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,
TobiasSeptember 27, 2017 at 5:57 pm #857647Hi 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,
VictoriaSeptember 28, 2017 at 5:59 am #857854Hi Vicoria,
please look private Content. I use the masonry gallery to show the Events on 1 Site.Thanks for your fast answer!
Tobias
September 28, 2017 at 12:46 pm #857997Hi Tobias,
Here is a thread for you to consider
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.