New Landing How can we help? Themeforest Theme Support Dante Use portfolio categories in portfolio item url

Viewing 10 posts - 1 through 10 (of 10 total)
  • Posted in: Dante
  • #49135
    morruu
    Member
    Post count: 106

    Hi again,

    How can insert the portfolio category slug into the url of the portfolio items, so I achieve something like http://www.kamillaruus.dk/galleri/portfolio-category/post name/.

    I have tried to insert the following in permalinks under Portfolio permalink base => Custom base: /galleri/%portfolio-category%.

    That doesn’t seem to work.

    Best regards.

    Morten Ruus

    #49845
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    First use custom rule like

    /galleri/%portfolio-category%/
    
    and put this code functions.php at end of file 
    add_filter('post_type_link', 'swift_portfolo_permalink', 1, 3);
    function swift_portfolo_permalink($permalink, $post_id, $leavename) {
    	
        if (strpos($permalink, '%portfolio-category%') === FALSE) return $permalink;
            // Get post
            $post = get_post($post_id);
            if (!$post) return $permalink;
    
            // Get taxonomy terms
            $terms = wp_get_object_terms($post->ID, 'portfolio-category');
            if (!is_wp_error($terms) && !empty($terms) && is_object($terms[0]))
            	$taxonomy_slug = $terms[0]->slug;
            else $taxonomy_slug = 'portfolio-category';
    
        return str_replace('%portfolio-category%', $taxonomy_slug, $permalink);
    }
    
    It will help you sure .
    
    With Best Regards
    Swiftideas Themes
    #53239
    morruu
    Member
    Post count: 106

    Thank you for your answer. I will try that.

    Best regards
    Morten

    #53242
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    It is tested solution and will work 100% . I will wait for your feedback .
    Thanks
    With Best Regards
    Swift Ideas

    #53249
    morruu
    Member
    Post count: 106

    Thank you Mohammad.
    It works which you can see here http://www.kamillaruus.dk/galleri/graphic-design/desert-mini-planet/ and in the attachment.

    Best regards
    Morten

    #53251
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    I’m glad that its worked . Do you need more help ?
    With Best Regards
    Swift Ideas

    #53252
    morruu
    Member
    Post count: 106

    In fact I do.
    I’m going to make two subpages under “Galleri”. One is called “Akrylmalerier” and the other one is going to be called “Akvareller” (in English Paintings and watercolors).
    How can I differentiate the urls to the index gallery icon, when I’m looking at a portfolio item – please se attachment?
    Portfolio items for “Akrylmalerier” should lead to “Akrylmalerier” (url http://www.kamillaruus.dk/akrylmalerier/) and portfolio items for “Akvareller” should lead to “Akvareller”.

    Looking forward to hear from you.

    Best regards
    Morten

    #53990
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    If you provide wordpress admin login detail so i can look in to this to find any solution .
    Thanks

    #55761
    morruu
    Member
    Post count: 106

    I think I’ll use the categories as subpages to gallery page instead, so the gallery page will be the main portfolio.
    But thank you for your help.

    Best regards
    Morten

    #55790
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    You most welcome
    Thanks 🙂
    With Best Regards
    Swift Ideas

Viewing 10 posts - 1 through 10 (of 10 total)

You must be logged in and have valid license to reply to this topic.

License required for the following item
Login and Registration Log in · Register