0

I am using WP Store Locator to list nearby "Therapists" (therapists=custom user group with Ultimate Member, this part of the project works perfectly) and Front End Pm for a basic messaging functionality.

I want to add a simple "Contact" button to the listed Therapists and Front End Pm has a shortcode for that.

What I did sofar: (all of these are happening in one function in functions.php)

$oktato_username = '<%= username_text %>';

// where "username_text" is a custom field for the Therapist's username

$listing_template .= "\t\t\t" . $oktato_username . "\r\n";

// this is an example line from the listing's template. This prints the given variable without any issue

$listing_template .= "\t\t\t" . '<%= username_text %>' . "\r\n";

// also prints the username without any issue (I don't need the variable, I just created it to find workarounds)

$listing_template .= "\t\t\t" . do_shortcode('[fep_shortcode_message_to to=\"$oktato_username\"]') . "\r\n";

// and this is a shortcode to add a message button. This prints the button without any issue, except the button's url is printed like this:

...(working parts of the url)&fep_to%3C%-%20username_text%20%%3E...

// see the "fep_to" part? it's printing %3C%-%20username_text%20%%3E which should be the actual username stored in my variable / or in the Underscore.js variable

Looks like it's basically printing the '<%= username_text %>' without parsing its data. It's strange for me that both variables prints the correct data anywhere outside the shortcode but not IN the shortcode. Seems like it's processed before the variable gets its data.

Any idea about how to put that username value in the shortcode parameter?

  • Try $listing_template .= "\t\t\t" . do_shortcode('[fep_shortcode_message_to to="'.$oktato_username.'"]') . "\r\n"; – Chetan Vaghela Jun 28 at 6:55

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.