Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #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;
    }

    #862130

    Hey (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,
    Basilis

    #884902

    Hello,

    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;
    }

    #885505

    Hi 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,
    Victoria

    #885662
    This reply has been marked as private.
    #885717

    Hi 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,
    Victoria

    #885720
    This reply has been marked as private.
    #886475

    Hi 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,
    Victoria

    #886566

    Thank you so much….that worked!

    #886569

    In 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!

    #886703

    Hi,

    I’m glad this worked out. Did you need further help, or shall we close this thread?

    Best regards,
    Jordan Shannon

    #887494

    Sure. Thanks so much!

    #887620

    Hi,

    If you need additional help, please let us know here in the forums.

    Best regards,
    Jordan Shannon

Viewing 13 posts - 1 through 13 (of 13 total)
  • The topic ‘Read more in masonry functions file’ is closed to new replies.