Created
October 11, 2016 04:25
-
-
Save muhfaris/26145a5eed60ac7b614f00418fc13479 to your computer and use it in GitHub Desktop.
Get view post count - konversi ke hasil M atau K
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
Setelah fungsi mendapatkan hasil view post | |
kemudian hasilnya berupa angka(count) | |
jika lebih dari 1000 atau 100000 akan di konversi | |
dengan fungsi round_numb() | |
*/ | |
function get_viewcount(){ | |
$view_ = (int) get_post_meta(get_the_ID(),'post_views_count', true); | |
$conv_view = isset( $view_ ) ? round_numb( $view_ ) : $view_; | |
echo " <div class='counter'>$conv_view</div>"; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment