troubleshooting Question

recent posts php code - sidebar

Avatar of carolsanjose
carolsanjose asked on
5 Comments1 Solution513 ViewsLast Modified:
In my blog side bar, it is not dynamic, it follows the code below.  I want to add a recent posts section above the category section.

What is the code do I add to get a recent posts list showing up like the category list?

<!-- Begin #colRight -->
		<div id="colRight">
		if(get_option('boldy_blog')!='' && is_category(get_option('boldy_blog')) || post_is_in_descendant_category( get_option('boldy_blog'))){
		$current = get_the_category();
		$current_id= $current[0] ->cat_ID; 
		$categs_list = get_category_parents($current_id);
		$pieces = explode("/", $categs_list);
		$category_name = strtolower($pieces[0]);
		$categs = get_cat_id($category_name);
		<div class="rightBox">
			<h2>Categories </h2>
			<ul >
				$categories = get_categories('hide_empty=1&child_of='.$categs);
				foreach ($categories as $cat) {
					echo ('<li><a href="');
					echo (get_category_link($cat->cat_ID).'">'.$cat->cat_name.'</a></li>');
		<?php }}?>
		<?php /* Widgetized sidebar */
	if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?><?php endif; ?>
<!-- End #colRight -->

Open in new window
Prepress Technician

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros