Add something to post title based on post type

Recently, I was working on a WordPress install employing several custom post types to handle two separate “blogs” within a single site. The site used normal ‘posts’ to handle articles and the client wanted to append the word “BLOG” to the beginning of blog posts’ titles only.

Using the Codex I slapped something together rather easily.

Using the following snippet, I built a simple if statement to test for blog posts, and if not, to render the_title() minus any extra text.

// First test for the post type(s)
<?php global $post
if (get_post_type($post) == 'post_type_1') || get_post_type($post) == 'post_type_2') { ?>
// IF either test registers true, then set the $before parameter in this format: the_title($before, $after);
<h1><a href="<?php the_permalink(); ?>"><?php the_title('BLOG: ', ''); ?></a></h1>
// IF not, then display as normal
<?php } else { ?>
<h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
// Close the IF statement
<?php } ?>

Using this example, posts that register as true would display like this:

BLOG: The post title

Append ‘Read More’ to the end of the_excerpt()

This snippet, when added to your theme’s functions.php file, will allow you to append ‘… Read More’ or any other text to the end of your excerpts. Creates a more streamlined look.

<br />
function excerpt_readmore($more) {<br />
	return '... &lt;a href=&quot;'. get_permalink($post-&gt;ID) . '&quot; class=&quot;readmore&quot;&gt;' . 'Read More' . '&lt;/a&gt;';<br />
}<br />
add_filter('excerpt_more', 'excerpt_readmore');<br />

Source: WPSnipp.com

Oh the places you’ll go … on the Internet

Photo by Flickr/James Cridland. Used with permission under Creative Commons License.

Sometimes I just reflect on what access and ease the Internet has brought to people’s everyday lives.

Tonight alone, I ordered books on Amazon, opted-out of pre-screened credit card offers for 5 years, window shopped for Mother’s Day and applied for a Tax ID number. All from the comfort of my computer chair.

I’ve heard the argument that the Internet has made my generation lazy (see: Generation Y), but I think it actually makes us more productive. If you think about it, we’re able to accomplish quite a bit more with a few taps on the keyboard or clicks on a mouse than was ever possible in the past. Heck, now people are walking, driving, biking, running, exercising even camping while they’re hooked into the Internet. That screams of productivity (not to mention lunacy).

There’s never been a doubt that the Internet affords us with many new and ever-changing luxuries. But I sometimes think it’s fun to marvel at what life might’ve been like 50 years earlier. Would have it been slower? More productive? Would we have had more face-to-face interaction and less static clutter?

What do you think? Let me know in the comments.