GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Which WP function do I need to display certain things includes on the main page only? (https://gfy.com/showthread.php?t=998617)

Si 11-22-2010 08:12 AM

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?

Jdoughs 11-22-2010 08:47 AM

Quote:

Originally Posted by Si (Post 17718543)
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");
}
?>


fris 11-22-2010 08:59 AM

what jdoughs said

Si 11-22-2010 09:16 AM

Thanks J :thumbsup

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

This should work perfectly

fris 11-22-2010 09:57 AM

what is it you wanna only display on home?

Si 11-22-2010 10:27 AM

Quote:

Originally Posted by fris (Post 17718853)
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 :thumbsup

BSleazy 11-22-2010 10:52 AM

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.

Jdoughs 11-22-2010 11:01 AM

Quote:

Originally Posted by BCyber (Post 17719009)
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.

Si 11-22-2010 11:12 AM

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.

VladS 11-22-2010 11:31 AM

Code:

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


fris 11-22-2010 01:21 PM

Quote:

Originally Posted by Si (Post 17719087)
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 ; ?>



All times are GMT -7. The time now is 10:09 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc