-
AuthorPosts
-
October 7, 2017 at 3:03 pm #861370
Hello,
I added this code to my functions.php to get a read more text in my portfolio masonry.
It is working but actually I want to add an avia button with icon in it.So I want to replace ‘Lees meer >’ with an avia button with icon.
Is this possible?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 == “portfolio”)
{
$more = “<br /><span class=’masonry-more-link-arrow’>”.__(‘Lees meer >’,’avia_framework’).”</span>”;
$loop[‘content’] = avia_backend_truncate($entry->post_content, apply_filters( ‘avf_masonry_excerpt_length’ , 60) , apply_filters( ‘avf_masonry_excerpt_delimiter’ , ” “), “…”, true, ”) . $more;
}
}return $loop;
}October 9, 2017 at 9:50 pm #862130Hey (Email address hidden if logged out) ,
Generate the shortcode you want to use, and replace the Lees Meer and then you need to make more as
$more = do_shortcode(”);where inside is your shortcode.
Else you can modify what you have now with some CSS so you can convert it to box.Best regards,
BasilisDecember 5, 2017 at 2:25 am #884902Hello,
I too want to add a ‘Read more” link to masonry elements based on post types, and I found the code below on another thread, but when I try it, the ‘read more’ tag gets added but the excerpt goes away. Can you tell me why? Here’s the code I’m adding to functions.php in my child theme:
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 == “team_members”)
{
$more = “<br /><span class=’more-link’>”.__(‘Read more’,’avia_framework’).”</span>”;
$loop[‘content’] = avia_backend_truncate($entry->post_content, apply_filters( ‘avf_masonry_excerpt_length’ , 80) , apply_filters( ‘avf_masonry_excerpt_delimiter’ , ” “), “…”, true, ”) . $more;
}
}return $loop;
}December 6, 2017 at 11:40 am #885505Hi leadingnorth,
Can you give us temporary admin access to your website in the private content box below, so that we can have a closer look?
Best regards,
VictoriaDecember 6, 2017 at 4:55 pm #885662This reply has been marked as private.December 6, 2017 at 6:34 pm #885717Hi leadingnorth,
Try the code like 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 == "team_members") { $more = "<br /><span class='more-link'>".__('Read more', 'avia_framework')."</span>"; $loop[$key]['content'] = avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 80), apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, "") . $more; } } return $loop; }
Best regards,
VictoriaDecember 6, 2017 at 6:39 pm #885720This reply has been marked as private.December 8, 2017 at 1:08 pm #886475Hi leadingnorth,
Here is the code you can put in your funtions.php
add_filter('avf_masonry_loop_prepare', 'avia_change_default_link', 10, 2); function avia_change_default_link($loop, $entries) { { if($loop['post_type'] == "team_members") { $more = "<br /><span class='more-link'>".__('Read more', 'avia_framework')."</span>"; $loop['content'] .= $more; } return $loop; }
If you need further assistance please let us know.
Best regards,
VictoriaDecember 8, 2017 at 6:38 pm #886566Thank you so much….that worked!
December 8, 2017 at 6:40 pm #886569In case anyone wants to use this, I added the “>” to the right hand side of the ‘read more’ tag to make it look a bit better, and here’s the code for functions.php:
/*add read more to masonry team page*/
add_filter(‘avf_masonry_loop_prepare’, ‘avia_change_default_link’, 10, 2);
function avia_change_default_link($loop, $entries) {
if($loop[‘post_type’] == “team_members”) {
$more = “<br /><span class=’more-link’>”.__(‘Read more’, ‘avia_framework’).'<span class=”more-link-arrow”></span>’.”</span>”;
$loop[‘content’] .= $more;
}return $loop;
}thanks again Victoria!
December 9, 2017 at 1:01 am #886703Hi,
I’m glad this worked out. Did you need further help, or shall we close this thread?
Best regards,
Jordan ShannonDecember 11, 2017 at 4:34 pm #887494Sure. Thanks so much!
December 12, 2017 at 12:54 am #887620Hi,
If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘Read more in masonry functions file’ is closed to new replies.