Ask your WordPress questions! Pay money and get answers fast! Comodo Trusted Site Seal
Official PayPal Seal

Simple Archive Loop WordPress

  • SOLVED

I'm looking for a loop to replicate the page found here:

http://allhiphop.com/media/music.aspx?app=multimedia__music

or here:

http://www.dimewars.com/Video/BrowseVideos.aspx

I need this for one of my category pages.

I need the following layout...

ARTICLE POST DATE (For example, Today)

Thumbnail of Each Article That Falls in on the date

Title of Article

(Loop Repeats)

ARTICLE POST DATE (Yesterday)

Thumbnail of Each Article That Falls in on the date

Title of Article

(Loop Repeats)

ARTICLE POST DATE (Day Before Yesterday)

Thumbnail of Each Article That Falls in on the date

Title of Article


I would like for there to be 3 Columns for the thumbnail to spread across like in the examples above.

Don't worry too much about the css. I'm pretty proficient with that. And I use the post thumbnail feature for Wordpress 3.0.

Thanks

I would like the archive to be daily and the page showing the past 7 days with the ability for me to flip page by page.

Answers (3)

2010-07-12

Agent Wordpress answers:

I assume you are on WordPress 3.0. Add these lines to functions.php file,

add_theme_support( 'post-thumbnails' );
set_post_thumbnail_size( 50, 50, true );


Obviously you can use the size you need in the set_post_thumbnail_size function.

Then use the following loop. Also, as you said you are good with CSS, I have provided just the code, you can wrap things in containers and then style them,

<?php if (have_posts()) : ?>

<?php while (have_posts()) : the_post(); ?>

// date, wrap in div or span and style
<?php the_time('F jS, Y') ?>

// thumbnail, wrap in div or span and style
<?php the_post_thumbnail(); ?>

// title link, if you just need title then remove anchor, wrap in div or span and style
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a>

<?php endwhile; ?>

<?php else : ?>

<h2 class="center">Not Found</h2>
<p class="center">Sorry, but you are looking for something that isn't here.</p>
<?php get_search_form(); ?>

<?php endif; ?>


Brennen Jones comments:

Thanks man! You definitely got me on the right track, but was wondering if there was a way to list all posts under that date.

For example, check out TheUrbanTwist.tv and you see how there's two July 8th Posts...what I would like is there to be one "July 8th" Header and both posts go underneath that and so forth for all the other dates.

The code that I put on my page is as follows:



<?php include 'header_tv.php'; ?>


<div id="articles">

<div id="tv-date">

<?php if (have_posts()) : ?>



<?php while (have_posts()) : the_post(); ?>

<h1><?php the_time('F jS, Y') ?></h1>
<ul>

<li>

<?php the_post_thumbnail(); ?>


<h2><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h2>

</li>
</ul>

<?php endwhile; ?>

<div class="navigation"><?php if (function_exists('wp_pagenavi')) { wp_pagenavi(); } else { ?>
<div class="floatleft"><?php next_posts_link( __('&laquo; Older Entries', '') ); ?></div>
<div class="floatright"><?php previous_posts_link( __('Newer Entries &raquo;', '') ); ?></div>

<?php } ?>
</div>



<?php else : ?>



<h2 class="center">Not Found</h2>

<p class="center">Sorry, but you are looking for something that isn't here.</p>

<?php get_search_form(); ?>



<?php endif; ?>


</div>

</div>


<?php get_sidebar(); ?>

<?php get_footer(); ?>






Agent Wordpress comments:

In that case, use this plugin. Please let me know if you need any help.


Agent Wordpress comments:

Forgot the plugin link,

[[LINK href="http://blog.favrik.com/2007/10/26/wordpress-plugin-recent-posts-grouped-by-date/"]]http://blog.favrik.com/2007/10/26/wordpress-plugin-recent-posts-grouped-by-date/[[/LINK]]


Brennen Jones comments:

You've lead me in the right direction but I give up. I'm going to go with what you first recommended. Is there a way though for me to output the 21 posts instead of the given 10.

Check my page out with your code at:

http://www.theurbantwist.tv

I've added the CSS to format it. I'm good with CSS, just not with this looping stuff, lol.

2010-07-12

Rashad Aliyev answers:

For example: <?php wp_get_archives('type=daily&limit=15'); ?> // That give you an archive pages sorting by date for 15 days.

But in your example you should use special query for you.

http://codex.wordpress.org/Function_Reference/query_posts

your budget not enough for it;)

2010-07-13

Nile Flores answers:

http://codex.wordpress.org/Template_Tags/wp_get_archives

There is a call for calling daily archive


<?php wp_get_archives('type=daily'); ?>