super shortcode for TOP10
-
I made myself a super shortcode that is missing in Top10
anyone could add following code in his functions.phpCreates a shortcode [view_hits] that returns the Top 10 Page-Hits-count. It was broken since last update because of the blog_ID bug in v2.03 that introduces double counting of pages with different blog_IDs
Now I extended the counter-selector to a hard coded “blog_ID=1”, for multisite one has to adopt probably to some WP – blog_ID variable (have not enough programming/wp knowledge).
I – and certainly many more users – would appreciate if that tiny extension will be part of top10 in future versions. the “php adding somewhere in the templates source” is due to todays complex theme-frameworks unworkable. Tx a lot!
function view_hits_function($atts , $content=null) { global $wpdb; $table_name = $wpdb->prefix . "top_ten"; echo ' table-name: ' . $table_name; $myid = get_the_ID(); echo ' the ID: ' .$myid; return ($wpdb->get_var($wpdb->prepare("SELECT cntaccess FROM $table_name WHERE ((postnumber = '$myid') AND (blog_ID =1))"))); } add_shortcode("view_hits","view_hits_function");
- The topic ‘super shortcode for TOP10’ is closed to new replies.