Viewing 1 replies (of 1 total)
  • Plugin Author emmanuelg

    (@emmanuelg)

    Hi

    By default, the shortcode gets the ID of the current post.
    In the sidebar, you are “outside of the loop”, it cannot get the ID.

    A way to manage is putting the following code into the sidebar:

    if ( is_single() ) {
    	global $post;
    	if ( $post ) {
    		echo do_shortcode('[attachments id='.$post->ID.']');
    	}
    }

Viewing 1 replies (of 1 total)
  • The topic ‘How do I get the shortcode to work in a sidebar’ is closed to new replies.