Separate posts by categories
-
hello. i am strugling for few days already with a problem. Thing is that i want on my index page to display posts of all categories (precise 4 out of 5) on lets say main post feed, AND i want 5th category to be displayed in one div, thats positioned on right side in a little news feed. That would be like little news, and first posts would be big news. Now i just cant make loop work for what i want :S now even date has stoped working for my posts, its not displaying it anymore… code of what i have is below
<div id="news-content"> <?php query_posts("post_per_page=5"); ?> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="news"> <h1><?php the_category();?></h1> <h2><?php the_title(); ?></h2> <div class="news-picture"><img src="wp-content/themes/BLANK-Theme/images/novost.jpg" width="331" height="218" /></div> <div class="text-news"> <p><?php the_excerpt(); ?></p></div> <h3><a href="<?php the_permalink(); ?>">more...</a></h3> <h3><?php the_date(); ?></h3> </div> <!--END news--> <?php endwhile; ?> <?php endif; ?> </div> <!--END news-content--> <div id="sidebar"> <h1>hit news</h1> <div id="hit-news"> <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <div class="small-news"> <!-- limiting size of post in words--> <p><?php $excerpt = get_the_excerpt(); echo string_limit_words($excerpt,15); ?></p> <p class="date"><?php the_date(); ?></p> <p><a href="<?php the_permalink(); ?>">op?irnije...</a></p> </div> <?php endwhile; ?> <?php endif; ?> </div> <!--end HIT-NEWS
maybe you can see what im trying to do :S and i just dont know what to try anymore, i tryed warious methods, excluding categories etc… but either im not using methods right or i didnt make entire index right… hopefully some1 can help
furthermore, if i ad picture as media in post, how do i display it in lets say div class=image, whats the method to call it. also tried few, and nothing works. cheers
- The topic ‘Separate posts by categories’ is closed to new replies.