Okay
  Public Ticket #3041649
Portfolio Archive URL
Closed

Comments

  •  10
    nox28w started the conversation

    Hello Salient team,

    My portfolio archive have this URL structure: /blog/project-type/*category/

    and I would like to change it to: /portfolio/kategorie/*category/

    Can you please provide me custom filter or function to achieve this? 

  •  8,839
    Tahir replied

    Hey Again,

    This should help:https://wordpress.org/plugins/custom-permalinks/ . 

    Thanks


    ThemeNectar Support Team 

  •  10
    nox28w replied

    Hello Tahir,

    thank you, I already tried that plugin and many more but this plugin doesnt offer solution to my problem. I also tried wrote my own function with no luck. I find something in comments (check 1.png please) and thats totally exact case but function doesnt work for me. Maybe its outdated or just inacurate. I think Themenectar would be able to help me with it in few minutes, can you please escalate me to him?

  •  8,839
    Tahir replied

    Hey Again,

    Thanks for the additional information. Escalating this to the developer.

    Thanks 


    ThemeNectar Support Team 

  •  1,070
    ThemeNectar replied

    Hey nox28w,

    It's fairly straightforward to create a custom permalink structure for custom post type taxonomies, however if you're trying to add a base to your
    Taxonomy which matches the same base of the single project template, that's where you'll hit a default limitation of WordPress and the single template will display 404.

    If you want your project-type taxonomy to use the structure /portfolio/kategorie/*category/ then the portfolio post type slug would need to be changed
    To anything other than "portfolio" in order to make that work by default. If you're okay with them being different then your snippet of code can be changed to simply be as follows:

    add_action('init', 'themes_dir_add_rewrites');
    function themes_dir_add_rewrites() 
    {
        global $wp_rewrite;
        $wp_rewrite->extra_permastructs['project-type']['struct'] = '/projects/kategorie/%project-type%';
    }

    In that example, the taxonomy base is made to be "projects" to allow your single portfolio pages to still function e.g. https://bizkit.studio/portfolio/3wiss-logo/

    Ensure to regenerate your permalinks after adding that snippet in by going to Settings > Permalink in your WP admin and clicking save changes.

  •   nox28w replied privately
  •  10
    nox28w replied

    Wouldnt below solution "make space" for /portfolio/kategorie/*category/?

  •  1,070
    ThemeNectar replied

    Adding a dynamic piece to the permalink structure would actually be a decent amount of code. However, the plugin https://wordpress.org/plugins/custom-post-type-permalinks/ makes this particular task easy. 

    With that active, you can simply add /%project-type%/%postname%/ to the portfolio section within the permalink options:

    6756464904.png

    Unfortunately that still won't allow the taxonomy permalinks to use "portfolio" as the base (if the single portfolio is using it).

  •  10
    nox28w replied

    ThemeNectar, thank you very much for your explanation.

    One last thing...  Im using custom filter / function that uses is_archive() and it include portfolio. I cannot find right exclude rule for it. I already tried && !is_tax, && !is_singular( $post_types = 'project-type' ) etc. Cannot find the right one.

  •  1,070
    ThemeNectar replied

    Hey nox28w,

    If you need to exclude the portfolio archives from your logic, you can use the following:

    if (!is_post_type_archive('portfolio') && 
        !is_tax('project-type') &&
        !is_tax('project-attributes')) {
        // code to execute when not on a portfolio archive 
    }
    

    Kind regards,