Particular post displayed in a sidebar
Agrhhh..
It drives me crazy when I need to search through few websites I’ve been working on to find the one with some solution I need again for other project. Thus I’ve made decision. I’m going to publish here all kind of tricks(?)/codes and so on I’ve used. That will serve two purposes:
- gather all of them in one place
- present solutions of problems you have also encountered and stuck with ;)
I don’t care whether they are simple or complicated – I just don’t want to waste my time on searching them any more.
Here we go…
If you want to display one particular post in the sidebar you need to insert in the sidebar.php file following code:
<?php query_posts('p=xx');
global $more;
$more = 0;
while (have_posts()) : the_post();
the_content();
endwhile; ?>
Where xx is ID of post that is supposed to be displayed.
This can be also used to display page in the sidebar. Just replace p=xx with page_id=xx :) .
7th October 2007 no comments yet




