Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #588932

    Hi Team!
    Im wandering if is posible to have diferent excerpt length for the masonry… I explain:
    1- I have one masonry in the home page showing the blog, there I need 99 excerpt length:
    http://www.farmacia-amado.com.mialias.net/
    2- I have one masonry in the services page, there I need 260 excerpt length:

    I try this in functions.php:

    
    /* EXCERPT */
    
    add_filter( 'avf_masonry_excerpt_length', 'masonry_excerpt_length');
    function masonry_excerpt_length() {
    $excerpt = 260;
    return $excerpt;
    }
    
    /* BTN MORE EN MASONRY */
    
    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['content'] =   avia_backend_truncate($entry->post_content, apply_filters( 'avf_masonry_excerpt_length' , 99) , apply_filters( 'avf_masonry_excerpt_delimiter' , " "), "…", true, '') . $more;
            }
        }
    
        return $loop;
    }
    #588933

    Hi Victor!

    Can you please try changing your first part of code to following one

    add_filter( 'avf_masonry_excerpt_length', 'masonry_excerpt_length');
    function masonry_excerpt_length() {
    if(is_page(18)){
    $excerpt = 260;
    }
    else {
    $excerpt = 100;
    }
    return $excerpt;
    }

    Regards,
    Yigit

    #588976

    Just perfect!
    Thank you very much!

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘Diferent excerpt length for 2 diferent masonry elements’ is closed to new replies.