0

I have two taxonomies on my site: portfolio works and blog posts. I want blog posts under /blog and I want portfolio items under /work. I have created a page for blog posts and a page for portfolio works. "/blog" and "/work" are the URLs. This is because we want total control over these top-level pages and don't want to leave these to archive pages. This is all to deal with Google problems so we are trying to create a more clear site structure with specific content. We don't want to rely on archive pages

When I update my permalink structure to /blog/%postname%/ it works great except puts /blog in front the portfolio item's URL.

Q: How can I have this ONLY apply to blog posts and no other taxonomies? or Q: How can I specify a custom page to be the parent of each taxonomy? That's the real behavior I'm trying to get.

Info: Using completely up to date stand alone WordPress and the commercial theme "Brooklyn".

Note that The theme allows me to specify a "slug" as they call it for the custom taxonomy "portfolio" items, but then it replaces the /work page with an archive page by the same name. I am looking for a workaround either with a plugin or getting into some PHP is fine by me also.

Thank you everyone.

Edit, here are a bunch of links to things.

https://jugteam.com/blog/ https://jugteam.com/do-links-in-my-youtube-descriptions-provide-backlinks-and-seo-benefits/

https://jugteam.com/work/ https://jugteam.com/work/create-product-microsite/

(I don't know what a 'term index' is and google wasn't helpful)

1 Answer 1

0

This worked for me (tested):

add_action( 'init', static function () {
    register_taxonomy( 'portfolio-work', 'post', array(
        'hierarchical' => true,
        'labels'       => array(
            'name'          => 'Portfolio Works',
            'singular_name' => 'Portfolio Work',
        ),
        'rewrite'      => array(
            'slug'       => 'work',
            'with_front' => false,
        ),
    ) );
} );

Then created new pages titled "Blog" (slug: blog) and "Work" (slug: work), and was able to access the pages and taxonomy pages:

  • Permalinks: /blog/%postname%/
  • Page "Blog":
    http://wpse417869.local/blog/
  • Post "Hello world!":
    http://wpse417869.local/blog/hello-world/
  • Page "Work" (taxonomy index):
    http://wpse417869.local/work/
  • Term "Portfolio Work A" in "Portfolio Work" taxonomy (term index):
    http://wpse417869.local/work/portfolio-work-a/
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.