New
PeoplePress is here. Community building for WordPress, reimagined. Fast, modern, and built for the communities you've always wanted to run.
See it live

BuddyDev

Search

how to add shortcode to top of activity feed

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on #14048

    Hi Peter,
    You will need to somehow co-relate a slider to the user.

    The possible options are using the username or the id.

    So, you will be naming your slider as

    
    some-slider-1 or some-slider-admin
    
    

    and based on the choice you can use the following to generate the slider name dynamically.

    
    
    echo do_shortcode( '[rev_slider alias="gym-classes-'. bp_displayed_user_id() .'"]' );
    
    

    or

    
    
    echo do_shortcode( '[rev_slider alias="gym-classes-'. bp_get_displayed_user_username() .'"]' );
    
    

    Hope that helps.

  • Participant
    Level: Enlightened
    Posts: 26
    Peter Fae on #14051

    How would that be phrased if I used the username – “peterfae” with the slider “peterfae-story” ?

    And could I set another username w/a different slider?

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on #14085

    Hi Peter,
    This should do the job

    
    echo do_shortcode( '[rev_slider alias="' . bp_get_displayed_user_username() . '-story"]' );
    
    

    Regards
    Brajesh

  • Participant
    Level: Enlightened
    Posts: 26
    Peter Fae on #14088

    I’m sorry Brajesh, that doesn’t make any sense. The syntax is confusing to me.

    If I used a revolution slider with the name “revslider-story”, with the username ‘peterfae’ how exactly would that syntax play out?

    like this?

    ‘echo do_shortcode( ‘[rev_slider alias=”‘rev slider-story . bp_get_displayed_user_username(peterfae) . ‘-“]’ );’

    I … that doesn’t feel right. Where do I put the single ticks or the double ticks? Do I put the username inside the parentheses? Confused.

  • Keymaster
    (BuddyDev Team)
    Posts: 25509
    Brajesh Singh on #14091

    Hi Peter,
    I am not sure how you want it now and it will help if you can write exactly the way you want the shortcode.

    The earlier was to make it like ‘user-name-story’ e.g. peterfae-story.

You must be logged in to reply to this topic.

This topic is: not resolved