-3

I can's seem to figure out why I'm getting this error.

I need to turn user_link part into hyperlink(right now it outputs a text on the frontend). Error happens on this line in my shortcode.php file. I guess there is an error with a href part:

$output .= '<td>' . $order->billing_first_name . ' ' . $order->billing_last_name . ' <a href='" . $order->user_link . "'>" . $order['user_link'] . "</a> </td>';
Marko I.
  • 542
  • 10
  • 38

2 Answers2

2

Your issue is right here:

. ' <a href='" . 

Notice how you're starting with a single quote and ending with a double.

Definitely consider using an IDE. It will make these easy bugs blatantly obvious. I highly recommend PHPStorm, or if you don't want to spend anything, sublime text (Not an IDE but will provide linting and highlighting).

On top of that I'd recommend using some type of templating engine eventually. You should always try to avoid writing HTML as strings.

okawei
  • 1,447
  • 2
  • 12
  • 11
1
$output .= '<td>' . $order->billing_first_name . ' ' . $order->billing_last_name . ' <a href="' . $order->user_link . '">' . $order['user_link'] . '</a> </td>';

You switched the ' and " in the a href. I also changed the two " to ' in the a description.

Scriptman
  • 424
  • 2
  • 13