Twitter Weekly Updates for 2009-06-19

Aside

How To: Show future posts in wordpress

Aside

Have you wanted to display your upcoming posts on your wordpress blog? I have been wanting to plan out my posting for this blog for awhile. Normally I just get a whim to post something and do it from start to finish. This brings about sloppy posts that need to be updated a lot. The solution for me was to create a “draft” of the post I thought of and work on it as I did more research or had a new idea. I know their are plugins for this but I generally like to do things myself and by not using a plugin it keeps the loading speed fast.

When I think of upcoming posts I think of both scheduled and ready post as well as saved drafts so the code I used shows both. It is easy to change to one or the other however and the change is included below. So here is how I put my upcoming posts on my sidebar.

  1. First I opened up my sidebar.php which can be edited under Appearance on the dashboard menu. Or be a geek and use ftp and a text editing program. This is much safer because you can backup your file if you make a mistake. First download the file your changing to your computer as a backup. Then select the sidebar.php file on the server and “edit” it from your a ftp program. Here is a good list of FTP applications for mac or windows and linux.
  2. Found a good place for the future posts to go. What order, If you have widgets enabled put it above or below the widget php code.
  3. Add the following code into the sidebar.php file inside of a div with the same class the other div’s use. A good way to do it is look at the structure of any other sidebar div. So if you see this:
    <div class="sidebar-box">*code*</div>

    then you know you can put this code inside another

    <div class="sidebar-box"></div>

    and it will look alright (hopefully). Make sure not to copy a div with a id because ID’s can only be used once while class’s are made to be used on multiple elements

<?php
$my_query = new WP_Query('post_status=future,draft&showposts=10');
?>
<div class="sidebar-box">
    <?php
    if ($my_query->have_posts()) : while ($my_query->have_posts()) :
        $my_query->the_post();
        ?>
        <ul>
          <li>
           <?php the_title(); ?>
          </li>
        </ul>
    <?php endwhile; else: ?>
        <div>
        <ul>
          <li><?php _e('No upcoming Posts'); ?></li>
        </ul>
        </div>
    <?php endif; ?>
</div>

If you want to customize it a little more:

You can of course can add a header above the code to tell visitors what they are seeing. Usually wordpress themes use a h2 header.

So right after

<div class="sidebar-box">

add something like this:

<h2>Upcoming Posts</h2>

Their is also a timestamp available for scheduled posts that can be added with this code but it shows the date a draft was saved. So only use it if you are just showing future posts and not drafts.

Add

<?php the_time('l, F jS, Y') ?>

after

  if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();  ?>

You can also put the code wherever you want in your theme by removing the sidebar-box class from the code.

Of course any questions or feedback would be appreciated! The original code I used was from Kishore on his blog post: Display UpComing Posts on your Sidebar – WordPress Blogs

My new website Twuoted.com

Aside

I made a new twitter app this past weekend called Twuoted. Basically it pulls any tweets with the #quote hashtag onto on website. Currently it is in public beta and I am adding new features but it already has built in search, and links back to tweet that was twuoted. Coming soon will be dynamic twitter avatars, user search, and more! I have a feedback widget from Get Satisfaction on the site so users can suggest new ideas, ask questions, or give praise or other comments.

To get started with Twuoted, simply tweet a quote with the hashtag #quote and it will show up on the site automagically! You can also follow @Twuoted on twitter for updates, and handpicked quotes by me!

Looking forward to more great quotes from twitter and feedback! If you have some ideas use the feedback widget on Twuoted.com