WordPress.org

Ready to get started?Download WordPress

Forums

Infinite-Scroll
Infinite is Removing custom javascript from content.php file (v. 2.0b2.120 (4 posts)

  1. gdinari
    Member
    Posted 1 year ago #

    Hi,

    I managed to get the plugin to work with my custom them but it seems that when the infinite scroll is initiated it removes the custom addthis javascript code I added to the content.php file of my theme.

    This is the addthis code that I added to the content.php file:

    <!-- AddThis Button BEGIN -->
                <div class="addthis_toolbox addthis_default_style ">
                <a class="addthis_button_tweet" tw:count="vertical"></a>
                <a class="addthis_button_facebook_like" fb:like:layout="box_count"></a>
                <a class="addthis_button_google_plusone" g:plusone:size="tall" ></a>
                </div>
                <script type="text/javascript">
    
    			var addthis_config = {
                "data_track_addressbar":true,
                addthis:url="<?php the_permalink(); ?>",
                addthis:title="<?php the_title(); ?>",
                addthis:description="<?php the_excerpt(); ?>"
                };
    
                </script>
    
                <script type="text/javascript" src="http://s7.addthis.com/js/300/addthis_widget.js#pubid=username"></script>

    But when I load the posts page, only the initial visible posts have the above javascript included. Every post listing after the infinite scroll is loaded is removed from the post listing. The html portion of the custom code is still there, just the javascript is gone.

    How to allow my custom code to function with the infinite scroll is enabled?

    Thank you

    http://wordpress.org/extend/plugins/infinite-scroll/

  2. eevan79
    Member
    Posted 1 year ago #

    Same problem. Infinite-Scroll removes all custom javascript...

  3. MrPerterman
    Member
    Posted 1 year ago #

    Have you tried adding :

    addthis.toolbox('.addthis_toolbox');
              addthis.counter('.addthis_counter');
              addthis.init();

    or something similar in Infinite Scroll's "Javascript to be called after the next posts are fetched" under settings?

  4. gdinari
    Member
    Posted 1 year ago #

    Hi Mr.Perterman, thanks that did the trick!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic