We help IT Professionals succeed at work.
Get Started

recent posts php code - sidebar

carolsanjose
carolsanjose asked
on
509 Views
Last Modified: 2012-05-11
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">
		<?php 
		if(get_option('boldy_blog')!='' && is_category(get_option('boldy_blog')) || post_is_in_descendant_category( get_option('boldy_blog'))){
		$current = get_the_category();
		if(sizeof($current)>0){ 
		$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 >
				<?php	
				$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>');
					}?>
			</ul>
		</div>
		<?php }}?>
		
		<?php /* Widgetized sidebar */
	if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?><?php endif; ?>
		
		</div>
<!-- End #colRight -->

Open in new window


http://www.callcarol.com/example3/blog/
Comment
Watch Question
Commented:
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE