0

i am trying to create a membership directory that will display all the user which would be trigger by a shortcode based on the user ID.

I am not sure what is wrong with the code I did

my_members = get_the_author_meta('ID');
while ( !empty (my_members) ) : 
echo do_shortcode('[li_profile id='. my_members . ']');
endwhile:

I am not asking how to create the shortcode because the shortcode works by default doing something like this on a regular page [li_profile id=1] to display user data with User ID 1

the loop I need would be to loop the shortcode like below

[li_profile id=1]

[li_profile id=2]

[li_profile id=3]

[li_profile id=4]

[li_profile id=5]

[li_profile id=6]

until there are user ID available

  • And where is the code that represents [li_profile] into something? – Mayeenul Islam May 2 '17 at 14:58
  • 1
    get_the_author_meta retrieves the user meta of the author, not a list of users, and that loop has no exit condition, it will always run ( and there's no $ on my_members so it's got PHP syntax errors – Tom J Nowell May 2 '17 at 15:09
  • 1
    I'd recommend asking an additional question on the site on how to display a list of users, another question on how to create a basic shortcode, then combine those answers – Tom J Nowell May 2 '17 at 15:16
  • i have updated my question – JPL May 3 '17 at 16:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.