-
AuthorPosts
-
March 10, 2015 at 2:41 pm #408838
I have used in a page the display-mode masonry for the blog. I want to add a “read more” button. So I added this code to functions.php:
https://kriesi.at/support/topic/read-more-element-within-masonry-blog-not-working/#post-403284
But the excerpt is on every blog-item the same…
March 11, 2015 at 5:00 am #409658Hi joeberlin!
Thank you for using Enfold.
Replace it with this:
add_filter('avf_masonry_loop_prepare','avia_change_default_link', 10, 2); function avia_change_default_link($loop, $entries) { foreach($entries->posts as $key => $entry) { if($entry->post_type == "post") { $more = "<br /><span class='masonry-more-link-arrow'>".__('Read more','avia_framework')."</span>"; $loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, '') . $more; } } return $loop; }
Cheers!
IsmaelMarch 11, 2015 at 11:10 am #409750Thank you for the reply. The excerpt is now correct, but there is no “Read more” link…
March 12, 2015 at 8:01 am #410335Hey!
Looks like the filter isn’t working. Please edit config-templatebuilder > aviashortcodes > masonry_entries.php. Look for this code:
if(empty($this->loop[$key]['content'])) { $this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, ''); }
Replace it with:
if(empty($this->loop[$key]['content'])) { $this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, '') . "<br /><span class='masonry-more-link-arrow'>".__('Read more','avia_framework')."</span>"; }
Cheers!
IsmaelMarch 12, 2015 at 1:22 pm #410424Thank you! This works!
March 13, 2015 at 5:13 am #410837January 12, 2016 at 3:59 pm #563932Hey, this is not working anymore, I cant find:
if(empty($this->loop[$key][‘content’]))
{
$this->loop[$key][‘content’] = avia_backend_truncate($entry->post_content, apply_filters( ‘avf_masonry_excerpt_length’ , 60) , apply_filters( ‘avf_masonry_excerpt_delimiter’ , ” “), “…”, true, ”);
}On masonry_entries.php
Please I need to add a read more on mansory blog.
regards
- This reply was modified 8 years, 10 months ago by DanielBu.
January 13, 2016 at 6:41 am #564365Hi,
Please send us a temporary admin login so that we can have a closer look. You can post the details in the Private Content section of your reply. You might want to create a new thread since the original poster will be able to see your details otherwise.
Best regards,
RikardJanuary 13, 2016 at 4:39 pm #564794Here you can find them
January 14, 2016 at 3:53 am #565185Hi Rikard,
Is not working at all, becouse it shows the read more, but the excert is the same in all post, I tried that before.
I need this working.Thanks a lot!
RegardsJanuary 16, 2016 at 4:49 am #566425Hi!
You need to modify the helper-masonry.php instead of the masonry_entries.php file. Look for this code around line 416:
$this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, '');
Regards,
IsmaelMarch 2, 2016 at 1:33 pm #592042Now (Enfold Version 3.4.7) you have change at config-templatebuilder > aviashortcodes > helper-masonry.php
This (line 416):
$this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, '');
To this:
$this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, '') . "<br /><span class='masonry-more-link-arrow'>".__('Read more','avia_framework')."</span>";
March 7, 2016 at 12:01 pm #594231June 16, 2017 at 3:06 pm #808972Hi Enfold Team,
I tried the code above in the helper-masonry.php but nothing change, the “read” more” does not appear…
Is it me or there is another solution ?
Thanks,
Clément
June 19, 2017 at 8:42 pm #809950Hi Blue_Bear,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look? Is the code still there? Did you get any errors?
Best regards,
VictoriaJune 20, 2017 at 10:13 am #810270Yes of course !
June 20, 2017 at 7:17 pm #810611Hi Clément,
You need to create the same folder structure and put the file /wp-content/themes/enfold/config-templatebuilder/avia-shortcodes/av-helper-masonry.php in there, make changes in it and see what happens :)
Best regards,
VictoriaJune 21, 2017 at 3:23 pm #810994Hi Victoria,
I’m sorry but I don’t understand what you mean… “create the same folder structure” you mean in my child theme >config-templatebuilder/avia-shortcodes/av-helper-masonry.php ?
Makes changes so you mean to put the code above ?
$this->loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 60) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, '') . "<br /><span class='masonry-more-link-arrow'>".__('Read more','avia_framework')."</span>";
Thanks,
ClementJune 23, 2017 at 12:29 pm #812070Hi Clement,
Yes, this is what I meant, did you manage to do it?
Best regards,
VictoriaJune 23, 2017 at 1:05 pm #812094Hi Victoria,
I’ve just did it and nothing happen. I even try to add the code of #410335 post in my functions.php but still nothing.
Maybe I did something wrong ??
Thanks,
ClementJune 25, 2017 at 4:29 pm #812713Hi Clément,
I don’t see this file in your child theme, only styles.css and functions.php. How can I check the code on your side?
Best regards,
VictoriaJune 26, 2017 at 12:07 pm #813007Hi victoria,
I give you an acces to my ftp in the private section.
Thanks,
ClementJune 28, 2017 at 6:41 am #813683Hi,
Please move the modification then add this code in the functions.php file.
// masonry read more function ava_custom_script_mod(){ ?> <script> (function($){ function a() { $('<div class="av-masonry-read-more">Read More</div>').insertAfter('.av-inner-masonry-content-pos'); } a(); })(jQuery); </script> <?php } add_action('wp_footer', 'ava_custom_script_mod');
Best regards,
IsmaelJune 28, 2017 at 12:28 pm #813774It’s just perfect thanks you very much !!!!!
You can close the topic.
Best regards,
ClementJune 28, 2017 at 5:45 pm #814011Great! We’re happy to help.
Please let us know if you need help with anything else.
Thank you for using Enfold.
Cheers!
Sarah -
AuthorPosts
- The topic ‘"Read more" at Masonry Blog’ is closed to new replies.