0815

Du musst dich anmelden um Beiträge und Themen zu erstellen. Einloggen · Registrieren

Recently Updated Posts and Pages

Easily display a list of recently updated posts by placing the following code into the desired location in your theme:

<?php 

$today  = current_time('mysql', 1);
$number = 5; // number of posts

if($recentposts = $wpdb->get_results("SELECT ID, post_title FROM $wpdb->posts WHERE post_status = 'publish' AND post_modified_gmt < '$today' ORDER BY post_modified_gmt DESC LIMIT $number")):

?>

<h2><?php _e("Recently Updated"); ?></h2>
<ul>
<?php

foreach($recentposts as $post) {

	if($post->post_title == '') $post->post_title = sprintf(__('Post #%s'), $post->ID);
	echo '<li><a href="'.get_permalink($post->ID).'">'.the_title().'</a></li>';

} ?>
</ul>

<?php endif; ?>

Of course, customize the details as necessary and remember to set the number of posts via the “$howMany” variable.

Source: Corey (404 link removed 2014/06/08)




0