This topic has 1 reply, 2 voices, and was last updated 9 years by Laura.

  • Author
  • #76140
     iamj_kim
    Participant

    Hello,

    I would like to create a shortcode that shows a random member’s profile using the code below. Could you advise me how to go about creating the shortcode? Thanks.

    <?php if ( bp_has_members( ‘type=random&max=1’ ) ) : ?>
    <?php while ( bp_members() ) : bp_the_member(); ?>
    “><?php bp_member_avatar(‘type=full&width=125&height=125’) ?>
    <?php endwhile; ?>
    <?php endif; ?>

    #76259
     Laura
    Moderator

    Hello, this is the default code to create a shortcode:

    COPY CODE
    
    // Add Shortcode
    function custom_shortcode() {
    
    	// Code here
    
    }
    add_shortcode( '', 'custom_shortcode' );
    

    Do not paste the code with <?php and ?>
    You will need to change it a bit
    The code goes to functions.php

    Hi there!!! Help others from the community and mark any reply as solution if it solved your question. Mark as a solution

    Laura Solanes - Graphic Designer and Web Designer

    Please be patient as I try to answer each topic as fast as i can.

    If you like the theme or the support you've received please consider leaving us a review on Themeforest!

    Always happy to help you 🙂

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

Log in with your credentials

Forgot your details?