WordPress.org

Ready to get started?Download WordPress

Forums

Google Analytics Top Content Widget
[resolved] How can I remove "Site Title"? (3 posts)

  1. supertrooper2
    Member
    Posted 4 months ago #

    I have the following code embedded in my theme's functions.php file:

    add_filter( 'gtc_pages_filter', 'gtc_add_viewcount_title' );
    function gtc_add_viewcount_title( $pages ) {
    
        if ( !$pages )
            return false;
        // loop through the pages
        foreach ( $pages as $key => $page ) {
            // and add the page count to the title value
            $pages[$key]['children']['value'] = $pages[$key]['children']['value'] . ' ['. $pages[$key]['children']['children']['ga:pageviews'] .' Views]';
        }
        return $pages;
    }

    Also the following code is embedded in my theme's single.php file:

    <h3>Top-Viewed Posts Last 30 Days</h3>
    <?php echo do_shortcode('[google_top_content pageviews="5" catfilter="3173" contentfilter="post" number="10" showhome="no" time="2628000"]'); ?>
    <h3>Top-Viewed Posts Last 12 Months</h3>
    <?php echo do_shortcode('[google_top_content pageviews="5" catfilter="3173" contentfilter="post" number="10" showhome="no" time="31536000"]'); ?>

    For some reason the display of top posts still repeats the site title in all of the listings.

    Please advise how to remove site title from the listings.

    Thanks in advance for your advice.

    http://wordpress.org/plugins/google-analytics-top-posts-widget/

  2. supertrooper2
    Member
    Posted 4 months ago #

    After experimenting I finally succeeded to remove the site title by inserting the following filter into my theme's single.php file:

    titleremove= "Site Title"

    The full code is now as follows:

    <h3>Top-Viewed Posts Last 30 Days</h3>
    <?php echo do_shortcode('[google_top_content pageviews="5" titleremove= "Focusing on Wildlife" contentfilter="post" catfilter="3173" number="10" showhome="no" time="2628000"]'); ?>

    This request is now marked as resolved.

  3. Justin Sternberg
    Member
    Plugin Author

    Posted 4 months ago #

    Thanks for posting for others.

Reply

You must log in to post.

About this Plugin

About this Topic