Forum Replies Created

Viewing 15 replies - 46 through 60 (of 70 total)
  • Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    thanks for the quick reply. Was able to solve that issue, by adding scroll=’false’ and pause=’true’. Now there are only two open issues.

    Issue 1: Url not updating.

    Issue 2: Loading sequence is wrong. Lets assume I got the following posts:

    • Post-3 (Newest, 09.06.16)
    • Post-2 (Middle, 08.06.16)
    • Post-1 (Oldest, 07.06.16)

    If I view the single view of Post-2 and click on “load previous post” I expect the plugin to load Post-1. Instead Post-3 is loaded. If I click “load previous post” again Post-2 is loaded. If I click “load previous post” again Post-1 is loaded.

    Hope this makes clear what is going wrong.

    Thanks for your quick help!

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    no how should I reproduce this on your site?
    Your site is not using a specific port like my localhost (:984) does.

    Therefore I can’t reproduce this on your site. Also like I mentioned before if the site goes live this issue is likely gone. But however since your plugin can handle the port correctly if I open an article from news page 1 and go back via browser back button bot not if I do the same from page 2 there might be something wrong.

    So you might consider this issue as not that important. But the second one, which is important is still open (posting it again):

    1. Lets assume that the user uses the pagination to navigate between the news pages, for example he starts at /news/ (which is the same as (/news/page/1/) and then moves to /news/page/2/. Now he uses the back button of his browser and wants to use the navigation again, but from now (after use of browser back button) the url wont update!

    Again thanks for your help and time!

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hey Darren,

    yes I can reproduce this. It doesn’t matter if I use my existing shortcode or the one you gave me to try, the port is always set in the data-canonical-url attribute.

    Everything is working if I just want to navigate between the news pages using the pagination, the scroll loading or the browser back button.

    The issue only occures if I navigate to any news page other than the first, open and news article (single view) and then using the back button to get back to the news page I was before. Only in this case the port gets stripped out and thats the case no matter if I use your shortcode or mine.

    Example (Port gets stripped out in last step):

    Current User Location -> User Destination
    ————————————————————–
    example.com:984/news/ -> example.com:984/news/page/2/
    example.com:984/news/page/2/ -> example.com:984/news/articleX
    example.com:984/news/articleX -> (Back) example.com/news/page/2/

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    thank you for the quick fix. There are two additional things that I found out after implementing your hotfix.

    1. Lets assume that the user uses the pagination to navigate between the news pages, for example he starts at /news/ (which is the same as (/news/page/1/) and then moves to /news/page/2/. Now he uses the back button of his browser and wants to use the navigation again, but from now (after use of browser back button) the url wont update!

    2. I’m developing on my local host with a custom port (https://www.example.com:984/) so maybe this issue does not exist on production. If i move to any other than the first news page and click on an article (https://www.example.com:984/news/page/2 -> https://www.example.com:984/news/article) and then use the browser back button to get back to https://www.example.com:984/news/page/2 the port “984” is stripped from the url. So the page I receive is https://www.example.com/news/page/2 which results in an error.

    Thanks for your help. Let me know if I can do anything to help you with this.

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    thanks for checking.

    data-canonical-url on the #ajax-load-more div points to the home page:

    data-canonical-url="https://www.example.com/"

    Just wanted to update my Hotfix for using WpJoints (Foundation) and your Plugin.

    ajax-load-more.php Line 246 replace:
    wp_register_script( 'ajax-load-more', plugins_url( '/core/js/ajax-load-more.min.js', __FILE__ ), array('jquery'), ALM_VERSION, true );

    with:
    wp_register_script( 'ajax-load-more', plugins_url( '/core/js/ajax-load-more.min.js', __FILE__ ), '', ALM_VERSION, true );

    The description why this is needed can be found in my comments above.

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hey darren, works like a charm! Thanks for the quick help.
    Already wanted to solve it in this way, but wanted to ask if there is something built in that I didn’t know.

    Have a great day ??

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hey darren, sorry to reopen this, but i stumbled on another issue.
    I’m using your Pro Addon for caching. If I visit my German news page I see AML fetching the news in German. But if I switch to the English version AML still pulls the cached German version.

    If I clear the AML cache I get the English version.

    How can I get the caching work properly with multiple languages?

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hey darren,

    after I saw your answer I was confused but motivated to try this again. So I recreated my english news page, cleared the ALM cache and reactivated the plugins. Voila everything is working now.

    Thanks for testing and helping me with this strange behaviour.

    Have a great day!

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    thanks for the reply. Since you already have the functionality to add the language to your query, this should be easy to implement and help many people (Polylang has over 100.000 users).

    You can get the current language while using polylang as follows:

    pll_current_language($value);

    Link to the docs of that function: pll_current_language($value);

    Hope that you can get this to work asap, as I really need this feature and I can imagine that I’m not the only one who uses your plugin and has more than one language ??

    If I can assist you in any way, please let me know.

    +1 For this feature!

    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!

    tobiasmalikowski

    (@tobiasmalikowski)

    Needed this too, but while looking at the source code I found out that Dan’s solution is not working cause post__not_in expects a string of post ids seperated by comma.

    So use this instead:

    // Get ids of sticky posts (array)
    $sticky = get_option('sticky_posts');
    
    // Implode array to string, it's important to have no spaces around the comma
    $sticky = implode(',', $sticky);
    
    // Use your variable in the shortcode, don't forget your other attributes
    echo do_shortcode('[ajax_load_more post__not_in=' . $sticky . ']');

    Hope this post helps someone struggling with this.

    tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    thanks for clearing things up. Nice to know that the version is appended to your script so it has nothing to do with this issue.

    Possible Solution #1:
    Maybe you can fix this by changing the order script registration. The issue comes down to the fact that your script gets registered at that some point where jQuery does not exist due to my deregistration.

    Possible Solution #2:
    You can make the already mentioned solution backwards compatible if you just give devs the option to change the dependency but set your current settings as default settings.

    Since your script depends on jQuery i think solution #1 would be the cleanest way, and maybe its easier as well. Maybe I can do some testing for you if I find the time. If thats the case I keep you updated in this thread.

    Thread Starter tobiasmalikowski

    (@tobiasmalikowski)

    Hi Darren,

    thanks for the info. Did you wrote down this anywhere cause i can imagine that this behaviour does not seem obvious to anyone. At least it drove me crazy for 30 minutes ??

    Maybe this post helps someone. Let’s close this and sorry for the post.

Viewing 15 replies - 46 through 60 (of 70 total)