Tagged: x
-
AuthorPosts
-
July 11, 2016 at 6:12 am #1081192
Right Angle SParticipantHi 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
July 11, 2016 at 7:17 am #1081253
LelyModeratorHi 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.
July 11, 2016 at 7:35 am #1081283
Right Angle SParticipantThank you, that has worked perfectly.
Nick
July 11, 2016 at 7:37 am #1081294
LelyModeratorYou’re welcome Nick!
Cheers!
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1081192 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
