So I want to make a DAILY archive that shows ONLY for a specific month!
example:
archive:
- november 11th
- november 9th
- november 3rd
Because I also have posts in october etc.
Please help!
So I want to make a DAILY archive that shows ONLY for a specific month!
example:
archive:
- november 11th
- november 9th
- november 3rd
Because I also have posts in october etc.
Please help!
Could use this in a theme's sidebar.php, or put this in a widget (need Otto's PHP code widget):
<?php
//get posts dated this month/year
$current_month = date('m');
$current_year = date('Y');
$args=array(
'year'=> $current_year,
'monthnum'=>$current_month,
'posts_per_page'=>-1,
'caller_get_posts'=>1
);
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
echo 'Posts this month';
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<?php
endwhile;
} //if ($my_query)
wp_reset_query(); // Restore global post data stomped by the_post().
?>Great! This solved the problem, thanks a ton!
The only thing, which doesn't matter too much, is there a way I can change it from being the title to the date? For example 11th novemeber etc?
Thanks heaps!
You mean like:
<p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
<small><?php the_time('F jS, Y') ?> by <?php the_author_posts_link() ?> </small>
or this:
<p><small><?php the_time('m.d.y') ?></small> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
Delete what you don't need.
Review Formatting_Date_and_Time for various date/time display formats.
Oh, i just figured it out, I'm not sure if this is a bit dodgy but I took where it said
<?php the_title(); ?>
and replaced it with
<?php the_date(); ?>
Which seemed to do the trick.
Thanks so much!
This topic has been closed to new replies.