• Resolved popmythology

    (@popmythology)


    Hi, my theme doesn’t explicitly support this plugin so my post count displays in the default form at the bottom of a post. I would like it to say “Post Views:” in front of the view count. How can I do this? Thank you in advance.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Contributor Pressjitsu

    (@pressjitsu)

    Hey there, thanks for reaching out!

    If you’d like to customize the output of this plugin, the first thing you should do is declare support for it in your theme’s (or child theme’s) functions.php file:

    add_action( 'after_setup_theme', 'my_pageviews_support' );
    function my_pageviews_support() {
        add_theme_support( 'pageviews' );
    }
    

    Then, wherever you would like to output the count in your theme’s templates, you can call a simple action, for example, inside the loop in single.php:

    Post Views: <?php do_action( 'pageviews' ); ?>
    

    A more thorough developer documentation is available on GitHub: https://github.com/pressjitsu/pageviews

    Hope that helps!

    • This reply was modified 8 years, 1 month ago by Pressjitsu.
    Thread Starter popmythology

    (@popmythology)

    Hi, guys, thanks for the response! Unfortunately, I am a WordPress newbie and don’t know anything about altering code. I don’t want to change anything else about the plugin. All I want is for it to say “Post Views:” in front of the actual post view number count. Could you tell me exactly what I would need to do?

    Plugin Contributor Pressjitsu

    (@pressjitsu)

    Hey there! I just mentioned above exactly what code you need to put in which files. If you’re still having trouble with that, please feel free to reach out to us via e-mail – [email protected], and we’ll help you implement it on your server.

    Thread Starter popmythology

    (@popmythology)

    Thanks for responding again! I guess the main thing I don’t know is exactly where in the single.php file to insert the code that you gave me, Post Views: <?php do_action( ‘pageviews’ ); ?>

    Should I send you a copy of the single.php file for my theme and then you can take a look and tell me where to put in the code?

    Plugin Contributor Pressjitsu

    (@pressjitsu)

    Try it out in different places and see how it works, worst case scenario you break things and undo your changes ?? Try and target somewhere inside “the loop” which is inside have_posts() anywhere after the_post(), you’ll see some functions there already, like the_title(), the_content(), etc. Don’t be afraid to experiment.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Displaying custom text next to post view count’ is closed to new replies.