Grow your CSS skills. Land your dream job.

WordPress sidebar

  • # December 27, 2008 at 7:30 pm

    i have it set up so that on my sidebar in wordpress it gathers and displays the posts that are in certain categories. however its not posting the right category. the to categories are news and cal. however its posting news in the calender section as well any ideas i have posted the script below. and heres the website url. http://apluscleaningfreeport.com
    the website is not complete as u can tell.

    any ideas?

    Quote:
    <div id="linksidbar">

    <div id="sidebarsearch">

    <?php include (TEMPLATEPATH . ‘/searchform.php’); ?>
    </div>

    <div id="news">

    <ul id="newsinside">

    <?php
    global $post;
    $myposts = get_posts(‘numberposts=5&offset=1&category=news’);
    foreach($myposts as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

    </ul>
    </div>

    <div id="cal">

    <ul id="calinside">

    <?php
    global $post;
    $myposts = get_posts(‘numberposts=5&offset=1&category=calendar’);
    foreach($myposts as $post) :
    ?>
    <li><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>

    </ul>
    </div>

    </div>

    # December 28, 2008 at 5:51 am

    why not try the number of the category instead of its name?

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".