Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #518491

    Hi,

    I had my blog set to single author small thumbnail featured image with ‘excerpt and read more’ link set in blog element.
    Previously some issue were going on which are mentioned and sorted on this thread https://kriesi.at/support/topic/blog-categories-6/page/2/#post-517830

    Now the excerpt and read more link is required on my blog page (it was there before but after all the extra codes entered in functions.php, it disappeared). I am setting it in blog element setting but it is not working.
    http://xandrianoir.com/blog-and-reviews/ Please have a look.

    Regards,
    XN

    #519093

    Hi xandria!

    Thank you for using Enfold.

    Did you try the more tag or the excerpt box as suggested on the previous thread? The read more link will appear once you set the excerpt. Or you can try this plugin: https://wordpress.org/plugins/advanced-excerpt/

    Cheers!
    Ismael

    #520356

    Hi,
    Can you please tell me where I can find more tag and excerpt box?

    Regards,
    XN

    #520552

    Hi,

    More tag:

    <!--more-->
    

    You can see the excerpt field by going to screen options in the top right hand corner of the edit screen and select to show it there.

    http://www.wpbeginner.com/beginners-guide/how-to-properly-use-the-more-tag-in-wordpress/

    Regards,
    Rikard

    #520677

    Hi. My issue may be a bit different, however the title of this post is perfect, so I figured not to start a new thread. I’ve just recently purchased Enfold after long and careful consideration. I am a control freak and I like elegant solutions. To meet my own desires for things to he handled nicely I’ve used my-hacks.php when I first made my website. From that you can already tell it was a looooong time ago :)

    To the point: I am now upgrading to Enfold theme and I love how it is constructed, however I knew there would be some things I’d like to change. Note here that I don’t consider myself a programmer, but I am clever enough to understand and write some code. What I have is redundancy. On my website I have crafted the posts in such a way that after the first two sentences there’s a <!–more–> tag, but no excerpt – because I didn’t need it. Why would I put the same sentences in the post and in the excerpt. See my point?

    All of that is good, however now when I’m building a site using your Advanced Editor and adding a Blog Posts element to it with “Define Blog Grid layout” option set to “Title and Excerpt” the sentences get trimmed, because there is no real excerpt in the posts to be shown, so the default behavior of trimming the text kicks in.

    After this long description this is my question: how can I change that behavior, so that the Blog Posts element shows the content of the post up to the <!–more–> tag when listing the posts?

    I understand that modding the template is not part of the support, but any pointers and hints would be appreciated, not to mention adding this functionality to the Blog Posts element itself. I bet I’m not the only one who did this.

    Thank you.

    #520848

    Ok. So I have solved the problem described above. This is what I’ve done. Maybe it will be useful to others as well.

    // function called by a filter by reference. 
    // needs no return statement. changes WP_Post object.
    function _jdutils_inject_excerpt($post)
    {
    	// extract the text before the <!--more--> tag to be treated as excerpt
    	$post->post_excerpt = preg_split( '/<!--more(.*?)?-->/', $post->post_content )[0]; 
    }
    add_filter('the_post', '_jdutils_inject_excerpt');

    This code is in my_own_functions.php in the enfold-child folder, and it is declared by require_once statement in the functions.php of the child theme. Could someone double check if this is the best possible way to do this please? When I list posts using a “Blog Posts” element, or simply by listing posts in category, some posts break the template causing elements to shift and not display correctly. I tried to pinpoint where the problem might be in those specific posts but found nothing. Thank you.

    #520855

    Hi!

    Glad you figured it out and thank you for sharing your solution! :)

    Best regards,
    Yigit

Viewing 7 posts - 1 through 7 (of 7 total)
  • The topic ‘Excerpt and Read More Link’ is closed to new replies.