BuddyDev

Search

[Resolved] bp_members_loop function

  • Participant
    Level: Initiated
    Posts: 1
    Canister on #50124

    I have simple index.php like below, but the main page is not showing the buddypress members.
    Any hints welcome.
    (I have tried the chatgpt standard hints)

    <?php
    
    get_header();
    ?>
    
    <div id="primary" class="content-area">
        <main id="main" class="site-main">
    
            <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
                <article>
                    <div class="entry-content">
                        <?php the_content();?>
                    </div>
                </article>
            <?php endwhile; endif; ?>
    
            <?php if ( is_home() && function_exists( 'bp_members_loop' ) ) : ?>
                <div class="members-loop">
                    <?php bp_members_loop(); ?>
                </div>
            <?php endif; ?>
    
        </main><!-- #main -->
    </div><!-- #primary -->
    
    <?php
    get_footer();
  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #50125

    Hi,
    Welcome to BuddyDev support forums.

    The code you are using does not create a proper members loop.

    Please take a look at this file
    https://github.com/buddypress/buddypress/blob/11.2.0/src/bp-templates/bp-legacy/buddypress/members/members-loop.php

    You should replace this part from your file

    
     <div class="members-loop">
                    <?php bp_members_loop(); ?>
                </div>
    

    with the code from line 23 to 146 o the linked file and then modify as you need.

    Hope that helps.

    Regards
    Brajesh

  • Participant
    Level: Initiated
    Posts: 1
    Canister on #50154

    Thanks
    Helped me forward.

  • Keymaster
    (BuddyDev Team)
    Posts: 24706
    Brajesh Singh on #50186

    You are welcome!

The topic ‘ [Resolved] bp_members_loop function’ is closed to new replies.

This topic is: resolved