Site logo

[Resolved] How To Create Custom Archive Layouts.

Home Forums Support [Resolved] How To Create Custom Archive Layouts.

Home Forums Support How To Create Custom Archive Layouts.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #2505835
    Benjamin

    Hello,

    I created a custom query loop for my posts using GP Blocks Pro, and GP Pro Elements and then set it to display on all archives.

    I hoped it would replace the current archive layout, but it didn’t. (As in the category and tag page layout).

    How can I achieve this? Do I need to disable elements somewhere? I looked but couldn’t find anything to disable.

    (PS. I’m not really sure where to ask for support regarding GP Blocks Pro styling, etc., I see there is a support section on the site, but asked a few hours ago and haven’t gotten a reply, do I ask here or what?).

    Thank you.

    #2505854
    David
    Staff
    Customer Support

    Hi there,

    the Block Element you used, can you make sure it has the Element Type set to Loop Template

    And in the Query Loop Parameters enabled the Inherit Query from Template

    Here is fine to ask as it is theme related. And its not a problem asking GB support questions here either. If that helps

    #2506693
    Benjamin

    Hi David…

    Thanks, that did something. Just not the right thing. XD.

    I have the location set to all archives in the elements menu. When following your steps, it just removes all the posts from the archive page (in their normal form that they were in previously) and displays a blank page with just the header and footer… What am I missing here?

    I tried removing the sidebar, thought that might have something to do with it, but didn’t work either.

    Let me know.

    Thanks.

    #2506700
    Fernando
    Customer Support

    Hi Benjamin,

    So we can take a closer look at your setup, can you provide admin login credentials?

    Please use the Private Information field for this: https://docs.generatepress.com/article/using-the-premium-support-forum/#private-information

    #2506712
    Benjamin

    I watched this video and was able to add a title, https://www.youtube.com/watch?v=L1KtrKJIFzk, messed around with the query loop a bit (really not sure what I changed, basically just switched the inherit query from template on and off).

    Anyway, now it’s displaying posts. I want to know if is there a way to change the number of posts that are being displayed? If I turn the query loop off, you can change it, but if it’s on, I don’t see a clear way to change the number of posts on a page.

    PS. How can I add pagination?

    Thanks.

    #2506717
    Fernando
    Customer Support

    I see. You can change the Posts per page through Settings > Reading > Blog pages show at most.

    For the GB Query Loop Block, you can add pagination through the toolbar. Example: https://share.getcloudapp.com/E0uZDO4E

    #2506747
    Benjamin

    Thank you, everything is working now.

    Last thing, I want to know, for the search results page, if I create a custom version for that, what dynamic data would I have to use on the headline block to get something similar to what GP does by standard?

    E.g. If I search GP support in my search bar it will give back: Search Results For: GP Support, how can I achieve this?

    Thank you!

    #2506751
    Fernando
    Customer Support

    You’ll need a custom code for that.

    Can you take a screenshot of the Dynamic settings of your Headline Block for the title?

    #2506755
    Benjamin

    Screenshots links are attached in sensitive info section.

    Thanks.

    #2506758
    Fernando
    Customer Support

    Thank you.

    Add search-title-change to the class list of that Headline Block.

    Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

    Then, add this snippet:

    add_filter( 'generate_dynamic_element_text', function( $text, $block ) {
        if ( !is_admin() && is_search() && ! empty( $block['attrs']['className'] ) && 'search-title-change' === $block['attrs']['className'] ) {
            $text = 'Search Results For: ' . get_search_query();
        }
    
        return $text;
    }, 10, 2 );

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

    #2506868
    Benjamin

    Thank you! You’ve been of great help.

    #2508066
    Fernando
    Customer Support

    You’re welcome, Benjamin!

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