• dds

    (@dixonds)


    When I have the Categories block in a pattern, and put the pattern in a post, it displays the CategoryName of the post. When viewing the post, if I click on the CategoryName, it displays an All Archives page of only this one category, with all the others filtered away. This is the normal, correct behavior of the Categories block.

    For stylish aesthetic reasons, I would like to have an image link to do the same thing. In other words, I want the image to act like a button to list all posts from a single category, just like clicking on the Categories Block itself.

    To try to duplicate the behavior, I clicked the CategoryName and copied the URL https://subdomain.rootdomain.com/index.php/category/CategoryName/ from the address bar, pasted it into the image link, and replaced the string ‘CategoryName’ with the string ‘%category%’, like this: https://subdomain.rootdomain.com/index.php/category/%category%/

    But when I click on the image expecting the same result as clicking on the CategoryName, it returns a 403 error, saying I haven’t the right to open that page. What is the syntax for that image link, to make it generate the correct URL?

    Thanks.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • threadi

    (@threadi)

    I am afraid that what you are looking for is not (currently) possible with the Block Editor. You are welcome to submit your request to the Gutenberg developers: https://github.com/WordPress/gutenberg/issues – I have just looked there and found nothing that fits, but I may have overlooked it.

    A possible solution might be a plugin that extends the editor. With Gutenblocks you can probably use “dynamic data”, maybe that’s what you’re looking for: https://generateblocks.com/generateblocks-1-5-dynamic-data-query-loops-image-blocks/

    Thread Starter dds

    (@dixonds)

    Thanks, threadi. I looked at the documentation for the GenerateBlocks plugin, and it appears like you still need to know the URL syntax for their image block, like in the WordPress core image block. I couldn’t find anything in the GitHub WordPress issues page either.

    But it sure seems to me that, if the Categories block generates the correct URL, all we’d need to do is look up the code for the category block, and there it would be. It does not show up in the Code Editor though, so whoever wrote the Category Block could know the code, and a WordPress expert should know who that was, it seems to me, though I am living proof I don’t know much.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘link to category archives’ is closed to new replies.