Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Center area post/pages »

[SOLVED] Excluding certain categories from the homepage / loop


  #1  
Old Nov 10, 2010, 08:36 AM
thesis
 
46 posts · Nov 2009
Hi there,

I'd like to exclude some categories from showing on the homepage. This is the site - http://twh.net.au/alex/

I'm trying to exclude the 'worklist' category (the posts 2009, 2008, 2007 etc)

There was another thread here - http://forum.bytesforall.com/showthread.php?t=9927

I used the code suggested there, and changed the numbers to my specific category ID's (4 and 5), ending up with this:

PHP Code:
<?php if (is_front_page() && !is_paged() )
$posts query_posts($query_string '&cat=-4,-5'); ?>
But unfortunately its not working for me. Can anyone suggest what I'm doing wrong?

WP 3.0.1
Atahualpa 3.5.3

Last edited by thesis; Nov 10, 2010 at 09:22 AM.
  #2  
Old Nov 15, 2010, 08:55 AM
aclime
 
31 posts · Oct 2010
Try to delete minus before numbers. Works perfect for me without minuses.
  #3  
Old Nov 15, 2010, 01:49 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Where did you put the code?
Is the front page displaying your blog?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #4  
Old Nov 15, 2010, 03:41 PM
aclime
 
31 posts · Oct 2010
Above loop. My frontpage shows posts only from specified category.
  #5  
Old Nov 15, 2010, 05:23 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
How have you set that up - ie the front page to only display from certian categories?

In order to know why this code isn't working, I have to know what code is being run to create the front page. Since it is not the normal code, what is it?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Nov 16, 2010, 04:17 AM
aclime
 
31 posts · Oct 2010
You can view this php code running in my website - www.docs.e7.lt

Above the loop full code
Code:
<?php if (is_front_page() && !is_paged() )
$posts = query_posts($query_string . '&cat=1'); ?> 
<?php /* For the plugin Page2Cat http://wordpress.org/extend/plugins/page2cat/ */
if( is_category() AND function_exists('page2cat_output')) { page2cat_output($cat); } ?>
  #7  
Old Nov 16, 2010, 05:01 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Where did you put the other code - with the minus signs??
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #8  
Old Nov 16, 2010, 05:57 AM
aclime
 
31 posts · Oct 2010
I did not put code with minus. Just a code which is in the above post.
  #9  
Old Nov 16, 2010, 06:17 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
aclime - I'm sorry I think there was an mis communication here. My first reply was to 'thesis' and so was your's but I thought you were having an issue. Now that I look at this again, you were just trying to give an answer (correct?)

While your code works for you because if just lists the items from a SINGLE category, 'thesis' is trying to display posts from ALL categories EXCEPT the two specified in the code.

thesis - are you still having a issue?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #10  
Old Nov 17, 2010, 04:40 AM
thesis
 
46 posts · Nov 2009
Quote:
Originally Posted by juggledad
thesis - are you still having a issue?
Hi juggledad,

I just started working on this project again, so hadn't checked this thread in a few days. Really appreciate yours and aclime's input, thanks!

I'm still having an issue. Removing the minus signs caused the homepage to show only categories 4 and 5. I'm trying to exclude those categories from showing on the homepage.
  #11  
Old Nov 17, 2010, 04:45 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
With the minus signs in, which posts on the front page ARE in one of those two categories?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #12  
Old Nov 17, 2010, 05:35 AM
thesis
 
46 posts · Nov 2009
Quote:
Originally Posted by juggledad
With the minus signs in, which posts on the front page ARE in one of those two categories?
The post '2009' is in category 5 (its currently sticky on the homepage)

http://twh.net.au/alex/

I'm moving a few things around at the moment, apologies. The current homepage will soon be moved, and will be reachable under a 'News' menu item.
  #13  
Old Nov 17, 2010, 05:49 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
if it is a sticky, new rules apply - a sticky by its nature is displayed first
Why not just 'unstick' the post?
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #14  
Old Nov 17, 2010, 06:26 AM
thesis
 
46 posts · Nov 2009
Ah, I see...

The reason I stickied the post was actually to solve another issue, which is this - I'd like the posts in category 5 (Works) to display without the kicker. If you go to http://twh.net.au/alex/category/worklist/ you'll see why. The 2009 post is showing without the kicker (post date), this is what I'm trying to achieve for all posts in category 5. Making those posts into stickies was one way to solve this, apart from the problem that those posts are also stickied on the homepage.

Maybe I should be looking at the problem differently.

Is there a way to remove the kicker from posts in a specific category instead? In my case, I'd need all posts from category 5 (Works) to display without the kicker. That way, I can un-sticky the posts to stop them showing on the homepage.
  #15  
Old Nov 17, 2010, 07:38 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
sure, in 'The LOOP' you could change the line
HTML Code:
<?php bfa_post_kicker('<div class="post-kicker">','</div>'); ?>
to
HTML Code:
<?php if (!in_category( array( 4,5 ) ) ) bfa_post_kicker('<div class="post-kicker">','</div>'); ?>
So as long as the post is NOT in cat 4 or 5, the kicker will be displayed.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #16  
Old Nov 18, 2010, 05:30 AM
thesis
 
46 posts · Nov 2009
Thanks juggledad, it worked!

Bookmarks



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I display posts excerpts from specific categories on the homepage? aeerol Center area post/pages 0 Jun 12, 2010 05:32 PM
[SOLVED] Change Background Color on Homepage and all next pages,categories shus Post-Kicker, -Byline & -Footer 6 Dec 23, 2009 08:56 AM
Trouble with excluding categories in sidebar paulae Sidebars & Widgets 0 Apr 16, 2009 09:31 PM
Excluding categories from feed squarehead RSS, Feeds & Subscribing 1 Mar 22, 2009 02:56 PM


All times are GMT -6. The time now is 02:49 AM.


Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.