Site logo

[Resolved] Add excerpt after headline?

Home Forums Support [Resolved] Add excerpt after headline?

Home Forums Support Add excerpt after headline?

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #2454199
    Edin

    I’m trying to add the excerpt after a posts h1 title.

    I used this in the hook “generate_after-entre-title”:

    <div class="excerpt-style"><?php the_excerpt(); ?></div>

    It works, but the problem is that it adds the “read more” button at the bottom automatically.

    I tried to remove it with the following:

    .read-more-button-container {display:none;}

    But then ALL the “read more” buttons on the site are removed. I want to keep them on the blog articles list page at least.

    What’s the best way to do this?

    Thanks in advance,
    Edin

    #2454333
    David
    Staff
    Customer Support

    Hi there,

    instead of :

    <?php the_excerpt(); ?>

    try:

    <?php echo get_the_excerpt(); ?>

    #2454335
    Edin

    Hi David,

    Thank you, but, unfortunately, that didn’t work.

    #2454417
    Edin

    Sorry, wrong thread.

    #2454450
    David
    Staff
    Customer Support

    Are you trying to display the manual excerpt ?

    #2454475
    Edin

    Yes, I’m trying to add the excerpt I manually write (in the box below the article editor).

    #2454543
    David
    Staff
    Customer Support

    in your hook add:

    if ( has_excerpt() ) {
         ?>
         <span class="entry-subtitle"><?php echo get_the_excerpt(); ?></span>
         <?php
    }

    by default the manual excerpt should not show a read more. If it still is, can you leave the code as is and share a link to a post where i can see the issue ?

    #2454840
    Edin

    I added the code, but the read-more button is still there. (see “Private information” for URL and access)

    #2455040
    Ying
    Staff
    Customer Support

    Hi Edin,

    Can you check if you have this function added?
    https://docs.generatepress.com/article/activating-read-custom-excerpt/#read-more-button

    #2455649
    Edin

    Thank you, Ying. That was indeed the issue.

    Thanks,
    Edin

    #2456429
    Ying
    Staff
    Customer Support

    You are welcome   🙂

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