Portfolio Item Permalink

Hi, I’ve seen in one of your archived that forum that we are able to link a portfolio item directly to an external url by adding a functions.php file to child theme? It worked for the person who posted the question. I’ve just tried the same thing and it doesn’t work. Can advise? Cos it’s really very irritating to for a browser to go another step to visit the external url.

Below is what I’ve .php file I’ve copied from that forum.

add_filter( 'post_type_link', 'x_remap_portfolio_permalink_to_project_link', 10, 4);

function x_remap_portfolio_permalink_to_project_link($post_link, $post, $leavename, $sample) {

    if ('x-portfolio' == $post->post_type) {
        $custom = get_post_custom($post->id);

        if (isset($custom['_x_portfolio_project_link']) && $custom['_x_portfolio_project_link'][0]!='')
            return $custom['_x_portfolio_project_link'][0];
    }

    return $post_link;
}

btw, my portfolio is displayed in a page instead of post. Thank you.

Hi Amilyn,

Thanks for reaching out.
We don’t offer investigation or support on custom coding, still, I checked the code and it worked after adding the Project link in the Portfolio Item. I would suggest you check by adding the Project Link once.

Hope it helps.
Thanks

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.