Woah. Look. At. That!

wordpressworld So I’ve been playing with the new theme a little more (in case you haven’t noticed). In addition to adding more of the ads back, I’ve added a couple of cool hacked up widgets thanks to the PHP Code Widget and a super cool article that I found at SmashingMagazine.

If you peruse the right side, you’ll notice to new additions to the list. Upcoming Posts and Past Year. Upcoming Posts is just that. Posts scheduled to be published sometime in the future. Could be tomorrow. Could be next week, could be in 2011. Whenever. It simply displays a list of the posts scheduled to be posted. Its pretty cool and for things that you want to have auto posted and you want your readers to know is in the pipe, it works well.

The code is simple and is making good use of the query_posts loop in word press. See?

<?php query_posts(‘showposts=10&post_status=future’); ?>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<h2><?php the_title(); ?></h2>
<span class=”datetime”><?php the_time(‘j. F Y’); ?></span></p>
<?php endwhile;
else: ?><p>No future events scheduled.</p>
<?php endif; ?>

Granted, I cleaned it up a little and made some formatting changes to fit, but it works wonders.

The second one is the Past year articles. This one actually functions differently then I had expected. It figures out the date and it published the articles published on the 10th (for example) of the month for the past twelve months. You could modify it of course, to give you almost anything else or limit it to one post. I made a change to clean it up a bit and actually link to the article. Here’s my code:

<?php
$current_day = date(‘j’);
$last_year = date(‘Y’)-1;
query_posts(‘day=’.$current_day.’&year=’.$last_year); ?>
<ul>
<?php
if (have_posts()):
while (have_posts()) : the_post(); ?>
<li><strong><a href=<?php the_permalink();?>><?php the_title(); ?></a></strong><br>
<span class=”datetime”><?php the_time(‘j. F Y’); ?></span><br>
<?php
the_excerpt();
?></li>
<?php endwhile;
endif;
?> </ul>

Which is a little different then the code provided in the article and I’m still tweeking it a little bit.

Its amazing what you can do with WORDPRESS! Its almost easier then driving an rv.

Related External Links

Generated by LinkCurl
Google Buzz 

Blog Widget by LinkWithin

Popularity: 1% [?]

  • Share/Bookmark

Comments are closed.

Additional comments powered by BackType