Pass the id for a shortcode to use
-
Hi, I’m currently adding a rating feature for my project. I have made a custom listing template for my search result this after the title I add a shortcode for the rating, for example: [rating-shortcode postid=”id-is-here”]
the problem is when I add the <%= id %> to a variable to concatinate, example:
$variable = “<%= id %>”; and then: do_shortcode(‘[rating-shortcode postid=”‘.$variable.'”‘); it doesn’t work. it leaves an empty star rating even though the item already has a rating. If I echo the $variable = <%= id%> it shows the correct id. But when used to concatinate it behaves like a whole different id. looking forward for your expert and much needed response, thank you!
- The topic ‘Pass the id for a shortcode to use’ is closed to new replies.