Support Forum

[postthanks-short-code] stopped working after update

RC Ryan Collins
Ryan Collins
Member

Hello team,

I just updated my Simple Press and all my SP plugins and themes.

I noticed my [postthanks-short-code] code is no longer working in the footer of my forum and also in my blog sidebar widget. 

  • Do you know how to get it working again?
  • What is the best way for me to add this to my child theme so it doesn’t happen again after the next upgrade?

Thank you for the support.

Blog-Sidebar-Widget.pngForum-Footer.png

6 Answers

New Answer

YS Yellow Swordfish
Yellow Swordfish
Member

I will need to confer and confirm this with @mr-papa but I am pretty sure that we do not supply such a shortcode (postthanks-short-code). Could this be some custom code that has been written for you?

MP Mr Papa
Mr Papa
Member

Nope. we dont have any shortcodes for that plugin – never have…

you can see a list of available template functions here:  https://simple-press.com/documentation/codex/plugins/our-plugins/available-plugins/post-thanks/

agree with @yellow-swordfish sounds like some custom code… likely someone added a simple shortcode to call our template function… perhaps you could share the hook registering the shortcode?

RC Ryan Collins
Ryan Collins
Member

Thanks guys.

Yes it appears there was some custom coding added to the functions.php file:

function wpc_shortcode_postthanks(){

if (function_exists(‘sp_thanks_user_stats’)) {

?><div  style=”width:100%; margin:0px 0 10px; padding:0%; float: left; text-align: center;” >

<?php sp_thanks_user_stats(‘tagclass=spCenter spThanksUserStats’, get_current_user_id(), ‘<span style=”padding-top: 10px;”>Thanked %THANKED% times</span>’); ?></div>

<?php } else{

//echo ‘no action’;

}

}

add_shortcode(‘postthanks-short-code’,’wpc_shortcode_postthanks’); ?>

 

So to preserve this shortcode through plugin updates, is it as simple as adding this custom code be added to the Child Theme functions.php?

YS Yellow Swordfish
Yellow Swordfish
Member

That is correct. move it to the child theme. Move it – not copy it. Then it will remain safe.