Support » Fixing WordPress » Sidebar help

  • Resolved armstrong1118


    Im would really like to add a mini loop to my sidebar that would show just the title of the post, and the date of the post.

    Ive tried a couple of things and neither of them have worked for me. I dont know if it has to do the code that already exists in my sidebar or what.

    Heres a link to the current code in my sidebar, can anybody help me out?

Viewing 1 replies (of 1 total)
  • Quick and dirty:

    if(is_home()) {
    		echo "<li>
    		<span class='head'>LATEST NEWS</span>
    	        echo "<ul>";
    		$lastposts = get_posts('numberposts=5');
    		foreach($lastposts as $post) :
    			<li><a href="<?php the_permalink(); ?>" id="post-<?php the_ID(); ?>"><?php the_title(); ?></a>
    		echo " <small>posted on: ";
    		echo the_time('F j, Y') . "</small></li><br />";
    		echo "</ul>";
    } elseif (is_category(3) ||.....

    This’ll help in the future if you continue to custom code.

Viewing 1 replies (of 1 total)
  • The topic ‘Sidebar help’ is closed to new replies.