Showing stuff only on your “individual” archive pages
I’m so used to the way MT works - switching to a different system is taking a little getting used to. (I told Matt that I need MT Rehab) ;o)
In any case - if you want something to show up only on a page where one post is displayed, wrap it in this code:
May 22nd, 2004 at 12:54 am
Nice tip.
May 22nd, 2004 at 9:52 am
Who is photo matt?
May 23rd, 2004 at 6:27 am
PhotoMatt is the “handle” of Matt, the original author of WordPress (which is, itself, not an original work… but let’s not get into semantics).
I didn’t know about the $single trick… I’ve been using $name, which is true if you are viewing a single post (at least, I’m pretty sure it works the same as single… it has so far).
Here are a few other useful variables. If you’re wondering where I found these, I just looked at the .htaccess rewrite rules.
$submit == ‘Search’ (true if you come from a search and there were either 0 matches, or more than 1 match)
$year will be set if the year is set
$monthnum will be set if the month is set
$day will be set if the day is set
$name will be set if the post name is set
$posts will be set if posts are going to be displayed…
$page will be set if you are viewing a specific page of a post
I’ve used this to generate an H2 according to what you are seeing. You can combine these to figure it out.
Here is what I am currently using on my test blog. $pagetitle is the variable I use to display the H2 as well as part of the TITLE:
if($submit == ‘Search’){
$pagetitle = ‘Search Results’;
} elseif (!$submit && !$posts) {
$pagetitle = ‘No Entries Found’;
} elseif (!$submit && !$year && !$monthnum && !$day && !$name && $posts){
$pagetitle = ‘Tempus Fugit Blog’;
} elseif (!$submit && $year && $posts && !$name){
$pagetitle = ‘Archives ‘ . wp_title(’ยป’,FALSE);
} elseif ($name && $posts){
$pagetitle = wp_title(”,FALSE);
}
May 23rd, 2004 at 7:47 pm
Scriptygoddess’ Jennifer is learning WordPress in perparation for a migration of her well-known DIY weblog. In the process, she’s unearthing and sharing lots of great information and has just come out with her first WP plugin…
May 31st, 2004 at 5:35 pm
A slew of WP bookmarks, plugins, etc. as seen on Scriptygoddess:
July 30th, 2004 at 1:20 pm
Thanks A LOT. I’ve used the ‘if single’ before, but the code with a “!” before the “$” — there really is almost poetry to all this code stuff.
PHP is awesome.
WordPress is awesome.
scriptygoddess is awesome.
January 17th, 2005 at 1:37 pm
Thanks for this - just what I was after. I’ve switched from blogger and miss the tags!