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 »

[SOLVED] How to exclude posts in a category from appearing on the "blog"/multi-post p


  #1  
Old Sep 17, 2009, 08:31 AM
Shepherd Jim's Avatar
Shepherd Jim
 
301 posts · Feb 2009
Bristol, midcoast Maine USA
Thanks to Flynn and Juggledad I've set up a special category "Announcements" whose latest post appears in a special box at the center top of my landing page ( http://forum.bytesforall.com/showthread.php?t=3392 )

NOW, I want to exclude ALL posts from the "Announcements" category from appearing on the multi-post "blog" page. It's okay if the "Announcements" category still appears in the "Category" sidebar widget so someone might be able to just see a chronological listing of all my announcements. I'd just like someone going to the "blog"/journal to not to be bothered with all the announcements.

Jim
  #2  
Old Sep 17, 2009, 10:00 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
add this as the first line of 'The LOOP'
HTML Code:
<?php if ( !in_category('announcements') ) { ?>
and add this as the last line
HTML Code:
<?php } ?>
This will now only display posts that are NOT in the category 'announcements'
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; Apr 23, 2011 at 03:55 PM.
  #3  
Old Sep 18, 2009, 06:42 AM
Shepherd Jim's Avatar
Shepherd Jim
 
301 posts · Feb 2009
Bristol, midcoast Maine USA
That works a treat!

Now, I might seem picky here, but really it's mostly curiousity: I actually have been looking at some php coding pages trying to figure this out for myself, but php if/endif/else statements don't seem as intuitive as the good old BASIC and dBaseIV ones I remember from my youth.

How could I amend the code so that IF the current page is NOT the multi-post "blog" the loop DOES execute? That is, if someone specifically clicks on the "Announcements" category in the Category widget in the right sidebar they WOULD see the usual chronological listing of all the posts in that category.

(note: if the above is not possible, is there a way to have the "Announcements" category NOT appear ANYWHERE visible to the site visitor. I find it disconcerting that if you click on "Announcements" category in the Category widget you're presented with a page with an empty center column.)

I've been nosing around trying to figure out how mutli-category and single-category multi-post pages are differentiated with no luck.

Jim
  #4  
Old Sep 18, 2009, 07:02 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
try this, change the if to
HTML Code:
<?php if ( !is_page('XXXXXXXX') OR (is_page('XXXXXXXX') AND !in_category('announcements')) ) { ?>
where XXXXXXXX= the name of your blog page

So this is saying 'if it's not the blog page OR it is the blog page, but the post is not in the category 'announcements', then display it
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #5  
Old Sep 18, 2009, 07:22 AM
Shepherd Jim's Avatar
Shepherd Jim
 
301 posts · Feb 2009
Bristol, midcoast Maine USA
Code:
<?php if ( !is_page('blogg') OR (is_page('blogg') AND !in_category('announcements')) ) { ?>
Nope, that's not it, we've worked all the way back to "normal" -- the posts in the "Announcements" category are showing up everywhere they normally would -- including the main, multi-post "all category" blog page.

http://www.shepherdjim.com/

I left the new "if" in place so you could check it out if necessary.

Jim

Last edited by Shepherd Jim; Sep 18, 2009 at 07:24 AM. Reason: addition
  #6  
Old Sep 18, 2009, 11:25 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Wow, this took me on a ride! for some reason is_page('blogg') doesn't work! However in your case since you are using a static front page , the blog page is refered to as the home page, so we can change the it to
HTML Code:
<?php if ( !is_home() OR (is_home() AND !in_category('announcements')) ) { ?>
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support

Last edited by juggledad; Apr 23, 2011 at 03:56 PM.
  #7  
Old Sep 18, 2009, 02:04 PM
Shepherd Jim's Avatar
Shepherd Jim
 
301 posts · Feb 2009
Bristol, midcoast Maine USA
Okay! Wow! That did it!

The whole setup is working perfectly. I was worried that when I viewed a multi-post listing of the Announcements category if I clicked on a single post I'd again get a blank center column but the single post page opens up complete with comment window.

Thanks! Now I have to check with the Head Shepherd to see if she thinks this is ready to be implemented on the main site.

Jim

Bookmarks

Tags
"exclude category"

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Static text/banner image before posts in "posts page" verbalicious Page & Category Menu Bars 14 Nov 12, 2010 05:27 AM
How to display "Recent Posts" from 'Blog / wordpress' domain on home different domain Geoff Plugins & Atahualpa 1 Aug 27, 2009 08:07 PM
Images in Post: Option for "No Border" on selected posts? KatyDigg Atahualpa 3 Wordpress theme 3 Aug 26, 2009 11:47 AM
Posts of Category "Bulletin" on home page? RAMilewski Plugins & Atahualpa 5 Aug 16, 2009 05:21 PM
Problem implementing "How to show single post special category on static home page??" mkny13 Post-Kicker, -Byline & -Footer 6 May 5, 2009 05:21 AM


All times are GMT -6. The time now is 09:32 AM.


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