• Resolved negal

    (@negal)


    I’ve created a custom field called “Ocena” (raiting) in ACF plugin and put [gdrts_stars_rating_auto] shortcode there, but nothing is showing up when I try to display it on page sidebar widget.

    The page is not standard blog post, but shortcode works fine when I put it inside page content.

    Shortcode
    Sidebar

    How can I make it work on the sidebar?

    • This topic was modified 3 years, 10 months ago by negal.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Milan Petrovic

    (@gdragon)

    All ‘auto’ shortcodes work only inside the post content (well, inside the valid loop), they need to be able to detect the current post. If you want to embed it into some other location, you need to provide post ID. Check out the new Shortcode Builder to get shortcodes, and generate normal single rating shortcode and provide post type and post ID.

    Thread Starter negal

    (@negal)

    Thank you for your reply Milan. Could you tell me what would be the code to automatically “read” the id from current page? So I can implement the same code for every page.

    Plugin Author Milan Petrovic

    (@gdragon)

    Shortcode ‘_auto’ does that automatically when inside the loop. If you work with PHP, global $post; should contain the current post, but it depends on your code. You should consult WordPress documentation about this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Shortcode in custom field + display on sidebar’ is closed to new replies.