Archive for the ‘WordPress Help’ Category

Can I schedule WordPress to take down a post?

Everybody knows you can schedule WordPress to put a post up on a specific date but is it possible to schedule WordPress to take down a post on a specific day?

Of course it is but you’ll need to know a little PHP and understand how WordPress works.

Setting up your post for a scheduled takedown

First, you’ll need to add a custom field to your WordPress post. There are a couple ways to do this, the easiest is to add a custom field with the name “takedown” and the date you want WordPress to remove it in the Value field. Technically, the name isn’t important (nor is the date format) if you know what you’re doing but let’s try to work with these two standards for now.

  1. Set the Custom Field Name to takedown
  2. Set the Value of the Custom Field to 2010-05-01 (year-month-day)

Now save your post and let’s take a look at the next step.

Detecting the current date

PHP allows us to fetch the current date using the date() function and using some formatting options we can return the value of the date based on the format we need which is date(‘Y-m-d’);. If you add the code <?php date(‘Y-m-d’);> after the very last line of your footer file, you’ll see todays date appear at the bottom of your website.

Now let’s make sure to remove it from the last line and work on comparing the date instead.

Comparing the current date

Now that we know now the actual date, we need to know what day we want the website to stop showing our post. For this, we need to fetch the value stored in takedown using PHP:

$takedown = trim(get_post_meta($post->ID, ‘takedown’, true));
Now the variable $takedown has the value stored in the custom field takedown, which is great as long as there was a value there. To test if takedown has a value let’s add a quick check:
$takedown = trim(get_post_meta($post->ID, ‘takedown’, true));
if (strlen($takedown)==10) {
// your code here
}

For some reason, even if the value of the variable is not found WordPress assigned something too it so instead of using isset() or testing for NULL, I’ve found the safest thing to do is check the string length. Since we know the only variable that is valid will be a YYYY-MM-DD format, testing for a ten character string will ensure we’re on the right track. You could also use checkdate() if you’re server supports it.

Finally, I compare the two dates using the code:

if ($date(‘Y-m-d’) >= $takedown) { //yourcodehere;}

Deleting the post

There are a couple ways in WordPress to change the status of a post or delete it outright, in my case I simply want to convert posts from Published (which means they’re live) to Pending (for my review) so that I can manually delete the posts later if I want.

To do this, we will make use of the WordPress function wp_update_post() like so:

$my_post = array();
$my_post['ID'] = $post->ID;
$my_post['post_status'] = ‘pending’;
wp_update_post($my_post);

This code simply tells WordPress to update the current post and set the status to pending which will convert the post from live to hidden.

If you want to completely delete the post on a schedule, you can do so using the wp_delete_post() function instead of my code above.

The final code

Here’s the full code assembled for you, to make it work you should place it in the single.php file just below the final line of code on your website. It is important to note that this code will only activate after the takedown date, when the specific post is viewed so technically, if a page is to be taken down on the 1st of May but nobody visits until the 10th, it will still be live until the 10th.

$takedown = trim(get_post_meta($post->ID, ‘takedown’, true));
if (strlen($takedown)==10) {
if ($date(‘Y-m-d’) >= $takedown) {
$my_post = array();
$my_post['ID'] = $post->ID;
$my_post['post_status'] = ‘pending’;
wp_update_post($my_post);
}
}

Help my WordPress was Hacked! Now What?

First off, don’t panic. That might seem like simple advice or even bad advice but after your website was hacked, the last thing you want to do is panic or try doing this too quickly.

Step One when dealing with a hack is to determine where that hack is.

When I’m called in to help get a hacked website back together, the first thing that I do is disable all the plugins and see if the vandalism goes away. If it does, the hack is in one of the plugins and I simple reactivate them one at a time until I find the culprit.

If it’s not in the plugins, I download a fresh theme from WordPress.org and install it on my website, this allows me to see if the hack is in my theme files. If it is, simply reinstalling my theme will solve the problem.

Using a tool like phpMyAdmin, I scan the database for keywords and common phrases which might point to a database insertion.

Finally, I test the WordPress files themselves. A lot of hackers attach their rubbish to the core WordPress files these days, to clean them up I simply replace them all with a fresh install.

What to do next?

If you suspect your website has been the victim of a hack, the most important thing to do is replace all your current usernames and passwords with clean ones.  Make sure to include:

  1. FTP & Hosting Control Panel
  2. WordPress Admin
  3. Database Connectivity

Afterwards, ensure you’ve deleted all non essential user accounts in WordPress and be sure to follow my guide to securing WordPress.

Securing WordPress against itself

As many bloggers have been learning lately, WordPress has a ton of major security holes being exploited by evil doers but because of the open nature of the tool, these exploits vary dramatically depending upon which version of the tool you’re using so one of the first tips we give WordPress blog owners is to remove the WordPress version number from your template file, this is pretty simple thing to do simply by opening the header.php file and searching for the line of HTML with your file which looks something like:

[source lang="html"]<meta name="generator" content="WordPress <?php bloginfo(‘version’); ?>" /> <!– leave this for stats –>[/source]

Unfortunately, this isn’t just good for stats … it’s great for hackers because it tells then exactly what version of WordPress you’re using which allows them to search the net for hacks specific to your version of WordPress. Unfortunately, as of version 2.5 the people at WordPress don’t simply allow you to remove this piece of code from your theme and forcibly “inject” the damning meta tag into your theme using the wp_head(); function which is required to make WordPress work.

There is luckily a fix, but it requires users to edit yet another file in their template directory. To truly remove the code, you’ll need to open the functions.php file and add the code:

[source lang="php"]remove_action(‘wp_head’, ‘wp_generator’); [/source]

What’s Wrong with WordPress?

There’s a giant pink elephant in the WordPress forum that nobody seems to be talking about and it’s been staring at my peanuts for the past few weeks, so let’s take a moment to ask ourselves how safe the platform really is.

WordPress, for those who don’t know is a blogging platform turned website manager which makes it fantastically easy to build, deploy and manage websites. It’s the best platform on the market for doing this, and it’s free. That’s a pretty powerful endorsement right? Well, it’s true … except … it the past few months the people who run WordPress and are responsible for it have been getting sloppy. Let’s take a look at some of the recent security holes.

Security Holes

The 2.8.4 release this weekend was due to a newly discovered hole in WordPress. In fact, the whole (which seems to have appeared in 2.8) was so big, it allows anybody with even a basic understanding of web technology to reset your admin password whenever they want. When 2.8.3 was released on the 3rd of August, it was to fix security flaws overlooked in the 2.8.2 release from July 20th. In fact, every release since 2.8 has been to fix major security flaws in the core WordPress application. Here’s how WordPress describes their 2.8.1 upgrade:

WordPress 2.8.1 fixes many bugs and tightens security for plugin administration pages. Core Security Technologies notified us that admin pages added by certain plugins could be viewed by unprivileged users, resulting in information being leaked [emphasis added]. Not all plugins are vulnerable to this problem, but we advise upgrading to 2.8.1 to be safe.

If you think I’m being tough on the people at WordPress, take a moment and read the release reports on WordPress.org, it shows nearly three months of security blunders by the world’s most popular package and if you think that you’re immune, think again. In March, Ashley Morgan who runs Upstart Blogger was the victim of a cyber attack, in June my website was hacked and trashed by somebody promoting links to flu vaccines and earlier that month we suffered hacks on both Tinker Priest Media and my partner’s website BavotaSan.

Ashley’s advice is strong, make sure you update your backups daily and always download the latest security updates from WordPress, especially when they’re released on weekends. Take my friend Chris’s advice and remove reference to your WordPress version, install some basic security on your WordPress blog and always remember that there are people out there who want to hack your site.

5 Steps to Building an Autoblog

autoblogging 5 Steps to Building an Autoblog image

Autoblogging is the process of automating blog’s for your business, while some in the industry make be critical of the process there are actually a number of cases where autoblogging makes perfect sense such as a news relay services, real estate agents or even recipe or automotive websites. At it’s most basic level, autoblogging is about taking common repetitive tasks and making them easier for website owners.

For example, a real estate website could automatically pull postings from their local MLS listing service and create effective web posts on a realtors blog about each properly by listing information and pictures for visitors, this type of auto blogging is fairly common in the industry and saves agents countless hours of copy and pasting listing details from other websites.

Let’s take a look at how to run an effective auto blogging package, it takes a little experience and technical knowledge but these may be easily overcome by hiring web professionals such as myself for the more complicated parts of the process.

Install WordPress

Step one of course is to install WordPress, a great and flexible blogging package which happens to be free. You can download WordPress directly and install it on your web host of if you’re less technical you can setup your hosting with BlueHost and use their automated process to easily install WordPress with a quick click of your mouse.

Install Appropriate Plugins

Plugins are add ons to WordPress, they’re like super powered steroids that make WordPress do extra stuff. In this case, you’ll need to download and install FeedWordPress to make WordPress import RSS feeds from around the Internet.

What’s an RSS feed? Well simply put, it’s geek speak. RSS feeds are used to let one computer or software program talk to another, basically it’s a specially formated file that tells one website about the content of another website. You’ll need to use it to automatically pull content from one website to display on other.

Now, to make sure you’re really cutting down on your workload, there are a few more plugins that you’ll need. See, FeedWordPress will fetch thousands of posts … some are duplicates and many need proper keywords etc. so lets add a couple awesome plugins to make your life a little easier.

WP Auto Tagger will add keywords to each post automatically, this helps cut down the work you’ll have to do to each post.

Delete Duplicate Posts is a quick way to make sure you don’t have duplicate posts in your database.

Setup Your Feeds

Now that you have your blog setup and running, you’ll need to add feeds from popular sources to automatically populate your blog. For example, you may wish to add a feed from Google for blog posts featuring my name. To do this, let’s search Google Blog for Christopher Ross and take a look at the results. On the left hand column, we see a link for RSS. This link offers us the ability to copy and paste the link http://blogsearch.google.com/blogsearch_feeds?hl=en&client=safari&oe=UTF-8&um=1&q=%22Christopher+Ross%22&ie=utf-8&num=10&output=rss into FeedWordPress. Once this is done, your website will scan the blogshere on a schedule, looking for all new posts about Christopher Ross. You can do the same with Google News, to ensure you always know what’s happening.

Manage Posts

When you setup FeedWordPress it asks if you’d like posts to be held for moderation or posted, it’s best to always hold posts for moderation while you’re getting used to the system and make notes of things you need to delete or edit before they go live.

Advance WordPress users will also be able to build special functions into their websites to automate complex parts of the process. For example, I use the CRON services on BlueHost to automatically run a series of scripts on many websites, which scans newly added posts for content, URL’s and items to skip or delete. If you don’t have access to CRON services, the WordPress plugin U-Cron will do a similar service for you.

Common Corrections

My scripts for example, run a simple WordPress function every 15 minutes:

[source lang="php"]$wpdb->query("UPDATE `www_greatchefs_com`.`wp_posts` SET `post_date` = ‘".date(‘Y-m-d H:i:s’)."’,
`post_date_gmt` = ‘".date(‘Y-m-d H:i:s’)."’,
`post_modified` = ‘".date(‘Y-m-d H:i:s’)."’,
`post_modified_gmt` = ‘".date(‘Y-m-d H:i:s’)."’ WHERE `post_date` < ‘2000-01-01 00:00:00′;
");
[/source]

This simple script scans the WordPress database for any post with a date prior to January 1st, 2000 and automatically changes it to the current date. This saves me hours of manually updating posts and makes posting to client websites dramatically faster.

After my scripts have tested for and corrected the majority of minor, common issues I automatically move the post from Pending to Draft which indicates the post is ready for me to review and if I want, post it live.

Approval

The final step of auto blogging and one that I believe is often overlooked is the final approval of an article. Personally, I believe it is critical that people (not machines) do a final scan of each article being posted and ensure it is accurate, maybe this isn’t true auto blogging but it’s impossible for robots to ensure everything is right so a quick scan of the article will ensure that you’re sharing the right information with your target audience.

Who is Auto Blogging Right For?

There are a lot of industries that autoblogging simply wouldn’t work for. For example, I would never want to automate my website here to scan for WordPress articles but I do believe that scanning trusted data sources and automatically processing listings for car dealerships, financial reports, real estate, news services, syndicated news etc. is a wonderful use of RSS and auto blogging technology.

Shameless self promotion – If you’re thinking about automating your online presence, why not give me a call or drop me an email and I can help you make the best choices for your blog.

10 WordPress Plugins I Couldn’t Run a Site Without

Before I give you my real list, let me tell you that there are some basics that don’t even deserve to make this list because if you’re running a blog without them, you’re simply working too hard. Plugins like Askimet, WP Lockdown, Theme Switcher, WordPress.com stats, the WordPress.com stats smiley remover and WordPress Database Backup.

Delete Duplicate Posts WordPress Plugin

Simply put, this plugin does exactly what it’s name implies. It gives web masters like me the opporunity to quickly scan tens of thousands of postings in databases to ensure there are no duplicates. It’s wonderfully powerful when you have a thousands of feeds to maintain, and only a few hours to do it in. It also happens to be from my close friend, Montreal web designer Christopher Bavota.

WP Auto Tagger

Oh man … I can not stress what a dream this plugin is. Tags are like keys to SEO gold, they’re one of the few things that a blog owner can do well and immediately see amazing results in the search engines but they’re such a pain in the ass to write. Basically a tag is what your article is about, but in popular single words and catch phrases. What WP Auto Tagger does is great, it breaks down your article and suggests the best tags, automatically. That’s a huge time saver.

Syntax Highlighter

This bad bay is the Jonas brothers of WordPress plugins. Sure it’s fairly pointless and a text editor could do the same job but when it comes to saving time (and money) it’s brilliant. What it does is takes a bunch of rough gobbly gook code like this:

$rss = fetch_rss( $url );
$pcount = 0;
$storycount = 0;
$textdate = date(“F jS”, mktime(0, 0, 0, str_pad($month, 2, “0″, STR_PAD_LEFT), str_pad($day, 2, “0″, STR_PAD_LEFT), $year));

echo $textdate;
foreach ($rss->items as $item) {

if (!$first) {$title = $item['title'];$first=1;

$content .= “<h3><a href=’”.$item['link'].”‘ title=’”.$item['title'].”‘>”.$item['title'].”</a></h3>”;
$content .= “<p>”;

if ($item['link_enclosure']) {
$content .= “<a href=’”.$item['link'].”‘ title=’”.$item['title'].”‘><img alt=’”.$item['title'].”‘ src=’”.$item['link_enclosure'].”‘ class=’alignleft’></a>”;
}

and turns it into …

[source lang="php"]$rss = fetch_rss( $url );
$pcount = 0;
$storycount = 0;
$textdate = date("F jS", mktime(0, 0, 0, str_pad($month, 2, "0", STR_PAD_LEFT), str_pad($day, 2, "0", STR_PAD_LEFT), $year));

echo $textdate;
foreach ($rss->items as $item) {

if (!$first) {$title = $item['title'];$first=1;

$content .= "<h3><a href=’".$item['link']."’ title=’".$item['title']."’>".$item['title']."</a></h3>";
$content .= "<p>";

if ($item['link_enclosure']) {
$content .= "<a href=’".$item['link']."’ title=’".$item['title']."’><img alt=’".$item['title']."’ src=’".$item['link_enclosure']."’ class=’alignleft’></a>";
}
[/source]

When it comes to saving time, that’s a huge helper.

WP Super Cache

It simply terrifies me how many people are not running this plugin or a similar flavor of it. It makes your site safer, easier to manage and much faster for the end user. I’ll also mention that by running it you can use a host like BlueHost for $7.95 a month to run dozens of websites instead of spending hundreds a month to run just one site on complex, over priced servers.

Enforce www. Prefix

Actually, I’m going to cheat here and tell you that this and Canonical URL’s are plugins you should have for massive SEO curb appeal. Basically Enforce www. Prefix forces your website to always use the correct SEO address and Canonical URL’s tell’s Google that your article is the source, so even if people repost it you get credit.

Google XML Sitemaps

We all want Google to come to our site right? Well, let’s make it easy for them! Sitemap will provide Google with a free pass to all your content, no matter how deep your links are.

Get Image from Post

People love pictures and with this simple plugin your website will be able to post pictures as part of your excerpt. Speaking of excerpts, Get Better Excerpts will allow you to pull complete sentences or words from your excerpts.

SEO Friendly Images

Between this and SEO Smart Links, I’ll be honest most websites are on auto pilot. The SEO Friendly Images ensures your images have the proper tags to make the most of search engines, while Smart Links adds valuable data to your hyperlinks.

WordPress Admin Quick Menu

quickmenu 10 WordPress Plugins I Couldnt Run a Site Without imageI might be a little bias but this is truly my favorite plugin. It allows you to add your own menu items to the WordPress Admin client, basically creating shortcuts between your website and important things like AdSense and Analytics. It’s completely customizable and saves endless frustrations between myself and clients but providing them immediate access to critical links.

Download Counter

Just like Analytics lets you know who’s visiting and where they’re going, you’ll want to track what people are downloading from your website and how often. This saves a fortune in report generation time, by simply allowing me to tell my clients weekly how often software has been downloaded.

How to exclude yourself from Google Analytics with WordPress

Without data we’re only guessing so it’s critical that we not only have great data to make decisions with but also that the data we do have is as free from corruption as possible. With that in mind if you run a WordPress website and Google Analytics, you’re most likely skewing your data without realizing it by visiting your own website.

To stop yourself from being counted as a visitor, all you need to do is add a simple piece of code to your websites header.php file that will read:

 

[source lang="php"]<?php
if (is_user_logged_in() == 1) {
if (wp_get_current_user()->ID == 1) {
setcookie("analyticsexcludeme", "analyticsexcludeme", time()+3600);
}
};
?>[/source]

Make sure the code is placed above the Google Analytics code (which I always like to place in the footer of my websites anyways). Once this code is placed in your header file, your website is updated but you’re not finished yet!

 

The code is only the first part, it’s what tells Google that you’d like to be excluded but now we need to actually exclude you.

Log into your Analytics account and click Analytics Settings.

Next, open the Filter manager (very bottom right corner).

Finally, add a new Filter with the settings:

analytics exclude me How to exclude yourself from Google Analytics with WordPress imageThis will tell Google to exclude all visitors who have the cookie “analyticsexcludeme” in their web browser, the same cookie we set earlier in the header code section of this tutorial.

How to check to see if there are pages or posts before displaying in WordPress

When I’m programming a new theme in WordPress I’ll often want to check to see if there are going to be any results before I write content to the page, but often the process of calling the results will display it.

For example, if I want to list a series of pages inside a <ul> tag I first want to know if there is going to be a list of pages to write otherwise I will be writing an opening and closing <ul></ul> with nothing in the middle or worse, a title as well. To avoid this, here’s what I do:

[source lang="php"]<?

$list = wp_list_pages(‘echo=0′);

if ($list) {
echo "<h2>My pages</h2>";
echo "<ul>";
echo $list
echo "</ul>";
}

?>[/source]

The code example above simply uses the echo=0 option to preload the page list results into a variable called $list, next I simple check if $list has a value and if it does, I write the header and <ul> tags as well as the variable $list. If there are no pages, nothing is written.

 

I’ve build a similar function into three recent plugins, where you can preload the results into a variable using a show attribute by setting the value to false:

  1. $list = scheduledPosts(’show=false’);
  2. $list = randomPosts(’show=false’);
  3. $list = popularPosts(’show=false’);

How to create a Coming Soon page for WordPress

Adding a Coming Soon! page to WordPress is surprisingly easy for website designers of all levels, there are a few ways to do it of course but here are two extremely simple and straight forward ways to ensure your WordPress website has a proper greeting page.

Theme Switcher Reloaded

A super cool, extremely easy way to create a Coming Soon! page for WordPress is to install the Theme Switcher Reloaded plugin and simply add a second theme to your install! Your second theme only needs a few things, I’ve included a free bare bones theme for you to use as your Coming Soon page, so all you need to do is:

  1. Download, install and activate the Coming Soon theme
  2. Download and install and activate Theme Switcher Reloaded

Now that the general public can only see the Coming Soon! page, you’re free to add your second (real) theme and activate it using the Theme Switcher Reloaded plugin. Once you’ve added it, visit your homepage using the ?wptheme=[yourthemedirectoryname] option to view the working theme. Remember you have to be logged into the backend to see it!

Adding a Template to Your Existing Theme

If you don’t want to go to the trouble of installing the Theme Switcher plugin, you could also add a special page template to your directory with the following content:

[source lang="php"]

<?php
/**
 * @package WordPress
 * @subpackage Default_Theme
 */
/*

Template Name: Coming Soon
*/
echo "Coming Soon!";
?>
[/source]
Of course, you will then have to add a new Page to your website, make it the default homepage and change the theme. This option works well but causes the homepage of the site to always default back to a coming soon page, even for the developers. Tim has an article with detailed instructions on it here.

By the way, if you think a Coming Soon! page has to be boring, think again! Check out these great Coming Soon pages at 25 Examples of Cool Coming Soon Page Designs – Part II

How hard is it to create a blog?

A blog (short for web-log) is a generic term used for a variety of website styles but most commonly it’s a place for a person or company to post articles. The benefits of a quality blog over other web publishing software is that common packages such as WordPress automatically publish content and help optimize it for the web, making the job of creating content much easier for writers.

How Diverse are Blogs?

A traditional blog looks and feels like a running dialog with one post preceding the other and little formatting to break them up but there are also some wonderfully complex installations of blogs these days ranging from major newspapers such as the Christian Science Monitor to CollegeCrunch using the popular package WordPress. The platform is also used to power sites such as Rosie O’Donnell’s blog and the popular technology site of TechCrunch. The potential for powering websites is still somewhat limited but almost all commonly used forms of websites can be powered with blogging software.

How to Install a Basic Blog

bluehost wordpress install 300x209 How hard is it to create a blog? imageAlthough there are many blogging platforms, I have a personal preference and bias towards the WordPress platform. It’s a free, downloadable open source software package with an unbeatable plugin architecture and expandability. Most large web hosting companies already have WordPress installed and simply requires you to go through the installation process to place it on your website.

If you need to install WordPress without the help of your hosting company, you can download the package directly from http://wordpress.org for free as an archive file to your desktop.

After you have downloaded and uncompressed the file, you’ll need an FTP client to upload the content to your web hosting provider. CuteFTP is a small, simple FTP program for Windows which I often recommend for non-technical clients, it has a 30 day trial available as a free download.

Installing WordPress in the Main Directory

Many website owners accidently install their blog in a sub directory such as http://thisismyurl.com/wordpress/ instead of the root directory at http://thisismyurl.com/ this is a pretty easy mistake to make and can be avoided by first deleting the content from your main directory (often called public_html or www in an FTP client) before uploading the contents of the archive file directly into the root directory.

Setting WordPress Permissions

Over the years I’ve seen a lot of new web users become frustrated trying to setup web based software, luckily the nice people at WordPress made it very easy for normal people to setup the software through an easy to use interface however there are still times when users need to manually set the security settings before a web application can access the files. If you have problems on the next step, you may need to right click the wp-content folder of the WordPress directory (on your server) and set it’s permissions to 0677. There’s an easy to follow tutorial located on the Codex for those users.

Setting up the Database

WordPress needs access to a database in order to work. Most web host companies allow you to access a control panel and setup a database fairly easily, check the email sent by your hosting company when you setup your account and follow their directions to log into your control panel.

Once you’re in you’ll want to create a new database and assign a user with full access to the new file. Remember that you’ll need access to the information here later, so write it down!

There are a couple of tricks when setting up a database. The first is to find out where the database is hosted, often it’s at a special website address called localhost. This is literally the same place as your website and it’s the default location but if it’s somewhere else you’ll be told when looking at your database information screen. The second stumbling block for many new website owners is the database name. If you’re on a shared host, there is a very good chance that your database is named with a prefix. For example, if your username is thisismyusername, your database might be called thisismyusername_databasename so be careful and double check!

Installing WordPress

wordpress install 300x216 How hard is it to create a blog? imageOnce you’ve uploaded the WordPress files, open a new web browser and go to your website address (http://www.thisismyurl.com for example) and let WordPress begin the installation process.

It’ll ask you some pretty straight forward questions and when you’re done, it’ll send you an email with your username and password for the new website.

Accessing your new WordPress website is done through a normal web browser, you can surf the front of your website as a normal visitor by going to your domain name, or you can access the administration area through the /wp-admin/ directory. For example http://thisismyurl.com/wp-admin/ is where I store the admin panel for my site.

Adding a New Theme

The default theme that ships with WordPress is great but if you’d like something more unique, there is a whole directory of theme designs at http://wordpress.org/extend/ or you can search Google and find thousands of great templates for free or a small fee. When you find the template that you like, simply upload the whole folder to your /wp-content/themes/ and visit your Appearance tab in WordPress. You can test the theme or activate it from with your administation client.

Common WordPress Installation Problems

The most common problems installing WordPress appear to be related to setting permissions properly and errors connecting to the database, the Codex has a great collection of common errors and how to fix them.

How to write a post to only appear in RSS feeds

On many of my websites (which I almost always power with WordPress) I like to give people incentives to signup for my RSS feeds. This let’s me keep in touch with them and helps keep people connected to my website but it also offers me a great advantage in that I know that my audience is building.

One of the things that I do is offer content for those users in the form of a contest or promotion which only appears in my RSS feeds or often appears in my RSS feed days (or weeks) before it appears on the main site. This allow allows me to test content, get feedback from regulars etc. before it’s live.

Now there are a few plugins and tutorials on how to do this (Creating Posts That Appear Only In RSS) but I prefer to do it in a much easier way.

  1. I create a category in WordPress where I’ll post items for the RSS feed.
  2. I’ll exclude that category from results pages

That’s it .. very simple really.

For example, on my archives.php page I simply add the code ‘exclude=X’ (where X is my category ID) from the results, which ensures that any article found exclusively in my RSS feed is not published anywhere else.

The only problem is … this method forces me to add and remove items from the list in a method similar to how we used to have to place sticky posts in WordPress.

What do you guys think? Is there an easier way for me to do it?

The best WordPress plugins, and why to use them.

What Plugins Are the Best WordPress Websites Running? but this week I wanted to take a quick look at what plugins I think are the best for WordPress websites and how a new blogger can make the most of the blogging platform.

 

Representin'
Creative Commons License photo credit: ryancboren

First off, there are some standards that everybody who runs a blog should be running as we’re not going to waste too much time looking at those. They are:

 

  1. Akismet which provides exceptional protection against comment spammers through a shared reporting server.
  2. No More Frames is a simple JavaScript plugin which forces your website to pop out of advertisers frames, this ensures that it’s your website (not others) who are earning revenue from your content.
  3. Search & Replace adds functionality to the WordPress admin tool, allowing you to do a bulk search and replace for words or phrases. This is very handy when moving a website or just correcting an error on your website.
  4. WordPress.com Stats offers a statistics tracking package but be careful. You should also download WordPress.com Stats Smiley Remover to ensure the creepy happy face goes away. 
  5. WordPress Database Backup emails a copy of your database to you nightly, very handy.
  6. Google XML Sitemaps improves Google’s understanding of your website. 

Here are some other, great plugins that a lot of people over look.

  1. Comment Relish sends a short thank you note to people after they’ve posted a comment to your blog. My friend Chris fixed up a couple problems with the original publisher (Comment Relish Free WordPress Plugin) and made it truly brilliant.
  2. LinkLove this little plugin works by adding a nofollow tag to outbound links until people post a few times. This helps protect your PageRank value.
  3. Theme Switcher Reloaded is a cool plugin which allows you to host multiple themes on your website. This lets admins test new themes on their live websites without disrupting the existing look.
  4. What Would Seth Godin Do one of the best plugins on the planet. This little baby adds a small welcome message for the first few visits.
  5. WP Super Cache converts your website from a dynamic to a static site which is then cached for visitors to view. Sounds pretty technical but what is it really? It’s a way to ensure thousands of visit’s doesn’t crash WordPress.
  6. WP Auto Tagger this is a new plugin for me but one that I’m in love with. It queries remote servers to determine the best tags for your post.
  7. Simple Image Grabber WordPress Plugin is a nifty tool for pulling the first image out of your post and displaying it beside your excerpts, wonderful for homepage and portfolio searches.
  8. Login LockDown tracks and protects your WordPress website admin (see also: How to Secure Your WordPress Website)
  9. Show Top Commentators displays a list of the top commentators on your website, encouraging people to leave comments and increase your exposure.

How to schedule a post on WordPress

One of the greatest tools in WordPress is the ability to create posts and articles during your downtime but have them display at a later date. For example, I like to write a lot of my content while I’m sitting at the library waiting for my kids to wrap up local sports but I hold onto that content for days or even weeks before it’s placed on my website.

How do I do it?

Super simple actually, when you write a new post you can set the scheduled date for publication by clicking the Edit button located beside the publish immediately text in your Publish dialog box.

schedule a post in wordpress How to schedule a post on WordPress image

Holding content back for a later date is a great way to publish a successful blog because it allows you to write effective content while you’re available to do so but still allows you to control how often you publish content.

Another interesting use of this technique is for people who are looking to run an events calendar. By it’s nature, WordPress won’t allow you to display scheduled posts but there’s a way to do it which would allow you to publish only scheduled content:

[source lang='php']
$ScheduledEvents = new WP_Query();
$ScheduledEvents->query(‘post_status=future&order=ASC’);
[/source]

The post_status=future query allows you to create a new loop and display only future events, which would be perfect for bands or other blogs looking to display a list of upcoming events. More on that another time, thanks for reading.

How to make a post sticky in WordPress

Hi guys, I’ve been pretty busy the past couple weeks trying to get some major projects wrapped up (more on that later) so I haven’t had a lot of time to write around here but I’ve got a small arsenal of content written so I’ll be scheduling some of my tutorials for release over the next week.

I love geeks, outsiders often laugh at our obsession with acronyms but truthfully most of the time we just come up with really silly names for things. Case in point, sticky posts … they’re literally posts that stick to the top of your list. We could have called them a million things but somewhere along the line they simply became sticky posts.

How’s it work?

By default, WordPress will always list posts from the newest to the oldest but a sticky post overrides this order and always appears at the front of the list, in the order of publication for sticky posts. It’s like having two lines in a bank, where one always gets served first.

Making a Post Sticky

I’m not sure why Matt and the boys decided to make this function so hard to find but I get a lot of questions from my clients about how (and where) to make a post sticky. In fact, it took me some searching the first time so I can just imagine how frustrating it could be to new users.

Once found, it’s super easy:

sticky post in wordpress How to make a post sticky in WordPress image

Simply click the Edit button located beside your Visibility option and check the checkbox. As  I said, I’m not sure why this wasn’t put somewhere a little more intuitive but my theory is that with all the other great interface improvements in 2.7 they didn’t have the time to fiddle with this.