samedi 4 juin 2016

Loading a Wordpress plugin multiple times on infinite scroll

I am trying to use a ticker plugin in page with infinite scroll -- which means that the ticker will be loaded multiple times. The same one.

The documentation states that, if I want multiple tickers on a page, I should give "unique ID" to them. So, I did this:

$numerandom = rand() . "\n";
$id_unico = array( 'unique_id' => $numerandom, );

if (function_exists('ditty_news_ticker'))
{ ditty_news_ticker( 1525, '', $id_unico ); }

The first one is loaded ok. But, when the second one comes, it's empty.

The plugin author told me that he believes "the main issue here is that the javascript for tickers only gets loaded on page load. So, even if you are setting unique_id's for each ticker, the javascript is never triggered for those particular tickers since they are being load via ajax (I'm assuming)"

So, the question is: is there a way to make the plugin load everytime, with the ajax?

For example, I use a callback to make the twitter button load everytime:

$(document).ready(function() {
$.fn.almComplete = function(alm){
    console.log("callback posts");
     twttr.widgets.load();
  };
});  

I looked into the plugin files and saw a ditty_news_ticker() function on JS, but this didn't help either.

The plugin is the http://ift.tt/1GK6XMI. Any help?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire