Getting The Total Share Counter Value for a Post/Page

Article sections

    When a share counter is configured to display on site, all share values (including the total counter) are stored inside post meta details. You can use the last saved value and show it inside theme code. To receive the total number of shares you can use the following sample call:

    $total_count = get_post_meta($get_the_ID(), 'essb_c_total', true);

    The $total_count variable will hold the number of shares a full numeric value. To pretty-print that value inside plugin you have a function for that essb_kilomega($value);.

    A complete sample that you can use to show the share values anywhere inside theme source will look like this.

    $total_count = get_post_meta($get_the_ID(), 'essb_c_total', true);
    echo '<span class="total-shares">'.essb_kilomega($total_count).'</span>';


    in Developers
    Did this answer your question?