Wordpress Themes - WP Forum at BFA
Click here to register or to donate.
Auto self-registration is not available here - far too many spammers. This forum has many, many backlinks and because of that there is an intense desire among spammers to drop their links here.

Wordpress Themes - WP Forum at BFA » WordPress Themes » Atahualpa 3 Wordpress theme » Page & Category Menu Bars »

Older / Newer links and excluding category


  #1  
Old Feb 20, 2011, 07:30 AM
vCopia's Avatar
vCopia
 
72 posts · Jan 2011
Long Island, NY
I have the following code inserted Above The Loop in the ATO to exclude category #3 from appearing on the main pages of the web site (or search for 'em, etc.).

PHP Code:
<?php if (is_front_page() && !is_paged() )
$posts query_posts($query_string '&cat=-3'); ?>
Didn't think it through, though, because it does exactly what I asked it to... exclude cat 3 from the front page (only). When I click on the Older / Newer links, category 3 posts reappear. The idea was to create the illusion to visitors that category 3 posts weren't part of the main site, and were only accessible if you clicked the page tab I have set up for them.

After reading another posts herein I tried this code instead:

PHP Code:
<?php
if (is_home() and !(is_paged()) ) {
query_posts("cat=-3");
}
?>
Got the same result - worked on front page, but not older / newer pages. Makes sense.

Figured I either needed to:
  • change is_home or is_front_page to another command,
  • expand that section to include a command that referred to the Older / Newer links, or
  • add another segment of of code identical to the above and replace is_home or is_front_page with a tag that referred to whatever the Older / Newer links are IDed as.

Just know I ain't got it right. Please share any insights you have that'll bring my coding prowess up to speed with my goal so I can resume my spot at the clever table. Thanks.
  #2  
Old Feb 20, 2011, 11:25 AM
juggledad's Avatar
juggledad
 
23,667 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
you need to test to see if you are paged and pass that to the query_post
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #3  
Old Feb 20, 2011, 12:02 PM
vCopia's Avatar
vCopia
 
72 posts · Jan 2011
Long Island, NY
Got it! Thanks for the direction. Here's what I used and it seems to be working perfectly.

PHP Code:
<?php
if (is_home()) {
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts("cat=-3&paged=$paged");
}
?>
If you see an issue I haven't foreseen with this string, please let me know. Otherwise, I think my Seat has been restored. Thanks.
  #4  
Old Nov 2, 2011, 12:18 PM
spam11@siknerd
 
1 posts · Nov 2011
If I'm understanding Wordpress and Atahualpa correctly, I'm having a similar problem. I have a category that I want only accessible if a user selects that tab from the menu. I don't want it to appear as a prev/next option when someone is reading a post. I inserted the above code on the top of my wp-content/themes/Atahualpa/index.php page: the unwanted category doesn't show up on the home page (good!); however, it does appear in prev/next on blog posts (bad!). Please advise: am I putting the code in the wrong spot? Or am I misreading what is written here and I need a different code? Thanks in advance!

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Older Newer entries tags raddy59 Center area post/pages 1 Jan 16, 2011 11:22 AM
Changing Font size for NEWER/OLDER ENTRIES steven72dragon Page & Category Menu Bars 3 Jul 29, 2010 05:52 PM
Older/Newer Errors LindaMuller Atahualpa 3 Wordpress theme 4 Mar 9, 2010 04:28 AM
NEWER / OLDER orientation not working bseppa Atahualpa 3 Wordpress theme 9 Aug 27, 2009 08:35 AM


All times are GMT -6. The time now is 05:37 PM.


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