BuddyDev

Search

Edit to activity shortcode plugin

  • Participant
    Level: Enlightened
    Posts: 56
    Andy on #3089

    Hi Brajesh.

    I’m using the activity shortcode plugin, and I wanted to make an edit to the plugin so it uses the ‘load more’ button instead of the standard pagination links, I removed this section:

    <?php if( $pagination ):?>
    	<div class="pagination">
    		<div class="pag-count"><?php bp_activity_pagination_count(); ?></div>
    		<div class="pagination-links"><?php bp_activity_pagination_links(); ?></div>
    	</div>
    <?php endif;?>

    and added this just after the endwhile (just like in buddypress/activity/activity-loop.php):

    <?php if ( bp_activity_has_more_items() ) : ?>
    	<li class="load-more">
    		<a href="<?php bp_activity_load_more_link() ?>">
    			<?php _e( 'Load More', 'buddypress' ); ?>
    		</a>
    	</li>
    <?php endif; ?>

    It doesn’t work correctly though. It loads more items when you click the load more button, but it ignores the shortcode parameters and uses Buddypress’s default parameters.

    Do you know how I can make this work correctly?

    Any help appreciated.

  • Keymaster
    (BuddyDev Team)
    Posts: 21762
    Brajesh Singh on #3093

    Hi Andy,
    The above code relies on the default implementation of load more and that’s why it is happening.

    You will need to supply your own js code for load more only then it will work properly. A look at the buddypress.js file and how BuddyPress loads the older activity will certainly help.

    Please take a look and let me know if you need any assistance further.

    Thank you
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 56
    Andy on #3156

    Thanks, I will take a look at that file to see if I can work it out. I’m using the activity loop file for the main activity areas so the ajax load more activities works for that. The ajax load more activities would be great to work with the shortcode plugin for other areas of my website, but it’s not a big issue for me at the moment.

    • This reply was modified 6 years, 6 months ago by Andy.

You must be logged in to reply to this topic.

This topic is: not resolved