• hello there, I need your help.
    I’m beginner of PHP and WP, and Japanese.

    please look my link.
    my needs is very simple.
    I want to make product cards. (pic, name, id, price, cart)
    and use on “Toggle to use the global query context” with all archive template via category or tags.


    1) when I use 1 category for the Query loop, it works well.

    2) I want to make template of “All archive”,
    I set “Toggle to use the global query context”,
    then it doesn’t work.
    Empty cards are published.

    what is wrong of this query?
    Which should I fix?
    php file and additional codes?
    or some settings?

    Thank you for reading,
    I’m beginner, please give me easy advice.

    kind regards.
    nao19jpn

    The page I need help with: [log in to see the link]

Viewing 15 replies - 1 through 15 (of 23 total)
  • Plugin Support ying

    (@yingscarlett)

    Hi there,

    By “Toggle to use the global query context” do you mean the Inherit Query From Template option? It should work out of the box, no PHP would be needed.

    What is the theme are you using? Let me know!

    Thread Starter nao19jpn

    (@nao19jpn)

    Hello ying,

    Thank you for watching.

    > do you mean the Inherit Query From Template option? 
    YES, I want the swith turn ON.

    I have read and understood the system.
    so, you mean it must work, right?
    I think it too.

    My Theme is “Inkspot FSE” here
    https://gracethemes.com/themes/free-tattoo-artists-wordpress-theme/

    but tentatively, I changed to “Twenty-Twenty-Four”,
    It still doesn’t work…
    See my page (now TTF).
    https://www.stfreak.com/sv/?cat=7

    more info,
    I watching this video
    https://www.youtube.com/watch?v=ll2limO4V3M
    wp-skills(WordPress MetaBox Generator),
    Post Type Generator
    but PHP 8.0 says some error, so I fix the codes.


    What’s wrong on my wp?
    Are my post datas wrong?

    Thread Starter nao19jpn

    (@nao19jpn)

    I mean,
    it use only 1 template page,
    then I want to show per category pages and per tag pages when customer click the category/tag link.

    Is this difficult?

    kind regards,
    Nao

    Plugin Support David

    (@diggeddy)

    Hi there,

    the Inherit Query from Template option will work only if that Query Loop is added to the index or specific archive template ( eg. category ). Can you confirm that is the case ?

    Thread Starter nao19jpn

    (@nao19jpn)

    hi there,
    Thank you for replying.

    so, You mean that
    GenerateBlocks’s query cannot use with all-archive-template?
    (in normaly inherit query,what if I click the category A, then all-archive-template makes page A. if Click tag 1 then page tag1.)

    Should I make many templates??
    Category-A template (make A query)
    Category-B template (make B query)
    Category-C template (make C query)
    . . .
    Tag-1 template (make 1 query)
    Tag-2 template (make 2 query)
    Tag-3 template (make 3 query)
    . . . ?

    it is not smart.
    Sorry, I’m not professional of Programing.

    Plugin Support ying

    (@yingscarlett)

    What David meant was the all archive template. Is the query loop inside the all archive template like this?

    https://app.screencast.com/2GXqD9g0JeXmj

    Thread Starter nao19jpn

    (@nao19jpn)

    yes,
    I want to use as same as normal action.
    When I click the any category/tag, then “ALL Archives template” makes that page.

    but this query is not realized.
    Does this plugin not act like that?

    in this case, Ring’s cards are published.
    but when I click the “Pendant”, it doesn’t show anything at 2nd query ares.

    Plugin Support David

    (@diggeddy)

    See here:

    https://app.screencast.com/5lQpdf82OZJ94

    That is the Twenty24 theme i am using.
    And i edited the All archives template
    And set the GB Query Loop to Inherit query from template

    And this worked on all archives.

    Thread Starter nao19jpn

    (@nao19jpn)

    hi David,
    I tried some patterns, but it doesn’t work.

    I changed “Perma link”, please see this
    https://www.stfreak.com/sv/category/strange_freak/products/ring2/

    and please click “PENDANT2” on right side menu.
    Archive-Title can change. but card is not published. why?

    Plugin Support David

    (@diggeddy)

    Unfortunately we cannot debug that issue.
    I tested our plugin on Twenty24 and it works as expected.
    But you’re using a 3rd party theme that isn’t availing from WP.org and it has a custom facet search.

    Try using the core Query Loop block to see if that works.

    Thread Starter nao19jpn

    (@nao19jpn)

    I tried 24 too, but it doesn’t work.
    https://www.stfreak.com/sv/category/strange_freak/products/ring2/
    https://www.stfreak.com/sv/category/strange_freak/products/pendant2/

    ok, Final asking.
    when you try 24, and you click another category B,
    then, is category B only published?
    (If all posts published, it is not I want.)

    Thanks a lot.
    Nao

    Plugin Support David

    (@diggeddy)

    Referring to my reply here:

    https://ww.wp.xz.cn/support/topic/why-toggle-to-use-the-global-query-context-doesnt-work/#post-17369873

    The All Archive applies to all my archives including the post categories, post tags, authors etc.

    If i view the archive for Category B i see any posts that are in Category B

    I f i view my author archive , i see only the posts i have written.

    Etc.

    That is the expected behaviour.

    Thread Starter nao19jpn

    (@nao19jpn)

    hi David,
    Thank you fro your help. I believe you.

    I’m keeping to resolve this problem.
    now I got something.

    wp-content\plugins\generateblocks\includes\blocks\class-query-loop.php

    line: 182
    $tax[‘terms’] probably NULL, I don’t know why.

    so I change to it below,
    ‘terms’    => $_GET [‘cat’] ?? $_GET [‘tag’],

    then it looks little bit good,
    ‘terms’ can receive cat-number or tag-text.

    it can show per category.
    https://www.stfreak.com/sv/?cat=236
    but, next page doesn’t view (it has 9posts).
    and TAG doesn’t work either …

    What do you think? do you know something?

    kind regards,

    Plugin Support David

    (@diggeddy)

    Are you modifying the plugins code ?
    As this is not our code and the refeferenced file: class-query-loop.php is a max 78 lines long.

    Thread Starter nao19jpn

    (@nao19jpn)

    hi David,

    Sorry, my miswritten. Directly was wrong. There are same file-name.

    Correct directly is
    wp-content\plugins\generateblocks\includes\class-query-loop.php

    I didn’t modifying other codes. (just only // comment )
    I only changed the line:182 below,
    ‘terms’ => $_GET [‘cat’] ?? $_GET [‘tag’], //ex. ‘terms’ =>$tax[‘terms’]

    $tax[‘terms’] probably NULL, I don’t know why.


    Thank you for caring about me, David.
    I really need this plugin.

    Nao

Viewing 15 replies - 1 through 15 (of 23 total)

The topic ‘Why “Toggle to use the global query context” doesn’t work?’ is closed to new replies.