Category Archives: Tutorials

Tutorials relating to blogging, web design and Graphics.

Monetizing WordPress: Going Beyond Ads

Lots of people make money with WordPress.  In fact, a large number of people make their primary income using WordPress as a framework.  Some use WordPress to offer information as a service, while others use the WordPress framework itself to offer a software service (SaaS).  Those folks deserve their own dedicated article, but for today we are focusing on the weekend WordPress warrior.  The people that have day jobs and other primary incomes, supplementing it with their WordPress ventures.

This article is all about how they do it.

Besides ads, there are other ways to monetize your WordPress site.  The following are different strategies, plugins or themes that will help you squeeze a few (or a lot!) dollars from your site.  Keep in mind, the best websites are not overly monetized.  Choose a few strategies that fit with your mission and vision.  Make sure they also fit with the “feel” of  your website and target the right kind of visitors.

1. Affiliate Sales


This is perhaps the close runner up to advertisements.  Maybe it’s even #1.  Ads rely on volume and quality of visitors while affiliate income can grow with smaller numbers.  You still need the right kind of visitors though.  For example, if your site focuses on WordPress themes, people who visit probably aren’t looking to buy premium plugins (and therefore sales generated from your website will be infrequent).

The best affiliate accounts have tiered plans that pay you a small percentage when other people become affiliates.  But these plans are becoming less common.  Another good plan to look for has recurring payments.  Elegant Themes is an example of a program that pays affiliates every time someone you sent them renews their membership.

2. Premium Content

pay wall

If you are a content producer like a blogger, offering extra special content for a select group of visitors can generate some income.  In order to do this, you should have a pay wall installed.  This works best when you already have a large group of dedicated visitors.  It also requires a clear line between what constitutes free content and premium content.  This isn’t absolutely required but helps define your model.  An example could be providing simple tutorials for free, while reserving the complex or detailed tutorials for premium users.

3. Develop a product

wp product

If you’ve got a WordPress related website going, you can create a WordPress related product to sell.  This can be tricky if you’re not ready for success.  We’ve thought about developing a theme here at Pingable but decided not to because we couldn’t provide the level of support customers might need.  Developing a free and premium version of a product is another strategy that pulls in users.  This too requires a level of continues availability that you have to be prepared for.

A product can be something tangible or more virtual.  A good “starter product” might be an ebook or comprehensive guide to something.  This doesn’t require the follow up support of a theme or plugin, but may still generate income if the product is good enough.

BONUS TIP: I am a fan of the bait and switch model.  This isn’t as bad as it sounds.  I believe you should offer a quality product/service/content first, then monetize.  Ever seen a blog with five posts and twenty advertisements?  Looks pathetic, right?  The highest quality sites (read: have fewer ads but charge more for them.  They started with a simple design and really high quality content.  The ads came later.

4. Donations


You wouldn’t think so, but donations can go a long way.  I recently stumbled upon this website, that ONLY uses donations to support their work.  It makes sense that people who use your website frequently and find it valuable will throw you a few dollars as a thank you.  If you are truly providing something useful, and have lots of visitors, the money can really add up.  This plugin will do the trick.

How have you monetized your WordPress site?  I’d like to hear about it.


Useful Security Modifications for WordPress

WordPress is pretty secure, especially when compared to our content management systems.  We’ve put together this handy infographic on WordPress security issues.  This post is an update with some tweaks and plugins that can help tighten security on your WordPress site, and (hopefully) prevent hacking.

1. Keep WordPress Updated!

This is not a hack or a plugin, just common sense.  The WordPress team is constantly working on updates that address security vulnerabilities first.  Everything else comes second.  So updating WordPress with every stable release is critical.

2. Deny Access to wp-content directories

Most of the critical files are kept in these directories, and mean people can execute harmful code by getting into these directories.  Lock them down by adding an .htaccess file within the wp-content directory.  In the file, include:

Order deny,allow
Deny from all
<Files ~ ".(xml|css|jpe?g|png|gif|js)$">
Allow from all

3. Remove the WordPress version from your meta description

This will make it slightly harder for people to identify in which ways your site may be vulnerable based on the version of WordPress you are using.  Of course, since you followed tip #1, you have the latest version.

4. Change your database prefix

The default prefix is wp_ but you can choose anything during install.  This is a trickier process after install.  Change your database prefix to something only you know.  If you’ve already installed WordPress, and you most likely already have, check out this comprehensive tutorial on changing the wp_ database prefix over at WPBeginner.

5. Prevent all directory browsing

The WordPress file structure is so well known, it can be predicted and browsed, and the information found there can demonstrate certain vulnerabilities.  Add this to your .htaccess file:

# directory browsing
Options All -Indexes

6. Deny access to the wp-admin directory

You need access to this directory, but nobody else does.  Limit who can access this directory based on their IP.  If you have a dynamic IP, this is not a permanent fix.  Remember to always backup your .htaccess file before making any changes!

order deny,allow
allow from [enter your ip]
deny from all

7. Password protect the wp-admin directory

As an alternative, or complimentary step, you can password protect this directory through your hosting control panel.  If using cPanel, under the “security” category, choose “password protect directories” and follow the instructions from there.

8. Change your admin username

The default is admin.  For obvious reasons, it is more secure to set a new and secure username and password.  Choose something nobody would guess (not like mydomainadmin).  Along the same lines, choose a super-secure password, something randomly generated.

9. Prevent brute force attacks

Install the Login Security Solution WordPress plugin, compatable above version 3.3.  This plugin has a number of features that make it more difficult (but not impossible) to hack WordPress.  Most notably, the plugin will slow down the login response time if it appears someone is maliciously trying to log in.  It also adds a great deal of features related to password quality, including an option to require a new password every xx days.  Nice.

10. Move the wp-admin directory altogether

The easiest way to do this is with the Better WP Security plugin.  This plugin comes with all sorts of other security related features but it allows you to quickly change the login URL.  Why change it?  Two main reasons.  First, people can navigate to and get instant verification that you’re using WordPress.  And, because of #8, they may even have your username.  If you didn’t set up a strong password, you’ve essentially invited someone to break in.  The plugin also changes the wp-admin and other dashboard links so something with basic WordPress knowledge can’t stroll right in.

What have you done to protect your site?  Let us know in the comments or send us a message through our Facebook page.

Super Helpful WordPress Tutorials

One of my favorite perks of being part of the WordPress family is the constantly fresh content.  Because there are so many creative folks working as part of this community, there is a constant feed of really useful tutorials.  I have gathered some of my favorite, recent WordPress tutorials to help the intermediate to advanced WordPress admin.  They range from simple to complex but all are lead to some sort of time or energy savings.

Note: I haven’t tried all of these tutorials so, as always, backup your WordPress site before trying any significant changes.

How to incorporate QR codes into your WordPress site

Quick Reference or QR codes are frequently used in print media to allow people to visit a particular URL using their phone’s camera.  So why would you need them on a website?  A QR code allows a user to take website content on the go without having to re-navigate to the content.  It’s like a “to-go” box.  Check out the tutorial here.

How to modify the dashboard for your clients

Many of us use WordPress for our own personal use.  And many of us use it for our clients.  I find it the best platform for use with my clients because I can easily train them to update their own website.  Over the years, the WordPress admin has gotten a bit more complicated though, and the simplicity is still too much for some low-tech clients.  This tutorial describes how you can simplify the dashboard even further.  This strategy also prevents clients from messing with things they have no business messing with.  Read it here.

The complete guide to custom post types

Custom Post types are all the rage with premium theme designers.  They make a powerful WordPress site into a “superpower” but allowing custom designs based on the type of content or post type being accessed.  This guide from the ever-reputable Smashing Magazine claims to be the complete guide (until the next version of WordPress anyway).  Get it here.

How to allow your visitors to generate content for you

User-generated content is a dangerous game.  A WordPress admin must walk a fine line in order to solicit quality, original content.  Also, specific measures must be taken in order to ensure the security of your site.  Allowing users to create posts without moderation or proper security opens your WordPress site wide open to hackers.  So tread lightly!  Since WPMU was incorporated into the core WordPress, it allows more options to facilitate a user-fed blog.  This tutorial explains all the different options including posting without registration (not recommended for the reasons mentioned above!)

Using A/B split testing in WordPress

Marketing is critical for the success of any blog.  Especially for those relying on user-numbers to be successful.  A/B split testing, simply put, is the testing of multiple strategies to determine the most effective.  Many advertisers try two different ads and measure which is more successful.  They then test a third, fourth, etc. types of ad against the most successful of the previous test.  This method constantly ratchets up the effectiveness of an ad.  If the original ad out performs the new ad, the old one is used instead of the new one.  Quite simple really.

This tutorial at WordPress Beginner (don’t let their name fool you!) integrates Google Analytics into the equation which provides more data than even more enterprise web teams need.  This tutorial specifically focuses on changing website layout, content or other organization in order to capture more visitors or conversions.  This is a great strategy for even basic users who wish to market their website.

Image courtesy of WPBeginner.
Image courtesy of WPBeginner.

If you have a favorite WordPress tutorial, I’d love to check it out.  Please share it in a comment or send me a message via our Facebook page.  If your tutorial rocks, I’ll consider posting it on Pingable!

WordPress as a Public Relations Tool

Almost every business has (or should have) a public relationships strategy.  Closely integrated with marketing, a public relations strategy addresses how the public perceives the company.  This scales with the business market.  For example, a local pizza shop needs to address how it interacts with the local community while a national corporation needs to be concerned with local communities where it operates as well as the overall public opinion in the marketplace.

What some companies still struggle with, and many have learned the hard way, is that social media and new media are an vital to a good public relations strategy.  For example, I do not go to a restaurant that doesn’t have a website.  Period.  This is not because I want to punish the for being stubborn, but because I only eat out occasionally, and I’m not about to spend my limited restaurant budget on a place who’s menu I have not vetted as appealing.

Any good public relations strategy includes multiple platforms for user interaction.  Gone are the days when a business disseminated information on their product and brand while the consumer blindly accepted it.  Here are the days of the 24-hour news cycle, interactive communications strategy, and here-today-gone-tomorrow businesses that failed to recognize the changing tide.

These examples are perhaps the most poignant example of a business’s public relations strategy dying at the hands of a fool that was given too much authority over the brand through their social media accounts.

Part of a good communications strategy is a steady, professional, interactive blog.  Blogs are no longer plain corporate web-drones, spewing press releases.  They can now be fun, engaging and huge marketing tools.  Some well-executed corporate blogs include:


Zappos, the web’s most popular shoe store, blasts mostly deals and promotions but also funny quips and behind the scenes looks.



Starbucks seems to use their blog platform for social and community messages.  But let’s be real, their widely publicized “responsibility” philosophy is as much a marketing strategy as it is a corporate philanthropy move.


Whole Foods

Whole Foods uses their blog to help consumers use (and buy more of) their products.  A nice double-feature.


The most successful corporate WordPress blogs have the look and feel of a personal weblog, similar to the rants and raves that some CEO’s post.  At the end of the day, the web visitor wants to feel like they got something out of their visit, similar to a visit to a bricks and mortar store.

Good WordPress PR strategy

WordPress can be a powerful tool, used for good or evil.  A solid PR strategy can catapult a business into success, or topple it from the top.  The following tips make up a solid, but not comprehensive, PR strategy when using WordPress.

  1. Respond to consumers.  Comments are worthless unless people respond.  Nothing irks me more than writing to a business and receiving no response.
  2. Be cordial, kind and humble.  In this world, the customer IS always right.  This counts extra in the web world.  I tell my parents that email and social media communications need extra courtesy, more than normal discourse.  What could be a perfectly innocent comment in real life could easily be perceived as angry or rude online.
  3. Be honest.  Applebee‘s took major social media heat after a real life problem moved into the virtual realm.  And the ding-dong running their social media strategy lied, copied/pasted and backtracked in an attempt to get control of the disaster.
  4. Offer value.  As I previously mentioned, corporate blogs that simply distribute boring news and announcements and press releases are worthless.  Blogs should be dynamic platforms for engaging with consumers.  And they should demonstrate a businesses nimble nature, writing about topical issues that relate to their brand.

What is YOUR PR strategy with WordPress?

Time Saving WordPress Shortcode Tricks

One of my favorite features of WordPress is the shortcode trick.  The name says it all, but for those not familiar yet with the magic of shortcodes, they allow you to insert a particular function automatically into a WordPress page or post.  This function can be virtually anything.  From inserting recent posts to displaying a widget to affecting formatting, shortcodes can do it all.  Most premium themes are coming bundled with some shortcodes and it is quickly becoming the hallmark of a quality theme, at least those that are sold in marketplaces like ThemeForest.

From a functional standpoint, shortcodes are located in the theme files or plugin files.  When a particular shortcode is used in the post or page content, it references a longer snippet of code that creates the desired function.  So rather than trying to insert raw PHP into post content, I could write [myshortcode] and it would insert whatever longer snippet is referenced by that shortcode.  Nifty huh?

shortcodesIf you don’t have shortcodes but would like to play around with them, consider the Elegant Shortcodes plugin from Elegant Themes.  It is a standard WordPress plugin that adds the functionality of shortcodes that come with all of Elegant Themes premium themes.  They include buttons, info boxes, toggle boxes, tabs, a slideshow, an image slider, password protected content, columns, social media buttons, tooltips, tables, dropcaps, quotes and more.  Really anything you could need to spice up your site.

But enough about that one plugin.  Because I’ve found shortcodes so useful since they were introduced in version 2.5 that I thought I would push the limits of what they can do and look for some tips, tricks and hacks that extend their usefulness even further.  Disclaimer: I haven’t tried all of these in a live WordPress installation.  As always, backup your site before messing with it.

 1. Add shortcodes to theme files

Shortcodes are so easy to insert in posts and pages.  But what if you want to modify your theme and add a shortcode to it?  I’ve wanted to do this when I’ve wanted shortcode results to be displayed in a sidebar or somewhere else outside of the content area.  Adding a shortcode to the theme is simple.  Just insert this code, obviously replacing [shortcode] with your shortcode name.

<?php echo do_shortcode("[shortcode]"); ?>

Want to use a shortcode within the loop?  Try this:

echo do_shortcode('[shortcode]');

2. The “bloginfo” shortcode

The bloginfo function can display all sorts of handy information about your site which could save you time.  In order to use this function, you can built a very quick shortcode by inserting the following code into your functions.php file.  Thanks to CSS-Tricks for this one.

function digwp_bloginfo_shortcode( $atts ) {
       'key' => '',
   ), $atts));
   return get_bloginfo($key);
add_shortcode('bloginfo', 'digwp_bloginfo_shortcode');

Then you use a shortcode with a parameter to tell the function which data you are looking to display.  Like this:

[bloginfo key='name']

You can also use a shortcode in HTML which can prevent you from having to write long URL’s over and over.  Like this:

<img src="[bloginfo key='template_url']/images/logo.png" alt="[bloginfo key='name'] logo" />

See the full list of info you can grab here, but you can choose from some of these beauties: name, description, wpurl, admin_emai and rss_url.

Note: make sure to switch to the HTML editor when adding a shortcode.  The WordPress WYSIWYG will strip the brackets from your shortcode if you enter them in the visual editor.

3. Allow shortcodes to be used in widget text

If you’re not into coding shortcodes directly into your theme files, but want them in your widget text, you can use this code to add a filter to the widget_text() function which overrides WordPress’ tendency to disallow shortcodes in widget text.

add_filter('widget_text', 'do_shortcode');

What is your favorite technique, trick or tip when working with shortcodes?  How have you used them to make your life easier?  Let us know in the comments below.

How to build a community with WordPress

WordPress is a blog platform.  But much more important than the blogging feature is the community that comes with WordPress.  From a vibrant developer community to an active support community, WordPress is buzzing.  From a bustling designer community to a dynamic content producing community, WordPress is alive.

In a recent post, I wrote about building a social network with WordPress as a foundation.  In this post, I describe what it takes to build a strong community of readers, stakeholders and contributors.  To build a strong community, it takes more than just an invitation to participate.  Big websites have people dedicated to cultivating and managing a community.  But your small WordPress site can have an equally impressive community if you grow it from the ground up.  Here’s how.

Set the stage

Many bloggers are timid about promoting social media or networking sites in order to promote their own.  Can you blame them?  At first glance, telling all of your readers to head over to your Facebook page is like saying “hey! ignore what you’re into on my website and go visit someone else’s”.  But the truth is establishing the right social networking and bookmarking accounts will compliment, not contrast your own efforts.

This post is not about leveraging social media so I won’t digress by describing what this entails.  But give full consideration to establishing a Facebook page, Linkedin group and Youtube Channel.  Not every option is for everyone so consider the type of media and content you are producing and how it would be best disseminated.

Get the right plugins


In order to create a vibrant community through comment discussions, you should consider building on the WordPress core commenting feature.  Disqus is the leader for premium and quasi-premium comment systems.  Disqus adds a great deal of functionality including common sign-in, better moderation control, social sharing options, subscription capability and the coolest part: the ability for users to track all of their comments on other websites from your website.  This is great because people don’t have to leave to be engaged elsewhere.

disqus comments


If you’re like me, you don’t like managing multiple usernames and passwords.  When given the opportunity to log into a website with my Facebook account, I will do so.  As long as I can trust the website won’t abuse that privilege.  There is a free plugin available called Social Login that will allow your visitors to log in using Facebook, Yahoo, Google, LinkedIn, OpenID or some others.  Building a community on your WordPress site is as much about eliminating barriers to participation as it is about the content.

building community with wordpress

Related Content

Social marketing people have long suggested a “related content” plugin that displays similar content below or next to each post.  This is meant to keep people traveling through your site instead of leaving.  But I recommend this feature because it is inherently community-focused.  These plugins look at keywords within each post and recommend posts with similar content.  If I ever click through someone’s site, it is often through this feature.  Keeping people engaged is part of building a community.

Be human

Interactive Posts

Posts can be informational, they can be link bait, they can be junk.  But good posts are high quality, original and informative.  But one thing is missing: interactive.  Posts should include an engagement component in order to build a community.  You can do this by:

  • Asking your readers questions in your posts
  • Including surveys or polls
  • Asking them to continue the discussion in the comments
  • Creating an opportunity to expand on the post

One of the key parts of this strategy is the follow through.  When people email or comment that I missed a resource or should have included something else in my post, I usually include it.  Then I follow up with a comment or return email to thank them for the contribution.

Engage with commentators

When people comment on your content, engage with them.  It’s as simple as that.  If I think nobody is listening, I won’t comment.  An active discussion after a post is not only free, original content but it is interesting.  Half the time I Google something, I’m fed results from a comment discussion or forum.

Also important: be polite and respectful.  Nothing says amateur like a spiraling comment fight.  Keep it civil and thank people repeatedly for their discussion.  Do not engage with haters.

Be generous

Giveaways and contests

People like free things.  By organizing a giveaway or contest, you not only gain new readers but you reinforce the relationships with the ones you already have.  A content shows that the person behind the curtain is there and is attentive.  Organize an event that give your readers something they will really be interested in, related to your content focus.  Often this can be free as I described in this post about ways to promote your WordPress site.  Pingable recently organized a giveaway that was successful not just because we gained new readers and Facebook friends, but people realized we really care about our readers.

giveaways to build community with wordpress

Be consistent

Readers will come back if they have a positive experience, but also if they can expect that same quality experience every time they visit.  In order to be consistent, establish editorial guidelines and delegate someone to keep your site alive any time you have to step away.  Keep the discussion going, don’t respond one day and ignore everything the next.


Conclusion may not be the right word.  How about “next steps”. I would really like to hear from you, this post is just the beginning.  How have you built a community with your WordPress site?  How do you plan on engaging with your readers?

Top ways to promote your WordPress site

Someone once said about blogging: “never before have so many people said so much to so few”.  I find this quote hilarious because it really does capture a lot of blogs quite well.  What makes the internet so powerful is always what makes it so bloated.  The ability to broadcast information instantly and efficiently to as many people as may find the information valuable.  But information that nobody sees is useless.  That’s why a WordPress blogger needs to do more than write, they need to promote.

We all have dreams of content we write going viral, and our blogs gaining instant credibility, being read by millions every day.  But that happens to a tiny fraction of us.  The rest need to work tirelessly to write quality content and distribute it as widely as possible.  Here are some solid, white-hat methods for distributing content and promoting your WordPress site.

1.Write quality content!

I had to insert this one even though it is not a direct “promotional tool”.  I also listed this as the top method for promoting your WordPress site because I believe strongly that writing quality, unique and useful content is the most important step in creating a popular website.  If people find your content useful, they will share it among their network and promote it for you.

2. Guest blogging

This is one of the oldest tricks in the playbook, but it work.  Offer to create quality, unique content for similar websites.  Don’t fill the content with links back to your site, rather just one link in your author byline.  This method goes along with numbers 5 and 7, relating to building relationships with other WordPress sites.

By writing unique content for other websites, you are doing them a favor and building a long term connection that will benefit you over time.  They may offer to return the favor.  In the least, you will garner new readers from their traffic.

3. Promotions and Giveaways

I’ve done this a few times here on Pingable and other WordPress sites I run.  It is easy to set up a promotion and it generally works at building traffic and readers.  One method is to identify a resource you already have, such as a product or service, and give it away to a lucky visitor.  Another method is to partner with a member of the WordPress community, such as a theme producer, and give away someone else’s product.  They benefit with free publicity and the “winner” benefits by getting something for free.  It’s a win-win-win.

I have even done this with physical products on a non-WordPress site I run.  I worked out a deal with a manufacturer of tech accessories to give one of their products to a lucky reader.  People were entered into a drawing by liking my site on Facebook or following on Twitter.  I earned a lot of followers that month!

4. Submit content to social sharing sites

Some websites have sprung up in the last few years that are essentially clones of Digg, or vertical market within that focuses on a specific area such as WordPress.  These sites let you submit links to articles that visitors then vote up (or down) based on usefulness and appeal.  These sites can be useless or incredibly helpful.  Again, your content needs to be good or else your efforts on these websites will be for nothing.  Some examples of social sharing sites include:

5. Build relationships

Why on earth do you need to build a relationship with other (competing) websites?  Because even on the internet, relationships are everything.  Working together, two WordPress admins can boost traffic to both of their sites.  The first example of this is guest posting described above.  But two collaborating admins can also share links, swap ads, trade content, liven the comment discussions and offer tips and feedback.

I have been consistently surprised at the positive response I’ve received when blindly reaching out to webmasters who’s sites I liked.  People are often friendly and approachable, willing to talk about collaborations most of the time.  What types of collaborations?  How about joining forces?  One of the best ways to guarantee success is to combine your assets and time.

6. Offer a unique resource

This one is big.  I once ran a very small WordPress powered site (that I’ve since sold).  I made a couple hundred dollars writing some quality posts for a very popular site.  I took that money, and paid someone to develop a custom theme that I then gave away on my blog.  Not only did this garner new loyal readers, it raised the value of my site so that when the time came to sell, it was worth the normal price plus the value of the custom theme that came with it.

What’s also helpful about this strategy is the fact that people really have to link back to you, giving you credit.  You then become the resource everyone is talking about, instead of being one of the everyone talking about someone else’s resource.  Of course, people will steal the resource and not give you credit.  But those people far outweigh the honest ones.

7. Comment and interact with colleagues

This one is a great way to promote your site.  Let me be clear: this is not about plastering the internet with links to your blog.  This is about generating good, honest discussion.  Many websites allow you to insert a link with your username which is good.  But if you engage in healthy discussion about a topic related to your site, many people could see it and convert to readers.  Again, don’t spam, don’t simply comment for the sake of commenting.  Engaging in a friendly discussion and visitors will follow.

What did I miss?

There are thousands of ways to promote your WordPress site out there, which ones are your favorite?  Leave them in the comments below and I could add them to this post.


Handy WordPress Theme Hacks

WordPress themes are coming with more and more handy features, some you don’t even want.  As things evolve, clever and competitive designers are putting more of the handy features into themes and there becomes less of a need to hack one’s theme to expand functionality.

That being said, there are many theme hacks that are useful for almost all sites.  This is a compilation of handy hacks and tricks meant to streamline your site and add those tiny bits of better functionality.  These are all aimed at the novice to intermediate WordPress admin.  Only basic knowledge of coding and formatting is necessary for these.

But first, an important clarification: the loop.  hacks or plugin code often say something to the effect of “this tag must be within the loop”.  Anything placed in “the loop” will be repeated for each post displayed.  This is the loop:

<?php if(have_posts()) : ?>
<?php while(have_posts()) : the_post(); ?>
// the code inside the loop
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>

Display multiple loops

This can be helpful for customizing the presentation of the first post, or first several posts.  In order to do this, simply create multiple loops and limit which posts are shown in each.  To show just the latest post:

<?php query_posts('showposts=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h3><?php the_title(); ?></h3>
<?php the_content('Read more »'); ?>
Posted on <?php the_time('F jS, Y') ?> in <?php the_category(', '); ?>
<?php endwhile; endif; ?>

The red code shows the key modification to the loop, limiting to just the latest post.

In order to display more posts, say the next 8, you would add a second loop:

<?php query_posts('showposts=9&offset=1'); ?>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<h2><?php the_title(); ?></h2>
Posted on <?php the_time('F jS, Y') ?> in <?php the_category(', '); ?>
<?php endwhile; endif; ?>

The offset parameter causes the theme to skip the first post and start with posts 2-9.  This would result in 9 posts displaying on the front page.  You would use the first loop to format the first post differently, or whatever your intention was.

Conditional Tags

Are my second favorite hack.  This lets you do virtually anything with a theme if the correct parameters are met.  This is handy in a few ways that I will describe.

The simplest version is the is_home conditional tag.  The following code will display markup if the page is the home page.  Note: this is different than is_front_page.  “Home” is the main blog page, and will only work if “latest posts” is the chosen front page display in the reading settings.  is_front_page includes both the blog page or a chosen static front page.  Make sense?

if ( is_home() ) {
   echo 'Will display this text only only the main blog page';

Some variations include:

is_single – for single posts and pages

is_sticky – needs no explanation

is_page – only for page content types

is_page( 5 ) – will display on page id 5 only

is_author( ‘4’ ) – will display if the author is id 4

There are many more applications, see them all in the official WordPress codex.

Custom Fields

My favorite handy WordPress theme hack, custom fields let you streamline entering custom data into posts, and customize how it is displayed via the theme.  The custom field parameters are set below the post content, but you can move them anywhere you’d like in the composition screen.

Start by creating a custom field name/key, and adding a value.  Here’s an example: I want the post title to link outside of my site.  This is the case for showcase or gallery sites that really only aggregate listings but don’t duplicate content with individual posts.  I would create a custom field called “url” and a value for each post would be the URL I want the title to link to.

Next, integrate your theme.  Change this:

<a href="<?php the_permalink(); ?>">
<?php the_title(); ?>

to this:

<a href="<?php echo get_post_meta($post->ID, 'url', true); ?>">
<?php the_title(); ?>

This will change the post title to your custom field “url”.  Pretty nifty huh?

Use Body Class to display custom CSS

Designers often use filters to style a particular page.  For example, using a conditional statement to add a custom CSS class to an element like a menu, widget, etc.  Instead, and perhaps the better way to add custom styling to a specific element is to use a body class.  WordPress loads a particular CSS class depending on the page type, but this is optional.  If not specified, the standard body class will be loaded.  Using this code will specific the body class:

<body <?php body_class($class); ?>>

And here are some common body classes, courtesy of WPBeginner:

.rtl {}
.home {}
.blog {}
.archive {}
.date {}
.search {}
.paged {}
.attachment {}
.error404 {}
.single postid-(id) {}
.attachmentid-(id) {}
.attachment-(mime-type) {}
.author {}
.author-(user_nicename) {}
.category {}
.category-(slug) {}
.tag {}
.tag-(slug) {}
.page-parent {}
.page-child parent-pageid-(id) {}
.page-template page-template-(template file name) {}
.search-results {}
.search-no-results {}
.logged-in {}
.paged-(page number) {}
.single-paged-(page number) {}
.page-paged-(page number) {}
.category-paged-(page number) {}
.tag-paged-(page number) {}
.date-paged-(page number) {}
.author-paged-(page number) {}
.search-paged-(page number) {}

Were these handy tricks helpful?  Is there one I should have included?  Please share it in the comments below.

The Complete Guide to WordPress Editing: Part 4

Whether you’re completely new or have been blogging for a while now, you’re probably still not using everything available to you as a blogger on WordPress. It took me a few years of blogging and developing plugins before I really started getting it. I’m going to save you time and write up what I’ve learned here.

This complete series on writing and editing posts with WordPress will cover…

  1. Customizing Your Interface & Getting to Know Permalinks
  2. Mastering Text Formatting For Your Posts
  3. Leveraging Post Scheduling & Post States
  4. How to Make Private and Password Protected Posts
  5. How to Enable and Disable Comments & Understanding Trackbacks
  6. Finding and Using Theme-Specific Options

Let’s say you’re running a public blog — but suddenly there’s a post that you only want to share with certain people, or even just have it there for yourself. It looks like it’s time to explore the Private and Password Protected options of the WordPress editor.

VIP Members, only. What’s the secret?

This is extremely simple.

Have you ever noticed the tiny little “Visibility” section of your Publishing options? Yeah, neither did I. It’s one of those settings you don’t even realize is there until you’ve scoured all through the WordPress admin seeking the answer.

Thankfully, I’m here to tell you now: If you click “Edit”, a whole new world of options will be opened to you.

Simply select “Password Protected”, which will offer you a text field. Enter your password there, and save.

That’s it! Now, whenever a visitor sees this post, they need to enter the super secret password. This can be really useful if you want to share a private page through a newsletter or email to your top readers.

Don’t look at me, I haven’t dressed yet!

Let’s say you want to have a technically Published post, but only want your Administrators and Editors to see it.

Enter the Private Post.

In that same section from before — the Visibility one — you’ll also see an option for Private. Just pick that before you publish, and BAM. You’re ready for private action.

That’s it. With this power, you can set up example formatting and content for your other authors, or as a reminder to yourself of your standards and ideals. Use your imagination!

The Complete Guide to WordPress Editing: Part 3

Whether you’re completely new or have been blogging for a while now, you’re probably still not using everything available to you as a blogger on WordPress. It took me a few years of blogging and developing plugins before I really started getting it. I’m going to save you time and write up what I’ve learned here.

This complete series on writing and editing posts with WordPress will cover…

  1. Customizing Your Interface & Getting to Know Permalinks
  2. Mastering Text Formatting For Your Posts
  3. Leveraging Post Scheduling & Post States
  4. How to Make Private and Password Protected Posts
  5. How to Enable and Disable Comments & Understanding Trackbacks
  6. Finding and Using Theme-Specific Options

Did you know that you can sort your posts based on where you are in the process of editing them? It’s pretty neat, and it’s a feature I never understood until recently. Oh, and you can also post to the future.

Drafts, Reviews, Published, oh my!

When you’re writing a post in WordPress, you have a few options when you save. You can “Save Draft”, “Preview” and “Publish”.

But did you know that you can change the game entirely by saving your post as Pending Review?

There’s a subtle icon that allows you to change from Draft, to Pending Review.

So what?

Well this means that once you’ve saved an idea, jotted down your thoughts, and written up a draft… you can go through something we like to call Editing.

Once you’ve edited it, it’s almost ready for publishing — but maybe it’s not the right time to publish. Maybe you want to save it for yourself to reread in a day or two with fresh eyes. Maybe you’ve got a secondary editor who’s going to look at it.

So you save it as Pending Review.

This means that you can now access it under an entirely different menu than the default screen of your Posts page.

Since there’s not a lot of automatic Posts filtering in the WordPress admin, this can be incredibly useful.

You’ll need to hit 88mph for this one.

Let’s say you’re about to go on vacation for the week.

Your readers never need to know — simply write up your posts (maybe use that Pending Review status while you’re working) and use the power of publishing to the future to make your blog run automatically.

Just use the date tool by hitting “Edit” after Publish immediately in the Publish box, and the Publish button should switch to saying “Schedule”.

Schedule away, my friends.