Title: Where to put the php code?
Last modified: August 31, 2016

---

# Where to put the php code?

 *  [pacecal](https://wordpress.org/support/users/pacecal/)
 * (@pacecal)
 * [10 years ago](https://wordpress.org/support/topic/where-to-put-the-php-code/)
 * First of all, GREAT PLUGIN!
 * In the admin section i can see the views from al my posts, wauw!
 * I would like to add the views to the post it selfs after the author. Like (Dutch):
   Geplaatst op X door Y, aantal keer bezocht Z
 * x = date, y = author and z = views
 * I’m using the cach box bro theme but i can’t find out where exactly place the
   <?php echo gapp_get_post_pageviews(); ?>.
 * Thanx!
 * [https://wordpress.org/plugins/google-analytics-post-pageviews/](https://wordpress.org/plugins/google-analytics-post-pageviews/)

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [pacecal](https://wordpress.org/support/users/pacecal/)
 * (@pacecal)
 * [10 years ago](https://wordpress.org/support/topic/where-to-put-the-php-code/#post-7343126)
 * In Contect-single.php AND Content-php:
 *     ```
       <div class="entry-meta">
                       <?php catchbox_posted_on(); ?> <strong>aantal keer gelezen <font color='#1982d'><b><?php echo gapp_get_post_pageviews(); ?></b></font></strong>
                       <?php if ( comments_open() && ( $options[ 'commenting_setting' ] != 'disable' ) && ! post_password_required() ) : ?>
                           <span class="sep sep-comment"> — </span>
                           <span class="comments-link">
                               <?php comments_popup_link(__('Leave a reply', 'catchbox'), __('1 Comment ↓', 'catchbox'), __('% Comments ↓', 'catchbox')); ?>
                           </span>
                       <?php endif; ?>
       </div>
       ```
   
 * Now i’m looking for the template to put in the recent post widget:
 * post 1 (20 times)
    post 2 (40 times)
 *  [junmisugi](https://wordpress.org/support/users/junmisugi/)
 * (@junmisugi)
 * [10 years ago](https://wordpress.org/support/topic/where-to-put-the-php-code/#post-7343256)
 * hi, thanks for great plugin. i can see pageviews in admin section too, but i 
   couldn’t find where exactly put this code?
 * single php or content.php? after which codes i am supposed to put this code? 
   i don’t know “This code must be placed in The Loop” meaning. Please help me
 *  Thread Starter [pacecal](https://wordpress.org/support/users/pacecal/)
 * (@pacecal)
 * [9 years, 12 months ago](https://wordpress.org/support/topic/where-to-put-the-php-code/#post-7343274)
 * to put the code in de recent post widget edit the file class-wp-widget-recent-
   posts.php in wp-includes
 *     ```
       <ul>
       		<?php while ( $r->have_posts() ) : $r->the_post(); ?>
       			<li>
       				<a href="<?php the_permalink(); ?>"><?php get_the_title() ? the_title() : the_ID(); ?> (<?php echo gapp_get_post_pageviews(); ?>)</a>
       			<?php if ( $show_date ) : ?>
       				<span class="post-date"><?php echo get_the_date(); ?></span>
       			<?php endif; ?>
       			</li>
       		<?php endwhile; ?>
       		</ul>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Where to put the php code?’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/google-analytics-post-pageviews.svg)
 * [Google Analytics Post Pageviews](https://wordpress.org/plugins/google-analytics-post-pageviews/)
 * [Support Threads](https://wordpress.org/support/plugin/google-analytics-post-pageviews/)
 * [Active Topics](https://wordpress.org/support/plugin/google-analytics-post-pageviews/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/google-analytics-post-pageviews/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/google-analytics-post-pageviews/reviews/)

 * 3 replies
 * 2 participants
 * Last reply from: [pacecal](https://wordpress.org/support/users/pacecal/)
 * Last activity: [9 years, 12 months ago](https://wordpress.org/support/topic/where-to-put-the-php-code/#post-7343274)
 * Status: not resolved