New Landing How can we help? General Feedback & Suggestions Adding %portfolio-category% as an option to the portfolio permalink

Viewing 4 posts - 1 through 4 (of 4 total)
  • #268148
    parcyvall
    Member
    Post count: 143

    Dear Support,

    I would like to suggest that you add an option to use %portfolio-category% as a variable inside the portfolio permalink, as it is possible with general blog posts.

    I have long used the following code inside functions.php to get this working. But I think it should be a default feature.

    
    	/* ADD PORTFOLIO CATEGORY SLUG
    	================================================== */
    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);
    }

    Thank you for considering my suggestion.
    Kind regards,
    Simon

    #268272
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    For which team, do you want this change?
    Thanks
    Mohammad

    #268273
    parcyvall
    Member
    Post count: 143

    Hi Mohammad,

    currently I’m using the new Theme “uplift”. But before that I used Atelier with the same code.

    Kind regards,
    Simon

    #268282
    Mohammad – SUPPORT
    Moderator
    Post count: 27441

    Hi,
    Please create a topic under the Uplift theme category.
    Thanks
    Mohammad

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

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

License required for one of the following items
Login and Registration Log in · Register