post-page

How to Create Micro Blogs Within WordPress

13
responses
by
 
on
November 21st, 2009
in
WordPress FAQs, WordPress Tips

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 and do 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.

   1: query_posts($query_string . '&cat=-123'); //excludes micro blog category
   2: //continue regular WP loop
   3: if (have_posts()) : 
   4:   while (have_posts()) : the_post();
   5:       //display posts 
   6:   endwhile:
   7: else : 
   8:     //show errors 
   9: endif;

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:

   1: query_posts('category_name=microblog&posts_per_page=5'); //only display microblog posts
   2: if(have_posts()) :
   3:     while(haveposts()) : the_post();
   4:         //show posts
   5:     endwhile;
   6: else:
   7:     //show errors
   8: endif;

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.

   1: <link rel="alternate" type="application/rss+xml" title="Techie Buzz RSS Feed" href="http://feeds.techie-buzz.com/techiebuzz" /> 
   2: <link rel="alternate" type="application/rss+xml" title="Techie Buzz Microblog" href="http://feeds.techie-buzz.com/tbmicroblog" />

multiple_feeds

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.

heading
13
Responses

 

Comments

  1. rp__ (2 comments.) says:

    This is for the lazy ones — the Sideblog Plugin does a lot of what you have described in your post:
    http://wordpress.org/extend/plugins/sideblog/
    It works well in my blog.
    My recent post Voll subversiv: Lesen gefährdet die Dummheit

    • dgrut (13 comments.) says:

      lol, i have use this plugin. its handy help for “Lazy” or lack of knowledge customize PHP.

  2. Aine (1 comments.) says:

    There is no Quick Press bookmarklet in the Tools section. It is called Press This. Quick Press only exists in the Dashboard as part of the Admin interface.

  3. Ali Hussain (7 comments.) says:

    I wish i knew of this method before. I used this type of thing on my blog a few days ago. This could have saved my valuable time. Thanks.

  4. Ashfame (12 comments.) says:

    @Keith
    There is no option for filling out the category on Quick Press :P

  5. Nurul Azis (16 comments.) says:

    I am now in the preparation of creating micro blogs (I thought it was difficult to use wordpress) but it seems to be easy after reading this post. Thank you!

  6. Steven says:

    I was wondering if it would be possible to do a microblog within a blog. I’ll explain the difference between your concept and mine. I’ve been thinking that I would like to have a mini blog within a main blog. So, the regular blog would be published alongside a mini blog. The mini blog could be multiple posts, associated with the main blog post.

    In my concept, the review blog, there would be both a back end and front end. In the back end, you would upload photos one at a time and write a small amount of text for each photo. You could upload as many of these micro blogs as you would want. These microblogs would go alongside the regular blog which would be a standard narrative + image text. On the front end, the person would see the main blog review, plus another box to the right where a series of mini thumbs and a selected larger sized thumb which would display the text that went with the input of the miniblog. This image would be selectable for a popup window larger image with the ability to browse through the miniblog in a larger format.

    Maybe you’d have an idea how to do that.

  7. Christina Malaga (3 comments.) says:

    Keith, I have a more rudimentary understanding of microblogs and so my question for you, although not off-topic, is a level or two below what you have shared with us on this page:

    Basically, I am still not completely grasping the NEED for microblogs. Forgive me for sounding dumb, but a blog is a blog. Why would I (or ‘could I’) need a blog within a blog?

    I would really appreciate it if you or anyone else subscribing to the comments on this page, could perhaps post a link to a tutorial and/or video resource that simply, clearly explains what microblogs are and how we should use them (and when not to use them) and their benefits (not just from a reader perspective, but also from a SEO perspective).

    I am on a quest for ‘microblog knowledge’ here and would appreciate any advice you can give me.

    Thanking you in advance.



Trackbacks/Pingbacks

  1. [...] How to Cre­ate Micro Blogs Within Word­Press « Weblog Tools Col­lec­tion — | word­press php howto [...]

  2. [...] How to Create Micro Blogs Within WordPress « Weblog Tools Collection (tags: howto wordpress reference tutorial php code html blogging) [...]

  3. [...] An excellent tutorial for producing a virtual microblog within your main WordPress blog. Find out more here: How to Create Micro Blogs Within WordPress « Weblog Tools Collection. [...]

  4. [...] How to create Microblogs within WordPress [...]

  5. [...] Further reading on the Loop function in WordPress and credits to Keith Dsouza. [...]

Obviously Powered by WordPress. © 2003-2013

page counter
css.php