let wordpress Article Random show

Found wp-content \ themes the \ table of contents, found sidebar.php to duplicate a naming is sidebar1.php

Modify the contents of sidebar.php ,find “Recent Posts”
and Replace with the following code:

<!– posts –>
<?php
if (is_single()) {
$posts_widget_title = ‘Recent Posts’;
} else {
$posts_widget_title = ‘Recent Posts’;
}
?>

<div>
<h3><?php echo $posts_widget_title; ?></h3>
<ul>
<?php
if (is_single()) {
$posts = get_posts(’numberposts=10&orderby=post_date’);
} else {
$posts = get_posts(’numberposts=14&orderby=rand’);
}
foreach($posts as $post) {
setup_postdata($post);
echo ‘<li><a href=”‘ . get_permalink() . ‘”>’ . get_the_title() . ‘</a></li>’;
}
$post = $posts[0];
?>
</ul>
</div>

And then the last sentence in the single.php in <? Php get_sidebar ()?>

Replace this <? php include_once ( “sidebar1.php”);?>
so that :
Home of the effect of the realization of a random show, “the latest article.” Page article “What’s New article.”

so that the article in favor of the old article showing the old rate, will put readers more access to the content of your blog!


Comments