Chapter Quotes for WordPress Posts Revisited

chapter quotesA few months ago, I wrote a post about adding chapter quotes to your WordPress posts. Here I’ll show you another way to add them to posts without them showing up outside of the single-post page, and this method doesn’t require any changes to your theme files.

Last week, I released a WordPress plugin called Conditional Shortcodes. The plugin gives you shortcodes to let you include or exclude parts of you post depending on the context in which it is being shown.

You see it coming, right? Yes, there is a shortcode for including things only when just a single post is being shown. It is the [is_single] shortcode and you could use it for chapter quotes like so:

[read more]

Single-Letter Posts? A Confluence of Mistakes

There is a rare problem that shows up with some WordPress themes. Switch to them and, suddenly, every post shows up as just the first letter. And the fun part is that, with some of the themes, it only happens to some sites. Everyone else is fine, but you get single-letter posts.

ffdigital asked about it in a WordPress support forum a few months ago. Simba ran into it with the theme “Cellar Heat” and asked about it on the theme’s site. When Smashing Magazine released “Smashing Theme”, the problem came up. None of these discussions produced a solution.

The problem arises when a theme names a variable $pages. WordPress itself uses this same variable name in a global context, and it gets confused if the theme stomps the value. With some themes, only certain sites would stomp the variable, so only those would have problems. With “Cellar Heat”, for example, everything is fine if you only have posts, but no pages. Add a page and everything drops to one letter. Get rid of it and everything comes back. It’s a WordPress magic trick.

[read more]

Adding Code Snippets to WordPress Posts

snippet of code If you are a programmer or a web developer, you deal with code. It is part and parcel of the job. And a time may come when you want to share some of it with your readers by putting it in a post. Perhaps your are showing a social ranking algorithm written in Python. Maybe you are demonstrating an HTML idiom. You could even be writing something as unusual as a PHP or WordPress tutorial! In any one of these cases, you want an easy way to display the code.

Of course, there is one very simple way. Just paste it into the visual editor (not the HTML editor) and it will do any necessary conversion of angle brackets, ampersands, etc. into HTML entities. If WordPress thinks it is HTML code, it will even wrap it in pre tags for you. Observe:

<div id="search">
  <form id="searchform" method="GET" action="/index.php">
    <input type="text" name="s" id="s" size="16"  class="inputtext" />
    <input type="submit" value="Search" class="button" />
  </form>
</div>

[read more]

Adding Chapter Quotes to Your WordPress Posts

chapter quotesYou know how some books have little quasi-relevant quotes at the start of each chapter? They are called chapter quotes and then can be a nice addition to some posts. Let’s see how we can do this easily in WordPress.

Of course, we could just toss the quote and relevant markup in the top of our post body. This would work, but is not the best method. The biggest problem is that the quote will appear on any page that includes an excerpt from our post. This means it will might there on the home page, the category page, the archive page, the tag pages, search results, and even in your RSS feeds! No matter how cool or appropriate the quote is, we would probably rather show off a bit of our text instead, no?

[read more]

HostMonster for Great Unlimited Web Hosting Hundreds of template and themes from $35