Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1081192
    Right Angle S
    Participant

    Hi guys,

    I’ve recently updated the X Theme on http://www.sodrinks.co.uk/so-drinks-gin-sherry-vodka-drinks/ and now the portfolio items are not linking to the product page as they used to.

    I have ensured the correct URL is in project link on each portfolio item however whenever I click any of the items on the drinks page it takes me to the portfolio item itself rather then the product page.

    Is there a way to fix this so the portfolio images on the drinks page links directs to the product page?

    Thank’s for your help.

    Nick

    #1081253
    Lely
    Moderator

    Hi Nick,

    By default, portfolio page will link on it’s corresponding post. To change the link to the project link you have provided we need to add the following code on your child theme’s functions.php file:

    
    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;
    }

    Hope this helps.

    #1081283
    Right Angle S
    Participant

    Thank you, that has worked perfectly.

    Nick

    #1081294
    Lely
    Moderator

    You’re welcome Nick!

    Cheers!

  • <script> jQuery(function($){ $("#no-reply-1081192 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>