Question

Ok, basically I'm trying to wrap;

<a class="userpro-init-chat" href="#" data-chat_with="<?php echo get_the_author_meta('ID'); ?> " data-chat_from="<?php echo get_current_user_id();?>" >Reply to this ad!</a>

within a wordpress shortcode in a template. It should simple enough, right?;

<?php echo  do_shortcode('[userpro_private]' <a class="userpro-init-chat" href="#" data-chat_with="<?php echo get_the_author_meta('ID'); ?> " data-chat_from="<?php echo get_current_user_id();?>" >Reply to this ad!</a> '[/userpro_private]'); ?>

However I keep getting the error "Parse error: syntax error, unexpected T_CLASS in /home/content/67/11982267/html/tester/wp-content/themes/twentytwelve/content.php on line 46"

Can anyone see why that is?

Im fairly new at php so iv probably done something wrong somewhere that's pretty obvious to everyone else, but I would really appreciate anybodies help!

Many thanks, James

Was it helpful?

Solution

I hope this solves the problem.

$text = "<a class='userpro-init-chat' href='#' data-chat_with='". get_the_author_meta('ID')."' data-chat_from= '".get_current_user_id()."' >Reply to this ad!</a>";

echo  do_shortcode('[userpro_private]'.$text.'[/userpro_private]'); 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top