• Resolved taote

    (@taote)


    Hi. I′m working on a site where I want to separate Portfolio and Blog, both made with WordPress. I created a page for Portfolio, where I just show the posts belonging to this category.

    Using permalinks, the url is https://www.domain.com/portfolio/. The problem is when there is a link, to the category ‘Portfolio’. In the permalinks I′ve set the value /%category%/%postname%/, but for links to category ‘Portfolio’ the url is https://www.domain.com/category/portfolio/ (for example, using the plugin Breadcrumb NavXT)

    So I′me getting a different page, one solution is to define a page in the theme call category-ID.php with the ID of the category, and include in this page the template of the page Portfolio I′ve defined. But this is not my favourite solution.

    1. Is there a way to redirect from https://www.domain.com/category/portfolio/ to https://www.domain.com/portfolio/?
    2. Or maybe, a way to get rid of the /category/ preffix in the url?

    Thanks in advanced.

Viewing 2 replies - 1 through 2 (of 2 total)
  • A quick way to do this is to filter all the category links, doing something like the following (code untested):

    function fix_portfolio_link($link = '') {
    return str_replace('category/portfolio','portfolio', $link);
    }
    add_filter('category_link', 'fix_portfolio_link');
    Thread Starter taote

    (@taote)

    Interesting filosofo.

    Thank you!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘How can I show a page for some categories?’ is closed to new replies.