[Support request] Hook suggestions: after tags/before post nav & between post content & comments

Home Forums Support [Support request] Hook suggestions: after tags/before post nav & between post content & comments

Home Forums Support Hook suggestions: after tags/before post nav & between post content & comments

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #353461
    Thomas

    Hi there,

    I’d like to suggest two new hooks:

    1) in the footer after “tags-links” and “nav-previous”
    2) between the post content and the comment section (not just after the post content but still inside the article – you can’t add a custom or no background color otherwise; e.g. for ad banner)

    Cheers,
    Thomas

    #353559
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    1. These elements are hooked into the generate_after_entry_content hook. So you can insert elements after it by using that same hook with a higher priority, or the generate_after_content hook.

    2. The generate_after_content hook should also achieve this I believe?

    Let me know ๐Ÿ™‚

    #353569
    Thomas

    Hi,

    1) Unfortunately, priority 10 is above “cat-links”, 11 below “nav-below”. And the after the content hook ist below both…
    2) It’s still inside “inside-article”, you can’t style it as individual “block” after the content section and before the comment area therefore. This is an ideal/dedicated location for adding stuff like ad banners…

    Cheers,
    Thomas

    #354129
    Tom
    Lead Developer
    Lead Developer

    1. So are you trying to insert something in between cat-links and nav-below?

    2. Ah, so you’re looking for a hook here?: https://github.com/tomusborne/generatepress/blob/master/single.php#L19

    #354206
    Thomas

    H,

    1) Exactly, maybe too much of an edge case though.
    2) Yes, that would be great.

    Cheers,
    Thomas

    #354425
    Tom
    Lead Developer
    Lead Developer

    1. You could unhook the current functions, and then hook your own function in:

    add_action( 'after_setup_theme', 'tu_remove_footer_meta' );
    function tu_remove_footer_meta() {
        remove_action( 'generate_after_entry_content', 'generate_footer_meta' );
    }
    
    add_action( 'generate_after_entry_content', 'tu_custom_footer_meta' );
    function tu_custom_footer_meta() {
        if ( 'post' == get_post_type() ) : ?>
            <footer class="entry-meta">
                <?php generate_entry_meta(); ?>
    
                Your custom hook or content in here.
    
                <?php if ( is_single() ) generate_content_nav( 'nav-below' ); ?>
            </footer><!-- .entry-meta -->
        <?php endif;
    }

    2. Thanks for the suggestion – I’ll see what I can do! ๐Ÿ™‚

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