Site logo

[Resolved] How to display the excerpt in a blog post without showing “Read More” button?

Home Forums Support [Resolved] How to display the excerpt in a blog post without showing “Read More” button?

Home Forums Support How to display the excerpt in a blog post without showing “Read More” button?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1729364
    Dominic

    Hi,

    I used this code to add the “read-more” button to the blog post feed on my homepage and this example to add the excerpt above the featured image in my blog posts.

    The problem is that the “read more” button also displays in the blog post. How can i keep the “read more” button in the homepage, but remove it in the actual blog posts?

    Thanks very much,

    Dom

    #1729588
    David
    Staff
    Customer Support

    Hi there,

    can you share a link to a post so we can see what the issue is

    #1729597
    Dominic

    Hi David,

    I’m working locally just now, so can’t send a link i’m afraid, but here is a pic of the home screen with the “read more” button.
    Read More Button on Homepage

    And here’s an image of a log post which also has the “read more” button after i used the code i linked to above to add the excerpt after the meta data.
    Read More button in blog post

    I assume it’s some sort of conflict between the 2 pieces of code i used.

    Thanks,

    Dom

    #1729689
    David
    Staff
    Customer Support

    Are you displaying the excerpt on the single post ?

    #1729694
    Dominic

    Yes

    #1729946
    David
    Staff
    Customer Support

    In the code you used to display the read more button – this line:

    if ( has_excerpt() ) {

    Change to:

    if ( has_excerpt() && !is_single() ) {

    This should remove the button from the single post.

    #1730072
    Dominic

    Thanks David,

    That worked a treat, you’re a star!

    Much appreciated,

    Dom

    #1730291
    David
    Staff
    Customer Support

    Glad to hear that!

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.