The problem is that I’ve been unable to make this work for ads that are placed in the sidebar or other locations.
I figured this was due to the fact that the posts are actually a collection of PHP files, like single.php, sidebar.php, header.php, etc., but it seems like there should be a way to use the post id outside of the single.php file (in a widget on the sidebar, for example).
I need to clarify – the posts aren’t a collection of the code from those files, but the resultant pages that load on my site are.
After a little more investigation, I’ve understand that the_id doesn’t function outside the post loop. I’ve seen suggestions as to how to make the $post value global, but I’ve not been able to recreate this. It seems like it may be an old technique.
Does anyone know how to achieve this effect, or something similar?
esmi, I don’t think you’ve understood my question.