Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

mrfraz on "Last 7-Days-News"

$
0
0

I have a Snippet for Posts for today by categorie.

Can i Change this to the last 7 Days? (seperate by day not category)

<?php
$today = getdate();
$categories = get_categories(array('hide_empty' => 1, 'orderby' => 'id', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None')));
foreach ($categories as $category) {
    query_posts('year='.$today["year"].'&monthnum='.$today["mon"].'&day='.$today["mday"].'&post_type=post&post_status=publish&cat='.$category->term_id);
    echo "  <li>\n"
        ."    <span class=\"tag-headline\" href=\"".get_category_link($category->term_id)."\">".$category->name."</span>\n<p class=\"tag-headline-border\"></p>"
        ."    <ul>\n";
    while (have_posts()) : the_post();
?>

posts

<?php
    endwhile;
    echo "    </ul>\n"
        ."  </li>\n";
}
?>

Viewing all articles
Browse latest Browse all 8245

Trending Articles