Skip to:
Content
Pages
Categories
Search
Top
Bottom

Adding pagination links to bottom of Group Directory


  • Dwenaus
    Participant

    @dwenaus

    This code snippet will add pagination links at the bottom of the group directory.

    it’s a pretty small thing, but from a usability perspective on a live site with many groups, it will be quite helpful.

    Put this in your functions.php file of your child theme. (you can learn how to make a BP child theme and functions.php elsewhere)

    // add pagination links to the bottom of the groups directory
    function add_bottom_group_pagination_links() {
    ?>
    <div class="pagination" style="margin-top:5px;">

    <div class="pag-count" id="group-dir-count">
    <?php bp_groups_pagination_count() ?>
    </div>

    <div class="pagination-links" id="group-dir-pag">
    <?php bp_groups_pagination_links() ?>
    </div>

    </div>
    <?php
    }
    add_action( 'bp_after_groups_loop', 'add_bottom_group_pagination_links' );

Viewing 10 replies - 1 through 10 (of 10 total)

  • paulhastings0
    Participant

    @paulhastings0

    Wow, worked like a charm. I wonder if someone could make this into plugin that does this for the group, memeber, and blog pages?

    Thanks man.


    paulhastings0
    Participant

    @paulhastings0

    Well, maybe it’s up to me then. :)

    I just got it working for members, groups and blogs.

    // add pagination links to the bottom of the groups directory
    function add_bottom_group_pagination_links() {
    ?>
    <div class="pagination" style="margin-top:5px;">

    <div class="pag-count" id="group-dir-count">
    <?php bp_groups_pagination_count() ?>
    </div>

    <div class="pagination-links" id="group-dir-pag">
    <?php bp_groups_pagination_links() ?>
    </div>

    </div>
    <?php
    }
    add_action( 'bp_after_groups_loop', 'add_bottom_group_pagination_links' );

    // add pagination links to the bottom of the members directory
    function add_bottom_member_pagination_links() {
    ?>
    <div class="pagination" style="margin-top:5px;">

    <div class="pag-count" id="member-dir-count">
    <?php bp_members_pagination_count() ?>
    </div>

    <div class="pagination-links" id="member-dir-pag">
    <?php bp_members_pagination_links() ?>
    </div>

    </div>
    <?php
    }
    add_action( 'bp_after_members_loop', 'add_bottom_member_pagination_links' );

    // add pagination links to the bottom of the blogs directory
    function add_bottom_blog_pagination_links() {
    ?>
    <div class="pagination" style="margin-top:5px;">

    <div class="pag-count" id="blog-dir-count">
    <?php bp_blogs_pagination_count() ?>
    </div>

    <div class="pagination-links" id="blog-dir-pag">
    <?php bp_blogs_pagination_links() ?>
    </div>

    </div>
    <?php
    }
    add_action( 'bp_after_blogs_loop', 'add_bottom_blog_pagination_links' );

    Maybe I’ll spend my weekend writing my 1st BP plugin.


    Nahum
    Participant

    @nahummadrid

    thanks. was looking for exactly this. i’ve been hardcoding this stuff…figured one day i’d need to start cleaning up the rummaged mess of files i have going. tx both


    Dwenaus
    Participant

    @dwenaus

    @paulhastings0 – I highly recommend diving in and writing your first plugin. It’s a bit of a tricky learning curve at first to put it into the WP plugin repository, but once you get the hang of it, it’s pretty cool. Thanks for doing the other ones. :)


    Dwenaus
    Participant

    @dwenaus

    and obviously for members you can do this:

    // add pagination links to the bottom of the members directory
    function add_bottom_members_pagination_links() {
    ?>

    <?php
    }
    add_action( ‘bp_after_members_loop’, ‘add_bottom_members_pagination_links’ );


    finni3
    Participant

    @finni3

    Would it be possible include forums as well?
    @paulhastings0


    paulhastings0
    Participant

    @paulhastings0

    @finni3 I think there’s a Trac ticket related to this: https://trac.buddypress.org/ticket/2472


    finni3
    Participant

    @finni3

    I guess I must have missed that Paul. Thanks for the info.


    Avi M
    Participant

    @avim

    Will this method still work in 1.2.6 and the forthcoming 1.2.7?

    Oops reread the tittle and now the that it says groups. I’m looking for something which will do the same thing on individual forum topic pages.


    nanchante
    Participant

    @nanchante

    That’s great.

    Can you please do the same snippet for forum posts? My install (1.2.8) seems to have ajax pagination, and I need real pagination for SEO.

    Further, how does one include the page number in the meta title tag?

    eg “Fitness Forum Page 2”

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘Adding pagination links to bottom of Group Directory’ is closed to new replies.
Skip to toolbar