[Resolved] Hook after archive header / Wrapper for archive posts

Home Forums Support [Resolved] Hook after archive header / Wrapper for archive posts

Home Forums Support Hook after archive header / Wrapper for archive posts

Viewing 15 posts - 1 through 15 (of 16 total)
  • Author
    Posts
  • #1008032
    Rafał

    Hi!
    I need to wrap up set of articles, but not the archive header.
    How to insert my stuff here?
    Hook after archive header

    I’m going to use the solution for search results as well.

    #1008038
    Leo
    Staff
    Customer Support

    Hi there,

    Add this PHP snippet to re-hook the archive title first:

    add_action( 'after_setup_theme', function() {
        remove_action( 'generate_archive_title', 'generate_archive_title' );
        add_action( 'generate_before_main_content', 'generate_archive_title', 3 );
    } );

    Adding PHP: https://docs.generatepress.com/article/adding-php/

    Then this should work:
    https://www.screencast.com/t/T2Egcbs8g0g

    Let me know 🙂

    #1008045
    Rafał

    Tricky, but works – for div wrapper tag. Thank you, Leo!

    If used hooks generate_before_main_content & generate_after_main_content
    Looks like that:

    <div class="generate-columns-container">
      <div id="my-insert">
        <!-- articles -->
      </div><!-- .generate-columns-container -->
    </div><!-- #my-insert -->
    #1008048
    Leo
    Staff
    Customer Support

    No problem 🙂

    #1008100
    Rafał

    Not good enough…
    It’s about columns enabled. How to achieve correct order – before GP columns (inside columns-container)?

    <div id="my-insert">
      <div class="generate-columns-container">
        <!-- articles -->
      </div><!-- .generate-columns-container -->
    </div><!-- #my-insert -->
    #1008245
    Tom
    Lead Developer
    Lead Developer

    For your opening wrapper, does adding a lower priority work? For example, if you add 1?

    #1008358
    Rafał

    Can’t wrap the articles directly (adjacently), no matter the priority is.
    I figured out another solution for my needs.
    Thank you Guys for your efforts.

    #1008767
    Tom
    Lead Developer
    Lead Developer

    No problem 🙂

    #1502724
    Fabien

    Are you considering creating this hook ? It would be really useful !

    #1503808
    Tom
    Lead Developer
    Lead Developer

    Hi there,

    What exactly are you trying to do? The columns container is hooked in, so it’s possible to hook elements around it if the priority is correct.

    #1503907
    Fabien

    Hook content after the page-header (title / description) in an archive page…

    #1504315
    David
    Staff
    Customer Support

    You can use the generate_archive_title hook. If you’re using a Hook element – you will need to select the Custom Hook to add that one.

    #1504598
    Fabien

    Thanks David.

    But if I use generate_archive_title, my content will be in the page-header (cf. html). Not really fan of that in term of HTML structure…

    #1504916
    David
    Staff
    Customer Support

    the generate_archive_title is the Hook that the page-header is hooked into.
    Using that hook for your own content should place it outside of the page-header container.

    #1508522
    Fabien

    Yes, it’s outside the page-header but above in term of hierarchy. I want to hook between the page-header and my loop…

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