Jump to content

Recommended Posts

Posted

I wanted to be able to display only the 2nd level of a navigation menu on the sidebar as the client wished but I found this not easy. I think I should be able to do this with posts if I can get them going in ASC order by date created. here is my sidebar code. If there is anything wrong please tell me. Thanks!!!

 

<div class="sidebar">

<?php
if(trim(wp_title('', false))=="Commercial") {
?>
<ul class="comside">
<?php

?>
</ul>
<?php }?>
<ul class="comside">
<?php if (have_posts()) : ?>
	<?php while (have_posts()) : the_post(); ?>
<?php
		$recent_posts = wp_get_recent_posts();
foreach($recent_posts as $recent){
	echo '<li><a href="' . get_permalink($recent["ID"]) . '">' .  $recent["post_title"].'</a></li> ';
}?>
	<?php endwhile; ?>
<?php endif; ?>
</ul>

</div>

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...