Hey guys!
First of all: thanks for your great theme and the last update a few days before – it’s just awesome!
The masonry module on my site displays a single post category.
My question: is it possible to add a filter hook, so the masonry module would display the single post category PLUS a product category?
Thanks for your help!
Hey jolak!
Unfortunately I don’t think there is an easy way to go about that. It would require a huge amount of custom work and you would need to hire a freelancer for it. You can find custom work on werkpress.com and https://studio.envato.com
Feel free to make a feature request for Kriesi here: kriesi.at/support/enfold-feature-requests/
Regards,
Andy
Hey!
Thanks for your answer.
I worked on this and now i have a different solution:
i created a custom field (with ACF) “product_url” and edited the masonry_entries.php like this
instead of line 734:
$this->loop[$key]['url'] = get_permalink($id);
i have:
if(get_field('product_url',$id)){
$this->loop[$key]['url'] = get_field('product_url',$id);
} else {
$this->loop[$key]['url']= get_permalink($id);
};
This works pretty well.
Now my question is: how can i hook this snippet into my childtheme?
(i know i can’t just overwrite masonry_entries.php because it only works with template files – so there has to be some kind of hook… but i can’t get it!)
Thanks for your help!!
Nobody who is familiar with enfold hooks?!
Hi!
Not sure if this is going to work with the plugin but you can try to add this to 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 )
{
$id = $key['ID'];
if($key['post_type'] == 'post') {
foreach ( $key as $post => $value ) {
$field = get_field('product_url',$id);
if($post == 'html_tags' && $field) {
$value[0] = 'a href="' . $field .'"';
}
$key[$post] = $value;
}
}
return $key;
}
Best regards,
Ismael
Hi Ismael,
Yes, it works – thank you so much!!