Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Post-Kicker, -Byline & -Footer (http://forum.bytesforall.com/forumdisplay.php?f=17)
-   -   [SOLVED] Display only one category in front page posts (http://forum.bytesforall.com/showthread.php?t=4942)

majofa Dec 19, 2009 09:16 AM

[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 ?

juggledad Dec 22, 2009 04:05 AM

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()) { ?>
and add to the last line in The LOOP
HTML Code:

<?php } ?>
As the LOOP is processed, this will say is this the front page, and is this a cat 8? if so process the loop, otherwise if this is NOT the front page, proceed.

majofa Dec 22, 2009 06:47 PM

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.

juggledad Dec 23, 2009 05:23 AM

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.

majofa Dec 23, 2009 02:14 PM

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.

juggledad Dec 24, 2009 05:26 AM

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()) { ?>

majofa Dec 24, 2009 08:20 AM

Didn't work

paulae Dec 24, 2009 08:35 AM

Try the Frontpage Manager plugin.

majofa Dec 24, 2009 01:36 PM

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.