Querying By Category
-
Hi, I built a theme a while back and I just installed on my site again. It’s pretty straight-forward: the left column displays posts from the “weblog” category and the right column displays posts from the “portfolio” category.
this used to work just fine, but i am now running on a fresh install of 2.8 (i can’t remember what version i built the theme on).
now the problem is:
1) post will show up in left column when under the “weblog” category.
2) post will show up in both columns when under both “weblog”, and “portfolio” category.
3) post will NOT show up anywhere when only under “portfolio” category.here is the index.php :
<?php get_header(); ?> <div id="content"> <img src="http://www.pablodelarosa.net/wp-content/themes/sketch/images/sec-title-weblog.gif" alt="From The Weblog" /> <?php if (have_posts()) : ?> <?php query_posts('category_name=weblog'); ?> <?php while (have_posts()) : the_post(); ?> <div class="post"> <div class="pdlr-post-title"><?php the_title(); ?></div> <small>Posted <?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></small> <div class="entry"> <?php the_content('', 'FALSE', ''); ?> </div> <div class="entry"> <p>» <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">Comment & Discuss</a></p> </div> <?php if (function_exists('sociable_html')) { echo sociable_html(); } ?> </div> <?php endwhile; ?> <div class="navigation"> <div class="alignleft"><?php next_posts_link('« Older Entries') ?></div> <div class="alignright"><?php previous_posts_link('Newer Entries »') ?></div> </div> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?> </div> <?php get_sidebar(); ?> <?php get_footer(); ?>
here is the sidebar.php :
<div id="sidebar"> <img src="http://www.pablodelarosa.net/wp-content/themes/sketch/images/sec-title-latest-projects.gif" alt="latest projects" /> <div id="sidebar-text"> <?php if (have_posts()) : ?> <?php query_posts('category_name=portfolio'); ?> <?php while (have_posts()) : the_post(); ?> <p> <div> <a href="<?php the_permalink() ?>"> <img id="sidebar-img" src="<? echo get_post_meta($post->ID, 'sidebar-teaser', true); ?>"></img> </a> </div> </p> <?php endwhile; ?> <?php else : ?> <h2 class="center">Not Found</h2> <p class="center">Sorry, but you are looking for something that isn't here.</p> <?php include (TEMPLATEPATH . "/searchform.php"); ?> <?php endif; ?> </div> </div>
thanks for any help!!!
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Querying By Category’ is closed to new replies.