[Resolved] Is there a way I can call an Element ‘after-featured-image’ ?

Home Forums Support Is there a way I can call an Element ‘after-featured-image’ ?

  • This topic has 7 replies, 2 voices, and was last updated 5 months ago by Elvin.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1463020
    Anne

    Basically i want a disclosure at the top of the ‘article content’ , but below the title, meta info, and featured image – But I’m not seeing the option. Is there a way to make a custom hook for this?

    I added it to each post manually but I want to remove that and just have it added automatically via Element here:
    https://prnt.sc/upo1zv

    Thanks

    #1463026
    Elvin
    Staff
    Customer Support

    Hi,

    You can use generate_after_entry_header hook.

    I think you’ll appreciate having this. https://docs.generatepress.com/article/hooks-visual-guide/

    It’s basically a map of hooks. πŸ™‚

    You can create your disclosure block using the Block Element and hook it to generate_after_entry_header. πŸ˜€

    A wise man once said:
    "Have you cleared your cache?"

    #1463038
    Anne

    See, I was 95% sure it was going to be generate_after_entry_header but, it did not show up there. I just tried it again and it puts it below the tags i added at the top: https://prnt.sc/upobcg

    I’m wondering if it has something to do with the php snippet i added for adding the tags below the author:

    add_filter( 'generate_header_entry_meta_items', function( $items ) {
        if ( is_single() ) {
            $items = array(
                'author',
                'tags',
            );
        } return $items;
    } );
    #1463063
    Elvin
    Staff
    Customer Support

    Adding PHP snippets shouldn’t affect Block Elements.

    Can you check again? It should be on the “Hooks” dropdown. You can also type it in.

    Here’s where you can find it.
    https://share.getcloudapp.com/kpuwkLBq

    You can leave the site details on the Private Information text area if you need help in checking things.

    A wise man once said:
    "Have you cleared your cache?"

    #1463071
    Anne

    I have the right hook selected already:
    https://prnt.sc/uporm6

    I’ve created some login details for you below. Btw when you login, remember i have added a disclosure manually to every post. That’s in the correct position, but the hook is not.

    #1463107
    Elvin
    Staff
    Customer Support

    Oh I forgot to mention its correlation to Featured Image display location settings for posts on Appearance > Customize > Layout > Blog. My bad.

    When the Location setting for Featured Image is set to “Below title”, the featured image is placed after the entry header as opposed “Above title” where the featured image is placed inside the entry header.

    You pretty much have both the featured image and the block header hooked to generate_after_entry_header.

    Knowing this, we set the Priority for our Block Element to a value higher than 10 (10 being the priority set to featured image) so it appears after the featured image.
    https://share.getcloudapp.com/8Lur47we

    A wise man once said:
    "Have you cleared your cache?"

    #1463138
    Anne

    ah ha! priority 11 worked.

    Solved thank you!

    #1463143
    Elvin
    Staff
    Customer Support

    Nice one.

    No problem.:)

    A wise man once said:
    "Have you cleared your cache?"

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