Like the blog? Get the book »

Posts tagged: tips

Archive page 5 of 6
Next/Previous Post Navigation Outside of the WordPress Loop

Next/Previous Post Navigation Outside of the WordPress Loop

WordPress provides several navigational template tags to make it easy for visitors to surf your pages. There are basically two different types of template tags used for chronological post navigation:

Remove/Replace Content from the WordPress Database

Remove/Replace Content from the WordPress Database

A useful tool to have in in your WordPress toolbelt is the ability to quickly and easily search for, find, and replace specific strings of text directly from the MySQL database. We can do this by entering SQL queries either directly or through one of those handy interface applications like phpMyAdmin, which seems like one of the most prevalent PHP applications on servers today.

Display Separate Counts for Comments, Pingbacks and Trackbacks

Display Separate Counts for Comments, Pingbacks and Trackbacks

In WordPress, there are three ways to respond to a post: you can leave a comment, leave a trackback, or just link to the post to create a pingback. When displaying all of the responses to your posts, it’s a good idea to separate the comments from the pingbacks and trackbacks. Uninterrupted comment threads are a pleasure to read, as are well-styled lists of pingbacks. This is an excellent way to improve the usability and stylishness of your comment areas.

Remove Private/Protected from Post Titles

Remove Private/Protected from Post Titles

I had the situation come up where I need a password-protected post in WordPress. Of course that is super easy in WordPress, you can set up a password for it right in the “Publish” box before publishing. But by default, WordPress appends “Protected: ” to the front of the post title, before and after the password has been entered. I didn’t like that, and thought that the password box was clue enough that the material was password protected.

WordPress Tip: Remove nofollow Attributes from Post Content

WordPress Tip: Remove nofollow Attributes from Post Content

If you have posts that include the nofollow attribute on links, you may at some point decide to remove them. By default, WordPress doesn’t insert nofollow attributes in post content, but there are a variety of plugins that will insert nofollow into all links in post content.

Or perhaps you have been manually adding nofollow tags to your post links for SEO purposes. Regardless of how they got there, it’s very easy to clean things up and remove all nofollow attributes from post content.

Include the Category ID via post_class

Include the Category ID via post_class

The default output for WordPress’ post_class template tag includes class names for just about every type of page view imaginable:

WordPress “more” Tag Tricks

WordPress “more” Tag Tricks

Everyone who has been using WordPress for any length of time should be familiar with the good ol’ <!--more--> tag. When you are writing a post, inserting the <!--more--> tag within the post text will create an excerpt out of any text/markup that precedes it. The post will then show the default “more…” link that readers may click to view the entire post. When the more tag is used, the post’s excerpt will be displayed on all non-single views, such as category, tag, and archive views; the entire post content will only be displayed on single-post views. Let’s look at a quick example..

How to Develop WordPress Themes Behind the Scenes

How to Develop WordPress Themes Behind the Scenes

A reader recently asked about how to develop a theme on a live site such that:

  • All visitors will see the current theme
  • Only the designer will see the new theme
  • All site plugins will work with the new theme
  • Smooth transition between old and new theme at launch

These are the main concerns, but there are a few other details that need addressed to ensure smooth theme development on a live site. Let’s take a look at how to achieve these goals and effectively develop themes behind the scenes.

Two Ways to Limit the Number of Posts without a Plugin

Two Ways to Limit the Number of Posts without a Plugin

Let’s say your blog is set to display ten posts per page, as specified via the WordPress Admin under Settings ▸ Reading. Once set, ten posts will appear on your home page, archive pages, search results, and so on. In other words, if it isn’t a single-view page or an actual “page” page, you’re gonna get ten posts per page. It’s a global setting.

But what if you want to display different numbers of posts for different types of page views? For example, instead of showing just ten posts on your search-results pages, you may want to show a whole bunch, like maybe fifty or something. Perhaps you would also like to limit the number of posts displayed on your category archives to only five.

Remove Title from Blogroll

Remove Title from Blogroll

Typically when you use one of WordPress functions to output a list of “stuff” from WordPress, you can pass a parameter to eliminate the “title” that WordPress likes to put in there by default. For example, with wp_list_categories you pass along “title_li=” with nothing after the equals sign to remove the title that normally accompanies the output. With the function to output links (e.g. blogroll), you use the function wp_list_bookmarks, but unfortunately using that same parameter the same way is ineffective at removing the title.

The Difference Between is_singular() and is_single()

The Difference Between is_singular() and is_single()

With WordPress, there are various distinct types of page views. For example, there are category-archive views, tag-archive views, author-archive views, date-archive views, single-post views, single-page views, and so forth. And of course you know that you can target single-post views in your theme template with the conditional tag, is_single():

Multiple the_date() Functions Return Empty Date

Multiple the_date() Functions Return Empty Date

Inside the loop, if you use the function the_date() to display the date the post was published, you may run into trouble. Specifically, if there are two posts published on the same day, the second one will return nothing for a date.

Five Ways to Change Your WordPress Password

Five Ways to Change Your WordPress Password

With the dynamic nature of WordPress, creating, using, and maintaining strong passwords is critical. Passwords help keep the good guys in and the bad guys out, enabling you to run a safe, secure WordPress-powered website. In this DiW tutorial, we’re going to show you how to change your WordPress password in virtually any scenario: logged in, locked out, and everything in between.

Clean Up Empty Elements with CSS 3

Clean Up Empty Elements with CSS 3

By default, WordPress wraps HTML comments with paragraph tags:

<p><!-- --></p>

WordPress also employs various template tags that may, in certain situations, result in empty HTML elements such as paragraphs tags:

© 2009–2024 Digging Into WordPress Powered by WordPress Monzilla Media shapeSpace