Support » Plugin: Google Analytics Post Pageviews » 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/

Viewing 3 replies - 1 through 3 (of 3 total)
  • 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)

    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

    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.