[SOLVED] Display only one category in front page posts
I am trying to display posts of only one category in the front page.
I tried <?php if (is_front_page()) query_posts('cat=8'); ?> that I thought was the logic solution, but did not work. Suggestions ? |
I'll assume that you are putting using this at ATO->Style & edit CENTER COLUMN->The LOOP
you should try this. Insert as the first line HTML Code:
<?php if ((is_front_page() and is_category('8')) or (!is_front_page()) { ?> HTML Code:
<?php } ?> |
Juggledad, I tried as you instructed, but I ended up with no posts displayed at all.
I tried several other categories like "Category 10" or "Category 3" and the results were the same. |
Two things,
1) do posts show up on other pages? 2) what is the maximum number of posts that will show up on a page? the answer to (1) will tell me if the logic works. What I think is happeniong is that you have said 'display X posts ona page' and there are no category '8' posts in the first X posts. The loop is running saying 'Give me the next X posts, THEN this code runs and checks to see if the post is in CAT 8, if not it discards it and goes oin to the next. So say you will display 10 posts per page and none of the first 10 ae in cat 8, nothing will display, if 2 are in cat 8, then 2 should display, if 4, then 4 will display, etc etc. |
1) No posts show up on other pages.
2) The maximum number of posts is set to 4. Category 8 has 141 posts. We are still in the process of building this site. You can see the problem at http://ligadeascenso.com/2009/ And you can see how it should look at http://ix.ligadeascenso.com displaying posts of all categories. |
oops, the IS_CATEGORY should be IN_Category so this is the first line
HTML Code:
<?php if ((is_front_page() and in_category('8')) or (!is_front_page()) { ?> |
Didn't work
|
Try the Frontpage Manager plugin.
|
Thanks so much Paulae.
The Frontpage Manager Plugin solved completely this problem and a couple of other issues. And also thanks to you Juggledad. |
All times are GMT -6. The time now is 06:03 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.