• Resolved itsfrancisnadal

    (@itsfrancisnadal)


    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Tijmen Smit

    (@tijmensmit)

    Where do you include the shortcode? In the template code itself? That won’t work.

    You will need to run the shortcode when you use this filter and include the star rating results that way in the returned meta data for each result. Then use the custom key ( star_rating or so ) in the template code.

    Thread Starter itsfrancisnadal

    (@itsfrancisnadal)

    Hi, thank you very much for your reply. I managed to fix it with your solution.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Pass the id for a shortcode to use’ is closed to new replies.