Kendell Daniel
Kendell Daniel

Reputation: 47

Concatenate function and shortcode to create a link in php

I'm trying to create a link by concatenating the function home_url() and the short code [pods field="audience_link"] in PHP on top of WordPress. I have the code below in my PHP file but I'm getting a 500 error on running the code. Can someone please point out where I've gone wrong?

<a href="<?php echo home_url() . '<?php echo do_shortcode('[pods field="audience_link"]' ); ?>'; ?> ">Testing Link</a>

Upvotes: 1

Views: 949

Answers (1)

IsThisJavascript
IsThisJavascript

Reputation: 1716

Opening php tags within php tags is not a wise decision. Once you open and start php, you should not open any more until you close it off.

<a href=" <?php echo home_url() . do_shortcode('[pods field="audience_link"]' ) ?> ">Testing Link</a>

Upvotes: 2

Related Questions