“WordPress being a CMS, a lot of visitors do NOT visit my Home Page but go straight to a link for one of my posts. I would like to display a message to visitors before any post is displayed not just pin a post to the top of the Home Page – How can this be done?”
I feel a bit silly asking myself a question and then answering it, buy hey it’s what I’m trying to achieve now on this WordPress site so I thought I’d make a post of it…
The reason I would like to do this is because I’m still tweaking the style sheets and features of this website (if you have Flash 8 or above installed you should see the Caspian IT logo animating as an .flv embedded within a .swf that was generated using Adobe After Effects – hope you like it – if you can see it.)
My point is, it’s almost as though I need to display an ‘under construction message – yikes!’. Honestly I really do need to let visitors know this this site is under ‘live’ development and that the stylesheets might go a bit wonkey…
Under Construction… however it’s worded it just desn’t seem right.
No, I think I’ve just changed my mind and to just let it go – if the page is wonkey it’s wonky I know that and my visitors know that. I’ve changed my mind, if you haven’t yet then take a look here.
Ok, that’s because you might want to have a specific banner appear or sales thingy placed above your post so you know you’re always getting a specific message/advertisment across – which is a good thing. It does no harm to get a specific message across does it…
To make this so, you need to start tweaking your single.php file in your themes folder ie (http://yoursite.com/wp-content/themes/your-theme-name/single.php)
I’m using WordPress 2.8.5 (the latest version as of this post)
In the file single.php around line 57 (although this will change from theme to theme) but you’re looking for the logic that displays the post – which goes something like this.
<div> <div id="maincontent-block"> <!-- Blog Content --> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <!-- This code added by Simon Nicol 29/10/2009 --> <?php echo ('Hello there, this text should be at the top of each post'); ?>
For my purpose I just wanted to let my visitors know that my style sheets might be a bit wonky, but on second thoughts I might just put a login box, or RSS feed signup.
All the best