[resolved] Category-only Sidebar links (WordPress as a CMS) (3 posts)

  1. dbs
    Posted 9 years ago #


    I am using wordpress as a basic cms for a new site: http://cafefoundation.org/wp/ In doing so I am using categories as sections, where $cat 1 might be NEWS, etc. All is great except...

    The sidebar does not obey the $cat rules. The sidebar is quite simple, it is supposed to list the posts in a specific category, and does so just fine when archive.php is invoked, but breaks once single.php is used. No matter what I do I can't get the sidebar to display the correct category permalinks in single.php. Here is my sidebar code:

    <?php $posts = get_posts('category='.$cat); foreach($posts as $post):?>

    <li><a href="<?php the_permalink()?>&cat=<?php echo $cat ?>"><?php the_title(); ?></a></li>

    <?php endforeach; ?>

    As you can see in this current iteration I am trying to pass $cat as a php variable to the next page, which does not work. You can see $cat echoed just beneath the header.

    This is killing me, everything else works except this.

  2. dbs
    Posted 9 years ago #

    NEVERMIND, Fixed it.

  3. syncbox
    Posted 9 years ago #

    care to share how you fixed it?

Topic Closed

This topic has been closed to new replies.

About this Topic