[Resolved] How can I add featured image at custom location

Home Forums Support [Resolved] How can I add featured image at custom location

Home Forums Support How can I add featured image at custom location

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #1404648
    Vishvendra

    On this blog post I needed to add featured image after the first paragraph the italic one.

    Also, I want the top separator line after author name to be inserted by default. So I don’t need to add it every time I create blog post.

    I tried to do it with elements but was unable to do it. Please don’t ask how I tried to do it. πŸ˜‹ I just tried.

    So, what’s the correct way. How Can I achieve it.

    Thanks

    #1404882
    David
    Staff
    Customer Support

    Hi there,

    the simplest method would be to add that text to the Excerpt field in the post editor. This will also be displayed in the Archive post excerpt.

    Then create a hook
    Add this content:

    <?php if ( has_excerpt() ) : // Only show custom excerpts not autoexcerpts ?>
        <p class="entry-subtitle"><?php echo get_the_excerpt(); ?></p>
    <?php endif; ?>

    Select after_entry_header hook
    Check Execute PHP
    Set Display Rules to Posts > All Posts

    Then in Customizer > Layout > Blog –> Featured Images >>> Set its location to Below Title.

    #1404910
    Vishvendra

    Thanks, I will try that now and let you know how well things went.

    Thanks again. πŸ™πŸ»

    #1404984
    David
    Staff
    Customer Support

    You’re welcome

    #1407650
    Vishvendra

    okay, I tried to create the hook with the code you’ve provided.

    (1) I didn’t find the Execute PHP option.
    (2) there generate_after_entry_header hook was present not after_entry_header.
    (3) Want to show read more link text on the archive but custom excerpt doesn’t let it.

    Edit:

    The option came. However, blog post looks likes this https://mouthpost.com/pradhan-mantri-garib-kalyan-yojana/

    no space between meta text and title. Plus text doesn’t coming up in italic fonts. I also want to add separator after the meta text.

    Thanks πŸ™‚

    #1407685
    David
    Staff
    Customer Support

    Try adding this CSS:

    .entry-subtitle {
        font-style: italic;
        margin-top: 1em;
        padding-top: 1em;
        border-top: 1px solid #eee;
    }
    #1408623
    Vishvendra

    Thanks, it worked. But how to bring back read more link at the archive page. As custom excerpt overwriting it.

    #1408721
    Leo
    Staff
    Customer Support

    I believe this is what you are after:
    https://docs.generatepress.com/article/activating-read-custom-excerpt/

    If not please open a new topic as the original topic is resolved.

    Thanks!

    #1410301
    Vishvendra

    Thank you Leo and David for the awesome support. All issue resolved. Will bug in the future. πŸ˜€

    #1410342
    Leo
    Staff
    Customer Support

    No problem πŸ™‚

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