WordPress.org

Ready to get started?Download WordPress

Forums

AJAX Hits Counter + Popular Posts Widget
[resolved] How to use your plugin in my template? (9 posts)

  1. juscelinobarao
    Member
    Posted 10 months ago #

    I've tried this:
    <?php echo post_hit(); ?>

    This:
    <?php echo post_hits(get_the_ID()); ?>

    And further that:
    <?php echo post_hits(post_id()); ?>

    But no success, I need help.

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

  2. kutsy
    Member
    Plugin Author

    Posted 10 months ago #

    post_hits() -- this is invalid function name.
    Valid is ajax_hits_counter_get_hits()
    So you need to use like this:
    <?php echo( ajax_hits_counter_get_hits( get_the_ID() ) ); ?>
    or like this:
    <?= ajax_hits_counter_get_hits( get_the_ID() ) ?>

  3. juscelinobarao
    Member
    Posted 9 months ago #

    Thank you very much.
    It worked perfectly.
    I owe you one.

  4. AsankaD
    Member
    Posted 9 months ago #

    Hi Kutsy your plugin is amazing!

    I've tried a few plugins earlier and couldn't get them to work how I wanted. But this plugin works out of the box.

    Anyways I'd like to know instead of using the widget can we place an html code(which includes all the features that widget has) in php files ?

    Thanks!

  5. kutsy
    Member
    Plugin Author

    Posted 9 months ago #

    Anyways I'd like to know instead of using the widget can we place an html code(which includes all the features that widget has) in php files ?

    Hello.
    You can place widget in your theme (in functions.php, for example) and this will be working. But don't forget of widget updating :-)

  6. AsankaD
    Member
    Posted 9 months ago #

    Thanks!

    Is there a shortcode to use this in posts?

  7. kutsy
    Member
    Plugin Author

    Posted 9 months ago #

    Is there a shortcode to use this in posts?

    I'll add this feature in next version of plugin.

    But now you can use
    <?php echo( ajax_hits_counter_get_hits( get_the_ID() ) ); ?>
    or:
    <?= ajax_hits_counter_get_hits( get_the_ID() ) ?>

  8. AsankaD
    Member
    Posted 9 months ago #

    That'll be awesome!

    Thanks

  9. kutsy
    Member
    Plugin Author

    Posted 8 months ago #

    Is there a shortcode to use this in posts?

    I'll add this feature in next version of plugin.

    AsankaD, check version 0.9.1

Reply

You must log in to post.

About this Plugin

About this Topic