Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #437478

    Hello guys,

    i have a problem with the content displayed in the post excerpts in my blog.

    As we wanted to display around 15 lines of text in the excerpts, I used the more tag and the following piece of code found in the forum:

    add_filter( 'post-format-standard', 'avia_category_content_filter', 15, 1);
    function avia_category_content_filter($current_post)
    {
    if(!is_single())
    {
    	global $more;
    	$more = 0;
    	$current_post['content'] =  get_the_content(__('Read more','avia_framework').'<span class="more-link-arrow">  &rarr;</span>');
    }
    return $current_post;
    }

    It worked well. Too well. Indeed, the excerpt displays too much content. My post is organised like this:
    – picture (in a avia media element)
    – title (in a special heading element)
    – text (in a text block).

    Here is a printscreen of the excerpt, you will see that it displays the picture (a kind of header), the title (which is already in the post title above), and the text block.

    https://www.dropbox.com/s/s2sekolt6imjg3s/Excerpts_with-function.jpg?dl=0

    Is it possible to only display text from the text block in the excerpt ? So I do not have redundant pictures and titles.
    And eventually to have plain text ?

    Thanks a lot for your help.

    #437953

    Hey Magellan!

    Thank you for using Enfold.

    You don’t need to add the code above if you use the more tag inside the post. The code will render the more tag useless because it will fetch the entire post content instead.

    Best regards,
    Ismael

    #440923

    Hi Ismael,

    I did not use the code finally as it was displaying unwanted elements (such as a picture and the heading) in the excerpt.
    But the thing is that the MORE tag is not working anyway.

    Here is my setup:

    – more tag positionned in my posts
    – blog post element set up on Excerpt with read more link in Blog content length.

    it does not do anything. I still have the usual 4 lines showing in the excerpt.
    I have been also been trying with “excerpt” as the setting the Blog Content Length. Same thing.

    I send you the link to the blog in the following message.

    thanks for your precious help.

    thomas

    #440924
    This reply has been marked as private.
    #441874

    Hey!

    What do you mean by ” I still have the usual 4 lines showing in the excerpt.
    I have been also been trying with “excerpt” as “? So,, do you want to modify the excerpt length? Try to use this plugin: https://wordpress.org/plugins/advanced-excerpt/

    Or just add this in the functions.php file to control the excerpt length:

    function custom_excerpt_length( $length ) {
    	return 10;
    }
    add_filter( 'excerpt_length', 'custom_excerpt_length', 999 );

    Regards,
    Ismael

    #452437

    Hi Ismael,

    sorry for late reply.

    Works good for me.

    To beginners like me: once the code pasted into the functions.php file, change the value in the expression “return 10” to customize the amount of text displayed.

    thanks again for your precious help, you rock.

Viewing 6 posts - 1 through 6 (of 6 total)
  • The topic ‘Excerpts filter function’ is closed to new replies.