Black Friday Sale! Get $20 off GP Premium, $40 off our new Lifetime license, and 45% off license renewals/extensions! Learn more

[Support request] Archive in a page

Home Forums Support Archive in a page

  • This topic has 7 replies, 2 voices, and was last updated 3 years ago by Tom.
Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #418266
    Alberto

    Hello!
    I want to achieve something like this: https://wireframe.cc/Mg6Ifw
    I’m testing with GP 1.5 (looks so great!) and I’m working with WP Show Posts PRO. I’ve got my own custom post types and I’m wondering what’s the best approach to achieve my goal. Maybe using WP Show Post in a custom widget area?, maybe creating my own page template and using the WP loop?, maybe working in the archive template php code?

    How can I get the ‘red section’ into the page and how can I use a filter to display the posts in the category selected?

    I’ll appreciate so much your help!

    Thanks in advance!

    GP Premium 1.4.3
    #418633
    Tom
    Lead Developer
    Lead Developer

    Overwriting archive pages is never easy unfortunately. The best thing you can do is make the core posts work with your setup.

    Otherwise, you will need to create custom page templates for those archives, and build specific WPSP lists for each one: https://developer.wordpress.org/themes/basics/template-hierarchy/#category

    #418656
    Alberto

    Hi Tom.
    Thanks for replying!
    I’m afraid in this case I must create custom page templates for my archives because I’ve got more than one page and archive with this behavior.
    I’ll try and I’ll tell you.

    Thanks!

    #418699
    Alberto

    Mmmm… what if I add a page and in a section I add a WPSP shortcode?
    Is it possible?
    The only thing I must do is to customize the way you display each post in the archive because I need something like this: https://prnt.sc/h7xbi4
    Is this right?

    Although I would still have to resolve the question of the filter, both in your choice and in mine…..

    #419082
    Tom
    Lead Developer
    Lead Developer

    You could use regular pages with a WPSP shortcode, then simply 301 redirect the core WP archives page to the static page you created.

    #419272
    Alberto

    Hi Tom!
    Good point, I hadn’t thought of the redirection.
    However, I don’t think it will be necessary because the page is accessed through a menu item and I wouldn’t need to access the archive of that CPT.
    I’ll try and I’ll tell you.

    Thanks!

    #419330
    Alberto

    Mmmm… I’ll see what you mean. Doing in this way when I browse to foo.com/myregularpage what I get is the archive page.
    Please, could you tell me where I must place the wp_redirect code?

    I’m using this approach in my functions.php and it seems it works fine.

    function dom_archive_to_page() {
        if( is_post_type_archive( 'archive-slug' ) ) {
            wp_redirect( home_url( '/myregularpage/' ), 301 );
            exit();
        }
    }
    add_action( 'template_redirect', 'dom_archive_to_page' );
    

    Is this the best choice with GP?

    Thanks!

    #419917
    Tom
    Lead Developer
    Lead Developer

    Yep, that’s definitely one way to do it.

    There’s also plugins out there that give you a nice UI like the “Redirection” plugin.

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