WP plugin: Welcome Visitor!
Hoho, another WordPress 2 plugin: Welcome Visitor! lets you add a welcome message on the sidebar or introductory note to the home page or whatever and wherever the heck you like. You edit the message from within the WordPress administration pages. The plugin sports a healthy selection of customizable options—for a simple message plugin, that is.
Installing Welcome Visitor! requires setting up a subdirectory for it (which needs to be:
welcome-visitor) in your wp-content/plugins/ directory. This is because the plugin comes in two files, one being the administration page or what I call the welcome message editor. So either extract ‘welcome-visitor.php’ and ‘welcome-visitor-editor.php’ from the zip file after downloading it, set up the ‘welcome-visitor’ subdirectory on your host site, and upload the files to it, or unzip the welcome-visitor folder with the two files already in it and put that up in wp/contents/plugins/. However you do it, your directory tree for Welcome Visitor! should look just so:
/wp-content /plugins /welcome-visitor + welcome-visitor.php + welcome-visitor-editor.php
Once the plugin is installed and activated under Plugins, go to Options and you’ll find a Welcome subpanel tab. Click it to access the welcome message editor.
That cropped thumbnail above links to a full image of the welcome message editor. If it looks a little familiar, that’s because it uses some bits from the basic (non-ahem-WYSIWYG) WordPress post editor. Making use of pre-existing code in WordPress helped keep the plugin light, but bear in mind your welcome message is not like a regular blog post, and some things won’t work as you may expect. For example, the ‘more’ quicktag (
<!--more-->) is useless in the message content. Don’t say I didn’t warn you…
The following describe the (fully working) bits in the welcome message editor:
- Title and Content fields
- If these aren’t self-explanatory, well then GACK!
- Message Status
- Status of message on your blog: ‘Published,’ ‘Title only,’ ‘Content only’ or ‘Private.’ Setting to Title or Content only displays one or the other (guess which is which) and bypasses the HTML Style option (see next). Private is just what you’d think—the message is not displayed publically.
- HTML Style
- When message status is ‘Published’ you have the option to display the message in an unordered list (<ul><li> …), or within a <div> element. Setting to unordered list inserts message content in a nested or child list to the title. With either setting the title is placed in a <h2> header. Also, both the initial <ul> and the <div> element are given the css class
welcome-visitorwhich you can use to style the message.
- Display Options
- On home page only: Display message only when on your home blog page. To registered users: Logged in users will see the message. Use content filtering: Run WordPress’ built-in text formatting filters on message title and content.
- Update Message (button)
- I hope this is another obvious bit.
Now that you have your message set up as you like, you need a way to display it on your blog. That’s where the
welcome_visitor() function or template tag comes in:
<?php welcome_visitor('before', 'after'); ?>
- (string) HTML or other text which is displayed before the message. There is no default.
- (string) HTML or other text which is displayed after the message. There is no default.
<?php welcome_visitor(); ?>
This is the default usage and is recommended when displaying both title and content (‘Published’) from your message.
<?php welcome_visitor('<div class="hello">', '</div>'); ?>
This places the message in a <div> with a custom css class of