Solution: shortcode on top of the page remove bold remove symbol
-
For everyone who was wondering why the shortcode always appears at the top of the page, how to remove the
<strong>
or the £ symbol before the amount, I am here to provide some solutions for you, since I’ve been looking into it for days and the author didn’t seem very responsive.The reason why the shortcode appears always at the top is because author’s shortcode function ends with echo and not with a return.
I am sharing you the following code. It will print the shortcode whenever you put it, with no
<strong>
or currency symbol. Simply add this code into your functions.php. Make sure it is in the CHILD THEME, otherwise it will be overwritten at your next theme’s update.add_shortcode( 'displaywalletcredits', 'displayWalletCredits' ); function displayWalletCredits ( $atts ) { /** do not run if the user is not logged into WP */ if(! is_user_logged_in() ) return false; /** shortcode attribute functionality */ extract( shortcode_atts( array ( 'display_username' => true, 'separator' => ':', 'username_type' => 'display_name' ), $atts ) ); /** @var object the current user object */ $current_user = wp_get_current_user(); /** deturmine whether to show the username or not */ if($display_username === 'true') { /** which type of user name to display */ switch($username_type) { case 'first_name': $output .= $current_user->first_name; break; case 'last_name': $output .= $current_user->last_name; break; case 'full_name': $output .= $current_user->first_name . ' ' . $current_user->last_name; break; default: $output .= $current_user->display_name; } } $hasBalance = get_user_meta(get_current_user_id(), '_uw_balance', true); if (!empty($hasBalance)) { $output .= ($hasBalance); } else { update_user_meta( get_current_user_id(), "_uw_balance", "0.00"); $output .= get_user_meta(get_current_user_id(), '_uw_balance', true); } return $output; }
Then call the user’s amount with [displaywalletcredits].
Enjoy.
https://www.ads-software.com/plugins/user-waller-credit-system/
- The topic ‘Solution: shortcode on top of the page remove bold remove symbol’ is closed to new replies.