Home › Forums › Calendar Products › Events Calendar PRO › URL append code breaking permalinks
- This topic has 3 replies, 2 voices, and was last updated 6 years, 10 months ago by platformb.
-
AuthorPosts
-
June 8, 2017 at 8:09 pm #1295552platformbParticipant
Hi,
I use the following code to add a sku to the end of all products urls. However, it breaks the permalinks for the events, not showing any link both on the front end or back end to the specific event. Can you suggest why this breaks and a way to solve it?
Here is the website: https://www.richardjuzwin.com.au
Here is the events page: https://www.richardjuzwin.com.au/events/
Here is the link to a product showing the sku on the end of the URL: https://www.richardjuzwin.com.au/product/sg-21dc-kgv-2/?sku=26900
Have added an image to this post where can see the event permalink is empty.function append_sku_string( $link, $post ) {
$post_meta = get_post_meta( $post->ID, ‘_sku’, true );
if ( ‘product’ == get_post_type( $post ) ) {
$link = $link . ‘?sku=’ .$post_meta;
return $link;
}
}
add_filter( ‘post_type_link’, ‘append_sku_string’, 1, 2 );June 12, 2017 at 9:28 pm #1297001CliffMemberHi. Thanks for this detailed report.
I rewrote this snippet for you. Please try it out (it’s untested):
https://gist.github.com/cliffordp/ac089aa7a3cd509fc871b1e6bce11f7f
Please know that we do not typically provide custom coding support like this, per our Scope of Support / Terms, but we like to go above-and-beyond from time-to-time.
Please let me know how this goes for you.
July 4, 2017 at 9:35 am #1315935Support DroidKeymasterHey there! This thread has been pretty quiet for the last three weeks, so we’re going to go ahead and close it to avoid confusion with other topics. If you’re still looking for help with this, please do open a new thread, reference this one and we’d be more than happy to continue the conversation over there.
Thanks so much!
The Events Calendar Support Team -
AuthorPosts
- The topic ‘URL append code breaking permalinks’ is closed to new replies.