Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 11-22-2010, 08:12 AM   #1
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Which WP function do I need to display certain things includes on the main page only?

I've got a few things I have added into my site. That are using <?php include> tags.

One is in sidebar.php / one is in footer.php etc.

Problem is I only want to display these includes on the main page.

What's the best way to do it?
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 08:47 AM   #2
Jdoughs
Confirmed User
 
Jdoughs's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Great White North
Posts: 5,794
Quote:
Originally Posted by Si View Post
I've got a few things I have added into my site. That are using <?php include> tags.

One is in sidebar.php / one is in footer.php etc.

Problem is I only want to display these includes on the main page.

What's the best way to do it?

PHP Code:
<?php
wp_reset_query
();
if (
is_home() ) {
echo 
'Put All Your Shit In Here';

?>
Alternatively, is something like this.

PHP Code:
        <?php if (is_home()) { ?>
        <h1><a href="<?php echo get_settings('home'); ?>/"><img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" /></a></h1>
        <?php } else { ?>
        <h4><a href="<?php echo get_settings('home'); ?>/"><img src="<?php bloginfo('template_url'); ?>/images/logo.png" alt="<?php bloginfo('name'); ?>" /></a></h4>
        <?php ?>

Here's a good way to pick out certain categories (for picking out and advertising only gay sites on gay/tranny as per this example)

PHP Code:
<?php
if (is_home() ) {
    include(
TEMPLATEPATH."/banner.php");
} else if ( 
is_category'gay-dicks' ) || post_is_in_descendant_category25 ) ) {
    include(
TEMPLATEPATH."/bangay.php");
} else if ( 
is_category'tranny' ) || post_is_in_descendant_category66 ) ) {
    include(
TEMPLATEPATH."/bantranny.php");
} else {
    include(
TEMPLATEPATH."/banner.php");
}
?>
__________________
LinkSpun - Premier Adult Link Trading Community - ICQ - 464/\281/\250
Be Seen By New Webmasters/Affiliates * Target out webmasters/affiliates based on niches your sites are for less than $20 a month.
AmeriNOC - Proudly hosted @ AmeriNOC!
Jdoughs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 08:59 AM   #3
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,220
what jdoughs said
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 09:16 AM   #4
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Thanks J

I remember you posting something about it before, but couldn't find the thread.

This should work perfectly
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 09:57 AM   #5
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,220
what is it you wanna only display on home?
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 10:27 AM   #6
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Quote:
Originally Posted by fris View Post
what is it you wanna only display on home?
2 php includes.

Going to try it out in a second. Will report back with my result
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 10:52 AM   #7
BSleazy
Confirmed User
 
Industry Role:
Join Date: Aug 2002
Location: USA
Posts: 6,721
Have any of you guys seen a plugin that will let you put links only in certain categories? I looked real quick the other day but didn't see anything.
__________________
icq 156131086
BSleazy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 11:01 AM   #8
Jdoughs
Confirmed User
 
Jdoughs's Avatar
 
Industry Role:
Join Date: Mar 2004
Location: Great White North
Posts: 5,794
Quote:
Originally Posted by BCyber View Post
Have any of you guys seen a plugin that will let you put links only in certain categories? I looked real quick the other day but didn't see anything.
There probably is a few plugin solutions that do it now but I've always used my category and tag descriptions to show unique content/links on my cat/tag pages.

PHP Code:
<?php $category get_the_category();
echo 
$category[0]->category_description?>
You can put full html in the description fields, you can basically build full pages in there and pull them if you wanted to.
__________________
LinkSpun - Premier Adult Link Trading Community - ICQ - 464/\281/\250
Be Seen By New Webmasters/Affiliates * Target out webmasters/affiliates based on niches your sites are for less than $20 a month.
AmeriNOC - Proudly hosted @ AmeriNOC!
Jdoughs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 11:12 AM   #9
Si
Such Fun!
 
Industry Role:
Join Date: Feb 2008
Posts: 13,900
Ok it definately works. but wouldn't work with a php include unless I done it wrong.

Here is what i tried below:

<?php
wp_reset_query();
if (is_home() ) {
echo '<?php include "/include.html"; ?>';
}
?>

Unless I have to put the full file location in there. will try that now.
Si is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 11:31 AM   #10
VladS
Available for Coding Work
 
VladS's Avatar
 
Industry Role:
Join Date: Jun 2008
Posts: 1,432
Code:
<?php
wp_reset_query();
if (is_home() ) {
include "/include.html";
}
?>
__________________
<developer> MechBunny / KVS / PHP / MySQL / HTML5 / CSS3 / jQuery
Email: vlad [at] faxite.com
Telegram: @dangerouscoding
VladS is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 11-22-2010, 01:21 PM   #11
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,220
Quote:
Originally Posted by Si View Post
Ok it definately works. but wouldn't work with a php include unless I done it wrong.

Here is what i tried below:

<?php
wp_reset_query();
if (is_home() ) {
echo '<?php include "/include.html"; ?>';
}
?>

Unless I have to put the full file location in there. will try that now.
Code:
<?php if ( is_home() ) : ?>
<?php include (TEMPLATEPATH . '/include.html'); ?>
<?php endif ; ?>
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.