Jdoughs |
09-27-2009 01:47 PM |
I spent the last couple days tweaking a dicks/cocks site, the site isnt primarily gay but because of the niche has lots of gay clicks too.
I was lookin for a way to only show gay ads on gay categories, both parent and children cats, and to show a different sidebar/header for any post cat or tag, that was gay.
To display a gay banner in the header on all posts in a descendant of cat 25 (gay), this will also work on tags that have the first post showing from desc of cat 25.
PHP Code:
if (is_home() ) {
include(TEMPLATEPATH."/banner.php");
} else if ( is_category( 'gay-dicks' ) || post_is_in_descendant_category( 25 ) ) {
include(TEMPLATEPATH."/bangay.php");
} else {
include(TEMPLATEPATH."/banner.php");
}
And to pull seperate sidebars (only shown on the gay side of the site)
PHP Code:
if ( in_category( 'gay-dicks' ) || post_is_in_descendant_category( 25 ) ) {
include(TEMPLATEPATH."/sidebar-gay.php");
} else {
include(TEMPLATEPATH."/sidebar.php");
}
As mentioned above, if_category is not as 'usefull' as in_category. You can use this to completely sanction off and make a category completely relevant and making the site solid for niche landers. The gay traffic never sees anything but stuff tagged as gay or put in the category of gay, likewise for the straight. (I do list the gay category on main page, but never include the posts in the updates, except in the gay pages.)
If that makes any sense, great..lol
|