Site logo

[Resolved] Issue with Query Loop block on the front-end

Home Forums Support [Resolved] Issue with Query Loop block on the front-end

Home Forums Support Issue with Query Loop block on the front-end

Viewing 15 posts - 1 through 15 (of 22 total)
  • Author
    Posts
  • #2476154
    Yerai

    Hello!

    I’m currently using Generateblocks Query Loop block for link to posts or pages. It works nice in the site overall, but in custom category pages.

    Category pages are built with wordpress pages, replacing the category page with a custom page with the same slug using a function that loads page template instead of category’s.

    Problem is the query loop grid breaks only in those category pages. In the backend everything seems fine, but in the frontend the structure changes.

    Backend:

    Frontend:

    Is there a way to fix that?

    Thank you in advance!

    #2476322
    Fernando
    Customer Support

    Hi Yerai,

    If you’re planning to override the default WordPress Archive pages with a Query Loop Block, you can use a Block Element – Loop Template.

    Reference: https://docs.generateblocks.com/article/query-loop-overview/

    If you prefer using a static page, can you provide the link where we can see the issue?

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

    #2478837
    Yerai

    Apologies for answering this late, these last days have been crazy for me.

    Yeah, we are using static pages. I’ll provide the url and credentials in the private info section.

    Thank you in advance!

    #2480080
    Fernando
    Customer Support

    Happy New Year, Yerai!

    This is odd. Can you also provide admin login credentials as well so we can take a closer look at your setup?

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

    #2481237
    Yerai

    Here you have!

    Thank you in advance.

    #2481320
    Fernando
    Customer Support

    Thank you. It seems some CSS is not loading.

    As a first course of debugging, what we would recommend is to do #1 here: https://docs.generatepress.com/article/debugging-tips/

    Can you try that and let us know how it goes?

    It would be good to take a backup of your site before doing so.

    #2481778
    Yerai

    I did all steps there, as the first one didn’t have any effect.

    The debug.log file didn’t generate, and I didn’t saw any error in the dashboard.

    After that, I installed the query count plugin for debugging, I didn’t see anything relevant.

    So I moved to the next step.

    After switching to TwentySeventeen theme, the issue fixed. And after switching back to GeneratePress, the page loaded correctly. A while after it showed up the issue again.

    And finally, there is are no errors in the error_log file.

    So I guess there is a weird issue that happens with GeneratePress, because GenerateBlocks loaded fine in the TwentySeventeen theme, but maybe I’m mistaken.

    Thank you in advance.

    #2482396
    David
    Staff
    Customer Support

    Hi there,

    what function are you using to swap the category archive to a static page ?

    #2482451
    Yerai

    Hi David,

    We are using this function:

    function loadPageFirst() {
    // get the actual category
    $actualCategory = get_category( get_query_var(‘cat’) );
    // get the page with the same slug
    $matchingPage = get_page_by_path( $actualCategory->slug );

    // If no match, load the normal archive template and exit
    if (!$matchingPage) {
    include( get_template_directory() . ‘/archive.php’);
    die();
    }

    // Make a new query with the page’s ID and load the page template
    query_posts( ‘page_id=’ . $matchingPage->ID );
    include( get_template_directory() . ‘/page.php’);
    die();
    }
    add_filter( ‘category_template’, ‘loadPageFirst’ );

    #2483159
    David
    Staff
    Customer Support

    Are all Category pages to be replaces with a Static Page ? As i wonder if this method would work better:

    https://docs.wpshowposts.com/article/use-static-pages-as-category-archives/

    #2483276
    Yerai

    Yes, all category pages are replaced by a static page. The method you provided works very well. There is no issue now! 🙂

    Thank you David!

    #2483599
    David
    Staff
    Customer Support

    Awesome – glad to hear that!!

    #2491658
    Yerai

    Hello again!

    I’ve found an issue with the code of WPShowPosts.

    In my site there is no more custom code than that one, but for some reason, posts pages are being replaced by the category page, as you can see here:

    Category page:

    Post page:

    Curious thing is post’s urls are untouched, which seems weird.

    Is there a way to fix this?

    #2491857
    Ying
    Staff
    Customer Support

    Go to settings > permalinks, set . as the Category base.

    Let me know if this works.

    #2491880
    Yerai

    Sadly, it doesn’t work 🙁

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