Generally, there are so many plugins for embedding random or recent posts to your sidebar or anywhere else but I always prefer some coding instead of using plugin.
You know that WordPress has some beautiful free
and paid plugins and themes that can be grabbed at anytime from anywhere.
You know that I have already published some articles those are enlisted in coding and help you very much. You can get Google Authorship for your WordPress blog using two different codes and also redirect your error pages to your homepage. These all are depend on PHP and CSS and other programming languages.
However, let get back to the core point. You know that visitors and page views are the most important thing for any blog. Without having them, your blog is nothing. But you cannot force people to read your blog and increase your page view. But you can do something for that all people will come to your blog to get some useful updates. Interlinking, Recent Posts, Random Posts, Pictures are too much helpful to increase page views. So, keeping this in mind, today I am talking about this coding.
Add Recent posts in WordPress sidebar :-
You know that, most of the WordPress themes have sidebar.php that points to your blog sidebar. You can add anything to here.
Just add the following code to your sidebar.php and get a beautiful recent posts widget without using any plugin.
<h3>Recent Entries</h3>
<ul>
<?php $posts = get_posts(‘orderby=rand&numberposts=X’); foreach($posts as $post) { ?>
<li><a href=”<?php the_permalink(); ?>” title=”<?php the_title(); ?>”><?php the_title(); ?><br />
</li>
<?php } ?>
do not forget to change the “X” with the number of posts those you want to show in your sidebar.
That’s all! I think this little code will help you very much.
By the way, can you recover your WordPress Admin Panel password?
Feel Free to share your thoughts in the comment section below.
Don't forget to follow us on Twitter, like our Facebook Fan Page and Add us to your circles on Google+ to keep you updated with the latest technology news, gadget reviews, launches around the world and much more