• Hey I was reading through other comments but cant seem to find a way to use the widget in a php page. When I use this echo(ajax_hits_counter_get_hits(get_the_ID())); I only seem to get “0”. I want to be able to display the three most popular pages in a page not using a sidebar widget, can you help me with that?

    http://wordpress.org/plugins/ajax-hits-counter/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author kutsy

    (@kutsy)

    I’ll add this to my TO-DO list.

    I’m using the following code to do this:

    <?php the_widget( 'AJAX_Hits_Counter_Popular_Posts_Widget', 'count=20&date_range=2&one_element_html=<div class="popular-posts"><a href="{permalink}" title="{post_title}">{thumbnail-250x150}<br><h2 class="heading-font">{post_title}</a></h2></div>' ); ?>

    The “date_range=2” is for weekly. I changed my default thumbnail size to 250×150 in the Settings/Media area of WordPress. It works great!

    And that’s it. I use the following to style the widget:

    <style>
    	.ajax_hits_counter_popular_posts_widget { display: block; margin: 10px; }
    	.ajax_hits_counter_popular_posts_widget ul li { clear: both; }
    	.ajax_hits_counter_popular_posts_widget h2 { margin: 6px 0 18px; font-size: 20px; }
    	.ajax_hits_counter_popular_posts_widget h2 a { color: #444;  }
    	.ajax_hits_counter_popular_posts_widget img { width: 100%; height: auto; }
    </style>
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Displaying widget in other files.’ is closed to new replies.