How can i add a class for this php file?

Hello everyone i dont know about programing i only building my website through wordpress, i found a cool plugin that shows the Total of sales and views of a product, my problem is that i need to custom the field with CSS and i dont know how to add a class in the php file or if it is even possible. I want to add the class to custome the fields in the single product page because if i do without an specific class all the changes affect the whole page, here is the code

Plugin Name: Product Sold Count
Plugin URI:  http:\
Description: This Plugin will used to show the total product sale count & and total view of product .Nice and easy way to know your sale of each product.
Version: 3.0.1
Author: Bhaskar Dhote
Author URI: http:\
define( 'WP_WOOSOLD_URL', plugin_dir_url(__FILE__) );
define( 'WP_WOOSOLD_PATH', plugin_dir_path(__FILE__) );
define( 'WP_WOOSOLD_SLUG','woo_soldcount' );

if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');
global $wpdbb_content_dir;

    include(ABSPATH."wp-includes/pluggable.php") ; // Include pluggable.php for current user    

function getPostViews($postID){
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        return "View: 0";
    return 'Views: '.$count;
function setPostViews($postID) {
    $count_key = 'post_views_count';
    $count = get_post_meta($postID, $count_key, true);
        $count = 0;
        delete_post_meta($postID, $count_key);
        add_post_meta($postID, $count_key, '0');
        update_post_meta($postID, $count_key, $count);

// Remove issues with prefetching adding extra views
remove_action( 'wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);

add_action( 'woocommerce_single_product_summary', 'wc_product_sold_count', 11 );
function wc_product_sold_count() {
    global $product;
    $units_sold = get_post_meta( $product->id, 'total_sales', true );
    echo '<p>'. sprintf( __( 'Total Sold: %s', 'woocommerce' ), $units_sold ).' '.getPostViews(get_the_ID());'</p>';


Thanks a lot for your help!

Read more here: How can i add a class for this php file?

Leave a Reply

Your email address will not be published. Required fields are marked *