0

I have been using the UPME plugin to design a member profile website that allows me to take information and show each user different profiles depending on a shortcode I put into a textarea field.

The problem I am having is using the do_shortcode call in my functions.php. I am not 100% sure if the field is being called correctly. I know it's not working as the shortcode is not loading anything up, but I do know the name of the textarea field is definitely view_matches.

Here is what I have so far print do_shortcode(the_author_meta( 'view_matches' ));

  • check if the output of the the_author_meta( 'view_matches' ) has a valid shortcode in it? – MortalViews May 23 '14 at 10:36
  • Hey there MortalViews, thanks for your answer, but I tried that with a working shortcode, just a basic line break and it was still showing just the shortcode and not the output of the shortcode. – Leslie Fernando May 23 '14 at 12:13
  • the output of the_author_meta('view_matches') should contain a valid shortcode, by valid i mean..if you insert it in a post it shoudlw ork. – MortalViews May 23 '14 at 12:15
  • Yep, I have taken a shortcode out of a normal post that works and put it in there. – Leslie Fernando May 23 '14 at 12:16
1

the_author_meta() is going to echo content directly. It will not pass a string back that can be processed by do_shortcode().

You want get_the_author_meta(), which is essentially the same as the_author_meta() but it returns a string instead of echoing the data.

  • Hi s_ha_dum, I've tried do_shortcode(get_the_author_meta( 'view_matches' )); instead and still nothing. If you go here msmr.com.au/my-account/matches and use the username leslie-fernando and the password 1234 (yes this is just a dummy subscriber account) you'll see what I mean. – Leslie Fernando May 24 '14 at 13:19
  • Then your view_matches isn't a valid shortcode or you aren't echoing the output of do_shortcode(). It doesn't echo by default, but returns a string. – s_ha_dum May 24 '14 at 14:03
  • view_matches is the variable/meta name of the textarea in the database though, not the shortcode. I am using another shortcode from the UPME profile plugin. So instead of using print, use echo? – Leslie Fernando May 24 '14 at 14:49
  • The output of get_the_author_meta( 'view_matches' ) needs to be a valid shortcode just like you'd write into the post body-- [myshortcode]. If not this won't work. It shouldn't matter what provides the callback for the shortcode. Either echo or print should work. – s_ha_dum May 24 '14 at 14:51
  • I think my original question may not have been quite clear. get_the_author_meta('view_matches') is not a shortcode. What is happening is I have created an additional meta tag in the author section using a textarea field. Now I want to be able to make that textarea field work like a post/page in WordPress where you can place a shortcode of any type in there and the shortcode will execute. view_matches is the textarea field which has a shortcode in called [upme] which will execute in there. I hope that explains it a bit better. – Leslie Fernando May 24 '14 at 16:16

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.