Title: Shortcode for /structured_data placement
Last modified: February 20, 2020

---

# Shortcode for /structured_data placement

 *  [AngMcG](https://wordpress.org/support/users/angmcg/)
 * (@angmcg)
 * [6 years, 3 months ago](https://wordpress.org/support/topic/shortcode-for-structured_data-placement/)
 * I have a very large older recipe site that, for my own reasons, I don’t want 
   to use json, and instead want to use microdata.
    I have been able to use the 
   editor in the plugin to make the output microdata and then i removed the script
   and json tags from plugin files so it was showing up as meta data, but I can’t
   seem to control the location of where the plugin places the structured data. 
   I see it’s putting it in the head, and I can move to the footer, but the ratings
   don’t show up as part of my recipe structured data in wordpress, it shows up 
   as a different section. I want to be able to use shortcode to place the structured
   data output in a specific place on my theme file, that is in my recipe card to
   already be part of the structured data I have in my recipe microdata. Is this
   possible altering this piece of code from your plugin? Seems like there’s a simple
   solution I’m not thinking of. Maybe to make this into a shortcode call? but I
   just don’t know how to do it. (I’ve already deleted the script part to make it
   html.)
 * add_action(‘wp_head’, __NAMESPACE__.’\structured_data’);
    function structured_data(){
   if (! get_option(prefix(‘enable’))) { return; }
 *  if (get_option(prefix(‘grs’))
    && (is_singular() || is_page()) ) { $id = get_post_field(‘
   ID’); $title = htmlentities(get_post_field(‘post_title’)); $best = max((int) 
   get_option(prefix(‘stars’)), 1); $count = count_filter(null, $id, null); $score
   = score_filter(null, $best, $id, null);
 *  if ($score) {
    echo ”; $sd = get_option(prefix(‘sd’)); $sd = str_replace(‘[title]’,
   $title, $sd); $sd = str_replace(‘[best]’, $best, $sd); $sd = str_replace(‘[count]’,
   $count, $sd); $sd = str_replace(‘[score]’, $score, $sd); echo $sd; echo ”; } }}
    -  This topic was modified 6 years, 3 months ago by [AngMcG](https://wordpress.org/support/users/angmcg/).
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fshortcode-for-structured_data-placement%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

The topic ‘Shortcode for /structured_data placement’ is closed to new replies.

 * ![](https://ps.w.org/kk-star-ratings/assets/icon-256x256.jpg?rev=2140680)
 * [kk Star Ratings - Rate Post & Collect User Feedbacks](https://wordpress.org/plugins/kk-star-ratings/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/kk-star-ratings/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/kk-star-ratings/)
 * [Active Topics](https://wordpress.org/support/plugin/kk-star-ratings/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/kk-star-ratings/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/kk-star-ratings/reviews/)

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * 0 replies
 * 1 participant
 * Last reply from: [AngMcG](https://wordpress.org/support/users/angmcg/)
 * Last activity: [6 years, 3 months ago](https://wordpress.org/support/topic/shortcode-for-structured_data-placement/)
 * Status: not resolved