Thanks for getting back to me. 🙂
Here’s a test page: http://cudenvertoday.org/test-page/
and here’s the repeater code I’m using:
<div class="topnews-container more-news tcol-xs-12 <?php if ( has_post_thumbnail()) { ?>yes-img<?php } ?> col-md-4 ">
<?php // Top Story Card ?>
<div class="topstories-card">
<?php // Top News Image & Headline ?>
<div class="topnews-img">
<div class="topnews-cat <?php if ( has_post_thumbnail()) { ?>whitecat"<?php } else { ?>blackcat"<?php } ?>>
<?php the_category();?>
</div>
<?php if ( has_post_thumbnail()) { ?>
<a href="<?php the_permalink(); ?>" class="entry-img">
<?php the_post_thumbnail( 'LatestNews-Small' ); ?>
</a>
<?php } ?>
</div>
<?php if ( !has_post_thumbnail()) { ?><div class="topnews-textbox"><div class="topnews-text"><?php } ?>
<h1><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php if (strlen($post->post_title) > 40) {
echo substr(the_title($before = '', $after = '', FALSE), 0, 40) . '...'; } else {
the_title();
} ?></a></h1>
<div class="topnews-author"><?php the_author(); ?></div><div class="topnews-date"><?php echo get_the_date(); ?></div>
<div class="topnews-excerpt col-md-8">
<?php if ( has_post_thumbnail()) { ?>
<p class="short-excerpt"><?php echo get_excerpt(95); ?></p>
<?php } else { ?>
<p class="long-excerpt"><?php echo get_excerpt(180); ?></p>
<?php } ?>
</div>
<?php if ( !has_post_thumbnail()) { ?></div></div><?php } ?>
<?php // END Top News Image & Headline ?>
<?php // Social Icons ?>
<div class="topnews-social <?php if ( has_post_thumbnail()) { ?>"<?php } else { ?>no-img"<?php } ?>>
<div class="topnews-social-group">
<div class="topnews-social-icons">
<div class="topnews-ratings">
<?php if(function_exists('the_ratings')) { the_ratings(); } ?>
</div>
<div class="addthis_toolbox addthis_default_style topnews-share" style="margin-left:15px;" data-url="<?php the_permalink(); ?>"
data-title"<?php the_title(); ?>" > <a class="addthis_button_facebook" addthis:url="<?php the_permalink(); ?>" addthis:title="<?php the_title(); ?>" ></a> <a class="addthis_button_twitter" addthis:url="<?php the_permalink(); ?>" addthis:title="<?php the_title(); ?>" ></a> <a class="addthis_button_email" addthis:url="<?php the_permalink(); ?>" addthis:title="<?php the_title(); ?>" ></a> </div>
</div>
</div>
</div>
<?php // END Social Icons ?>
</div>
<?php // END Top Story Card ?>
</div>
Can you try wrapping the function in a document ready?
$(document).ready(function() {
$.fn.almComplete = function(alm){
console.log("callback posts");
addthis.init();
addthis.toolbox();
};
});
I put that in the script in the footer, but still nothing. The browser console doesn’t log “callback posts” either. Any other ideas? Should the function be moved somewhere else?
<script language=”javascript” type=”text/javascript”>
$(document).ready(function() {
$.fn.almComplete = function(alm){
console.log(“callback posts”);
addthis.init();
addthis.toolbox();
};
});
</script>
</body>
Thats weird.
I usually add the complete function to my site JS file…
Maybe you could try that?
Added it to the js file, but no luck. Oddly, I was able to get one row of posts to show the share links when I:
A) Added this to the Repeater code:
<script language="javascript" type="text/javascript">
$( window ).load(function() {
console.log("callback posts");
console.log( "window loaded" );
});
function initAddThis()
{
addthis.init()
addthis.toolbox();
};
// After the DOM has loaded...
initAddThis();
</script>
B) And added ansychronous load (#async=1) to the AddThis js like this:
<script src="http://s7.addthis.com/js/300/addthis_widget.js#async=1" type="text/javascript"></script>
But that removed the AddThis buttons from the rest of the page (all the post queried before Load This, plus it only loaded the AddThis icons to the first row after clicking the ‘Load More’ button. Subsequent clicks of ‘Load More’ didn’t load the AddThis icons.
On a different note: Is it possible to sort and/or filter results after Load More results have loaded? For example, if I have 1K posts, but only 20 load within ALM, could I have a button in my sidebar that filters and/or sorts ALL 1K posts?
Im really not sure why those functions are not firing for you. Must be something to do with the set up the sites js.
Unless you want to give FTP access to your site im not sure I can much further.
This is the only filtering ALM offers – https://connekthq.com/plugins/ajax-load-more/examples/filtering/
Hey guys, I was having the same problem.
The cause was a conflict between the WordPress jQuery library and the jQuery library (inside vendors.js) I was intending to add to my Theme.
Basically I was inserting two jQuery libraries into the project. That was causing the ajaxComplete() method not to work and subsequently making $.fn.almComplete not to fire.
The solution was preventing the WordPress jQuery libraries to be included into the theme:
// functions.php
if( !is_admin()){
wp_deregister_script('jquery');
wp_register_script('jquery', ("http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"), false, '1.3.2');
wp_enqueue_script('jquery');
}