I recently started out with a microblog on my site, where I wanted to quickly share content I find on the Internet. Before I started out I had an option of using the P2 theme to post quick content on it. However, I shelved the idea since I did not have much time to customize the P2 theme to match the look and feel of my current site.
This led to a big dilemma since I wanted 3 things:
- Start a Micro Blog and post quick content on it.
- Make sure that Google Indexes the micro blog content as it does with the other content.
- Create separate feeds for the Micro Blog and the rest of the content.
Well, i was able to do all of these things without having to add new plugins or create a new blog. Here are the steps I followed to do it. Hopefully many of you will find this useful, and in turn also understand how powerful WordPress is when you want to customize it the way you want it to be.
Create Categories & Modify Loops to Segregate Content
The first few steps include creating a separate category for the Microblog and segregating content accordingly.
Create Category for your Microblog
The first thing I wanted to do was to segregate the main content from the micro blog content on the home page, so I went ahead and created a new category called â€œMicroblogâ€, where I post all the Microblog content.
Exclude Microblog Content from Main Loop
After creating a separate category, I needed the content from this category to be displayed separately on the site and not with the regular loop. To do that, you will have to edit your template file for the home page, usually index.php in your WordPress theme directory.
To do that you will need to add the code given below before checking if posts exist.
The code query_posts… instructs WordPress to ignore categories which have an id 123. Please not that you need to provide the minus(-) symbol before the category id. You will need to specify comma separated values to skip multiple categories.
Only Display Microblog Content in The Loop
Since I wanted Google to index the content from the Microblog, I wanted to display in on the home page, for this I needed to run another loop, which only displays content from the Microblog.
For that you need to add the following code:
In this case, the query_posts only fetched posts from a particular category we specified as the category_name and skipped the rest of it.
Using the above tricks you now have different sections on your blog home page which segregates content based on categories. You can find more information about skipping and querying certain categories by visiting the WordPress Codex entries for The Loop.
Creating Different Feeds for Main and Microblog
Now that you have been able to separate content from your main blog and the microblog, it is now time to create separate feeds for them. This is much more simpler than segregating content above and only requires few changes in your feed URL.
For example if your main feed URL is http://example.com/feed you will have to change it to http://example.com/feed?cat=-123. Similar to the skip rule in the query above, -123 will ignore posts from the category you specify.
Creating a separate feed for your Microblog is much more simpler, all you need to do is use the current URL for the Microblog category and add /feed to it. Your Microblog feed will be http://example.com/microblog/feed.
Since you are offering multiple feeds, you might also want to add them to your header.php, so browsers with automatic feed discovery can discover all your feeds. To that, remove the regular feed/RSS link tags from your header and add this. Replace the feed URLs with your own.
Doing this will ensure that whenever a user tries to subscribe to you feeds, they will see multiple options as shown above.
Posting Quickly to Your Microblog
Now that you have your Microblog setup and ready to go, it would be more appropriate that you can quickly post content to it.
To do that change your default category for posting to â€œMicroblogâ€ and then drag the Quick Press bookmarklet from your Tools menu to your browser bookmarks bar and start posting. Watch the video below to see how you can use Quick Press to quickly post content to your site.
The above tricks will not create a real Microblog, but it will eventually help you to segregate content and run multiple smaller blogs within your major blog and offer them to subscribers. I would still prefer to use the P2 theme for the above task, however customizing it to match the look and feel is a lengthy process and hopefully it should be quicker in the future.
The above tricks might be good or they might not be that good. Do give me your feedback on what you think about it and whether or not your found it helpful.