Avada Forums Community Forum Add portfolio category to portfolio URL's

Tagged: , , ,

Viewing 1 post (of 1 total)
  • Author
    Posts
  • antoinepernaud
    Participant
    Post count: 12

    I’m trying to add category in portfolio URL’s

    
    // add taxonomy to portoflio posts URL's
    add_filter('post_type_link', 'projectcategory_permalink_structure', 10, 4);
    function projectcategory_permalink_structure($post_link, $post, $leavename, $sample) {
        if (false !== strpos($post_link, 'avada_portfolio')) {
            $projectscategory_type_term = get_the_terms($post->ID, 'portfolio_category');
            if (!empty($projectscategory_type_term))
                $post_link = str_replace('avada_portfolio', array_pop($projectscategory_type_term)->
                slug, $post_link);
            else
                $post_link = str_replace('avada_portfolio', 'uncategorized', $post_link);
        }
        return $post_link;
    }
    

    But, I have a 404 when I click on single portfolio post… I can’t figure out why !? Any idea ?

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.