How do I call the current post's featured image in the sidebar? and if there is none, then a backup image?
Tell me more
×
WordPress Answers is a question and answer site for
WordPress developers and administrators. It's 100% free, no registration required.
|
|
I'm assuming you're going to be outputting this on a singular page (Post, Page, Attachment)? If so, the easiest thing to do is to put your post AND sidebar content inside the Loop, so that you have access to the Alternately, you could define a variable, inside the Loop, to hold In either case, inside the Loop, you would have e.g.:
Then, in your sidebar:
Note: I'm assuming you'll create a custom image size to output in the sidebar, e.g.
(which goes in |
|||||||
|
