WordPress.org

Ready to get started?Download WordPress

Forums

Plugins Not Loading On Second Page (4 posts)

  1. zacatictac12
    Member
    Posted 2 years ago #

    Hello. I have implemented a script on my website:
    http://www.awesomewasteofmoney.com/

    That loads the next page underneath without having to reload the page. If you scroll to the bottom and click "LOAD MORE POSTS" this is the script I am reffering to. I will also paste the code below:

    <script type="text/javascript">
    // Ajax-fetching "Load more posts"
    $('.load_more_cont a').live('click', function(e) {
    	e.preventDefault();
    	//$(this).addClass('loading').text('Loading...');
            $('.load_more_text a').html('Loading...');
    	$.ajax({
    		type: "GET",
    		url: $(this).attr('href') + '#content',
    		dataType: "html",
    		success: function(out) {
    			result = $(out).find('#content_inside .featured_box');
    			nextlink = $(out).find('.load_more_cont a').attr('href');
                            //alert(nextlink);
    			//$('#boxes').append(result).masonry('appended', result);
                        $('#content_inside').append(result);
    			//$('.fetch a').removeClass('loading').text('Load more posts');
                            $('.load_more_text a').html('Load More');
    
    			if (nextlink != undefined) {
    				$('.load_more_cont a').attr('href', nextlink);
    			} else {
    				$('.load_more_cont').remove();
                                    $('#content_inside').append('<div class="clear"></div>');
                                  	<?php get_header(); ?>                  
    
    				//  $('.load_more_cont').css('visibilty','hidden');
    			}
    
    /*                    if (nextlink != undefined) {
                            $.get(nextlink, function(data) {
                              if($(data + ":contains('featured_box')") != '') {
                                //alert('not found');
                                                        $('.load_more_cont').remove();
                                                              $('#content').append('<div class="clear"></div>');
                              }
                            });
                        }*/
    
    		}
    	});
    });
    </script>

    My Problem is, once the second page of posts has loaded, my plugins dont seem to work on that page. For example I have a plugin that makes all External links open in a new tab. It works on the first page fine, but as soon as i load the next it is no longer working. Any ideas?

  2. deepbevel
    Member
    Posted 2 years ago #

    It's likely a JQuery conflict, unless you know how to resolve JQuery incompatability you may have to choose which plugin to keep.

    The standard troubleshoot is to deactivate all plugins (except the ine you're testing of course) and reactivate one at a time to find the conflict.

    If you're lucky, it could be one of the conflicting plugs just needs to be updated.

    Also a possability that sonething in the theme is causing the issue, You might activate the default (twentyeleven), or if that's what you're using get twentyten.

  3. Roscius
    Member
    Posted 2 years ago #

    A thought, may or may not be the issue, when you load content and insert it in to the DOM via AJAX the ready event isn't re-fired, and the event handlers for the links may not be attached. This may be breaking the scripts on your dynamically loaded content.

    See jQuery.live and jQuery.on for more details.

  4. zacatictac12
    Member
    Posted 2 years ago #

    Thank you, I have solved the problem.

Topic Closed

This topic has been closed to new replies.

About this Topic