shortcode
// Add Shortcode function attraction_shortcode() { $current_user = wp_get_current_user(); /** * @example Safe usage: $current_user = wp_get_current_user(); * if ( !($current_user instanceof WP_User) ) * return; */ $total_attr = count_user_posts( $current_user->ID , "post" ) ); return '<h4 class="section-title ">Products Submitted - <span class="dash-green">'.$total_attr.'</span> <i class="fa large fa-bar-chart"></i></h4>'; } add_shortcode( 'postcountattr', 'attraction_shortcode' );