Creating Featured posts - endwhile not working?
I am adding the below code to my index.php to retrive 3 posts from the Featured category but it does'nt seem to work and gets only 1 post and displays endwhile below it, can anyone help?
<div id=”featured”> <?php query_posts(‘posts_per_page=3&cat=301′); if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <h2><a href=”<?php the_permalink(); ?>”><?php the_title(); ?></a></h2> <?php endwhile;?> <?php wp_reset_query(); ?> </div> |
If you are doing that in the virtual template it won't work because you are using php that is not allowed in the 'limited php code'.
|
then how do i do it, where do i put the code? any other way you can suggest?
|
Try making a copy of the index.php virtual templete and call it category-yourcatname.php and see if that will work
|
so i added a new main template by copying index.php (named it category-news-2) that was the slug on my Featured category but I see no change in the main page, am I missing something.
below is the code in the new main template. Code:
<!--<div id="container">--> |
there is no current way, using the theme options, to limit the number of posts returned other than the 'dashboard->settings->reading->Blog pages show at most setting'
if you want to format the look/feel of a particular category: 1) toss your 'query_post' code in the trash 2) if your category is 'news' then the virtual template should be 'category-news' 3) create a copy of the subtemplate 'postformat.php and you can make changes there - remember you can only use HTML and the Limited PHP Code that is available. |
All times are GMT -6. The time now is 02:37 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.