Support » Themes and Templates » Category-only Sidebar links (WordPress as a CMS)

  • Resolved dbs

    (@dbs)


    Hello,

    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.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Category-only Sidebar links (WordPress as a CMS)’ is closed to new replies.