• Resolved tobiasmalikowski

    (@tobiasmalikowski)


    Hi Darren I have several questions cause I’m struggling to archive the desired results.

    Basically I want to use different of the premium addons together the get a great usability and performance.

    1 try: Seo + Pagination + Preload
    The docs told me that pagination and preload won’t work together at the current state. That’s not nice, but ok. So after seeing that i tried another thing…

    2 try: Seo + Preload
    I’m having some weird issues with preoloading the wrong amount of items and instant changing the url to page 2, which causes the plugin to load more items. Basically I want to preload 9 posts (1 page) and have a button to let the user load additional items (9 each request, so 1 page). I don’t want an auto request, I want the user to click the button.

    Here is my shortcode:

    [ajax_load_more preloaded="true" preloaded_amount="9" seo="true" post_type="post" scroll="false" transition="slide" images_loaded="true"]

    Cause I now know that the seo plugin gets it’s posts per page from the settings -> read, I’ve set that also to 9 posts per page.

    If i now load the page it instantly loads 18 posts (not desired), changes the url to “page/2” and scrolls to page 2 (not desired). If i press my load more button it loads another 9 posts (desired behaviour), but scrolls to page 2 (not desired).

    What am I doing wrong or do these 2 addons don’t work together too?
    Hope you can help me out.

    Tobias

    https://www.ads-software.com/plugins/ajax-load-more/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Darren Cooney

    (@dcooney)

    Hi Tobias,
    You need to set pause=”true” in your shortcode.

    [ajax_load_more preloaded="true" preloaded_amount="9" seo="true" post_type="post" scroll="false" pause="true" transition="slide" images_loaded="true"]

    https://connekthq.com/plugins/ajax-load-more/examples/preloaded-posts/#shortcode

    Cheers,

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    thanks that worked. However I’ve another question. I’m doing complex stuff like adding the ALM posts to a slider for mobile devices while displaying a grid for large devices etc.

    The preload posts are added to another container. Is it possible to add all posts (preloaded and ajax posts) to the same container?

    Also I would like how I can ensure to select the AML container which created the callback almComplete. I spend the last hour what might be the cleanest way, cause I’ve a slider in the container like mentioned above and this slider needs to get reinitialized if content gets loaded and so on.

    Actually I’m doing it like this, but this forces me to use the caching on all AML containers I want to target (not that caching is a bad thing, but I was wondering if there is a simpler solution):

    // Gets called after every successful Ajax Load More query
    // @see https://connekthq.com/plugins/ajax-load-more/docs/callback-functions/
    $.fn.almComplete = function(alm){
    
    	// Get the current alm element by using it's caching id
    	var $element = $('.alm-paging-wrap[data-cache-id="' + alm.cache_id +'"]');
    
    	// Check if the element is a slider
    	var isSlider = $element.hasClass('slider-center');
    
    	if(isSlider) {
    
    		// If the element is a slider unslick the slider
    		$element.slick('unslick');
    		$element.find('.slick-initialized').slick('unslick');
    
    		// Add the slider class to the alm-paging-content element
    		$element.find('.alm-paging-content').addClass('slider-center');
    
    		// Reflow Foundation Interchange
    		$element.find('img[data-interchange]:not([src])').foundation();
    
    		// Initialize the slider
    		$element.find('.alm-paging-content').slick(sliderCenterDefaultSettings);
    
    	} else {
    
    	}
    
    };

    Thanks again for your help!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Preoload Posts and Seo’ is closed to new replies.