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 02-20-2011, 05:44 PM   #1
bloggerz
Too lazy to set a custom title
 
bloggerz's Avatar
 
Industry Role:
Join Date: Dec 2006
Posts: 16,256
:stop Fatal error: Call to undefined function is_home()

hi looking for some help here!

I'm using this code to display something on the home page only, not on the category, posts, or archives pages.

This is the code:

<?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>
ADVERTISEMENT HERE

<?php } ?>

But when I use that I get this error:

Fatal error: Call to undefined function is_home()


Any help is much appreciated thanks!
__________________
I SELL ADULT BACKLINKS! Email: eroticweb>gmail SKYPE: gfybloggerz

$$$$$ MAKE HUGE MONEY IN CAMS - CLICK HERE $$$$$
bloggerz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 06:26 PM   #2
BittieBucks Eric
Confirmed User
 
Industry Role:
Join Date: Aug 2010
Posts: 457
yes, you're using a function "is_home()" and "is_page()" in an equasion. I don't think you can do that.
__________________

Bittie Bucks - Upto 70% Revshare - CCBill Cascading Program - 10% Webmaster Referral
[email protected] - ICQ - 594415957


Need Content TRASHY CONTENT
BittieBucks Eric is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 07:08 PM   #3
HarryMuff
Confirmed User
 
HarryMuff's Avatar
 
Join Date: Dec 2005
Posts: 271
Quote:
Originally Posted by BittieBucks Eric View Post
yes, you're using a function "is_home()" and "is_page()" in an equasion. I don't think you can do that.
Of course you can, the condition statement expects those functions to return a boolean.

The problem you have is that the functions are not defined. (You need to have the functions included in the php file).
HarryMuff is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 07:11 PM   #4
bloggerz
Too lazy to set a custom title
 
bloggerz's Avatar
 
Industry Role:
Join Date: Dec 2006
Posts: 16,256
You have the code? Pls copy andpaste thx
__________________
I SELL ADULT BACKLINKS! Email: eroticweb>gmail SKYPE: gfybloggerz

$$$$$ MAKE HUGE MONEY IN CAMS - CLICK HERE $$$$$
bloggerz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 07:13 PM   #5
HarryMuff
Confirmed User
 
HarryMuff's Avatar
 
Join Date: Dec 2005
Posts: 271
Why would I have your code?
HarryMuff is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 07:40 PM   #6
brassmonkey
Pay It Forward
 
brassmonkey's Avatar
 
Industry Role:
Join Date: Sep 2005
Location: Yo Mama House
Posts: 77,061
Quote:
Originally Posted by HarryMuff View Post
Why would I have your code?
__________________
TRUMP 2025 KEKAW!!! - The Laken Riley Act Is Law!
DACA ENDED - SUPPORT AZ HCR 2060 52R - email: brassballz-at-techie.com
brassmonkey is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 07:40 PM   #7
FlexxAeon
Confirmed User
 
FlexxAeon's Avatar
 
Industry Role:
Join Date: May 2003
Posts: 3,765
is it near the top of the page? maybe you're using it before the functions are called in
__________________
flexx [dot] aeon [at] gmail

Last edited by FlexxAeon; 02-20-2011 at 07:41 PM..
FlexxAeon is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 08:52 PM   #8
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,339
Quote:
Originally Posted by bloggerz View Post
hi looking for some help here!

I'm using this code to display something on the home page only, not on the category, posts, or archives pages.

This is the code:

<?php if(is_home() && $post==$posts[0] && !is_paged()) { ?>
ADVERTISEMENT HERE

<?php } ?>

But when I use that I get this error:

Fatal error: Call to undefined function is_home()


Any help is much appreciated thanks!

Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
this should do it.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 09:17 PM   #9
martinsc
Too lazy to set a custom title
 
Industry Role:
Join Date: Jun 2005
Location: 127.0.0.1
Posts: 27,047
Quote:
Originally Posted by fris View Post
Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
this should do it.
a true ninja
__________________
Make Money
martinsc is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-20-2011, 10:15 PM   #10
HarryMuff
Confirmed User
 
HarryMuff's Avatar
 
Join Date: Dec 2005
Posts: 271
That code is disgusting
HarryMuff is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 01:32 AM   #11
grumpy
Too lazy to set a custom title
 
grumpy's Avatar
 
Join Date: Jan 2002
Location: Holland
Posts: 9,870
Quote:
Originally Posted by fris View Post
Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
this should do it.
wont solve : function not found.
__________________
Don't let greediness blur your vision | You gotta let some shit slide
icq - 441-456-888
grumpy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 02:32 AM   #12
mlove
the guy
 
mlove's Avatar
 
Industry Role:
Join Date: Apr 2005
Posts: 764
is_home() isn't a native php function. It couldn't ever be, and i'm not even going to begin to explain why.

However, At some point, it's probably been written in some script you previously had.

Are you defining this function elsewhere in your codebase? If so, you'll need to use include() to pull the file that defines the function into the script you're working with. It's kinda like writing something like:

Code:
<? fucking(); ?>
This will not work on it's own, but if you have your fucking() function defined in a file like includes/func.fucking.php:

Code:
<? function fucking() { echo "do the bartman"; } ?>
Then you'll be able to use that function.:

Code:
<? include('includes/func.fucking.php'); fucking(); ?>
and then your code would work. But to save on execution time (opening multiple files takes longer), you could do:

Code:
<?  function fucking() { echo "do the bartman"; } fucking(); ?>
__________________
If you won't feel as good, I won't feel as cheap.
mlove is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 02:49 AM   #13
Danmixz
Confirmed User
 
Industry Role:
Join Date: Sep 2010
Posts: 649
PHP Code:
<?php
$homepage 
"/";
$currentpage $_SERVER['REQUEST_URI'];
if(
$homepage==$currentpage) {
echo 
'Adcode here' ;
}
?>
__________________
Danmixz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 05:37 AM   #14
Zyber
Confirmed User
 
Industry Role:
Join Date: Aug 2001
Posts: 832
Quote:
Originally Posted by Danmixz View Post
PHP Code:
<?php
$homepage 
"/";
$currentpage $_SERVER['REQUEST_URI'];
if(
$homepage==$currentpage) {
echo 
'Adcode here' ;
}
?>
Why create unnecessary variables - when less can do it?

Code:
<?php
if($_SERVER['REQUEST_URI'] == '/') {
 echo 'Adcode here';
}
?>

Last edited by Zyber; 02-21-2011 at 05:39 AM..
Zyber is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 08:47 AM   #15
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,339
Quote:
Originally Posted by grumpy View Post
wont solve : function not found.
where are you using the code?

i added it to a current theme, and it worked like a charm.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 08:08 PM   #16
bloggerz
Too lazy to set a custom title
 
bloggerz's Avatar
 
Industry Role:
Join Date: Dec 2006
Posts: 16,256
Quote:
Originally Posted by fris View Post
Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
this should do it.

Do i need to add something in functions.php or something?
Im still getting Fatal error: Call to undefined function is_home()
__________________
I SELL ADULT BACKLINKS! Email: eroticweb>gmail SKYPE: gfybloggerz

$$$$$ MAKE HUGE MONEY IN CAMS - CLICK HERE $$$$$
bloggerz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 09:35 PM   #17
potter
Confirmed User
 
Industry Role:
Join Date: Dec 2004
Location: Denver
Posts: 6,559
Quote:
Originally Posted by fris View Post
Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
this should do it.
It looks like he wants AND statements, not OR statements?

What I don't get is why you need all the other statements. If it is the home page, then when or why would archive, paged, category, tag, or single ever return? Seems odd to me (though I don't use wordpress a lot).
__________________

potter is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 09:42 PM   #18
potter
Confirmed User
 
Industry Role:
Join Date: Dec 2004
Location: Denver
Posts: 6,559
Now that I think about it, wouldn't

Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
Return the ad on a lot more pages than the home page? You're code is basically saying...

[b]Show the ad if:
• It's the home page
• Or if it's not the archive
• Or if it's not paged
• Or if it's not a category
• Or if it's not a tag
• Or if it's not a single.[b]

So it would display the ad on any page that wasn't the archive for instance. Because with all the "OR" double pipes, only one of those circumstances needs to be true for the ad to display.
__________________

potter is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 10:14 PM   #19
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,339
Quote:
Originally Posted by bloggerz View Post
Do i need to add something in functions.php or something?
Im still getting Fatal error: Call to undefined function is_home()
where are you adding is_home to?
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-21-2011, 10:16 PM   #20
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,339
Quote:
Originally Posted by potter View Post
Now that I think about it, wouldn't

Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
Return the ad on a lot more pages than the home page? You're code is basically saying...

[b]Show the ad if:
? It's the home page
? Or if it's not the archive
? Or if it's not paged
? Or if it's not a category
? Or if it's not a tag
? Or if it's not a single.[b]

So it would display the ad on any page that wasn't the archive for instance. Because with all the "OR" double pipes, only one of those circumstances needs to be true for the ad to display.
it will only show on the front page.

using that code if i view a category or tag page or full post, it doesnt show the ad.

only on the home, not any paged page2,page3, etc.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-22-2011, 12:22 AM   #21
bloggerz
Too lazy to set a custom title
 
bloggerz's Avatar
 
Industry Role:
Join Date: Dec 2006
Posts: 16,256
Quote:
Originally Posted by fris View Post
where are you adding is_home to?
An external php file and im calling it through php include
__________________
I SELL ADULT BACKLINKS! Email: eroticweb>gmail SKYPE: gfybloggerz

$$$$$ MAKE HUGE MONEY IN CAMS - CLICK HERE $$$$$
bloggerz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-22-2011, 03:06 AM   #22
mlove
the guy
 
mlove's Avatar
 
Industry Role:
Join Date: Apr 2005
Posts: 764
you are an idiot.
__________________
If you won't feel as good, I won't feel as cheap.
mlove is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-22-2011, 06:20 AM   #23
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,339
Quote:
Originally Posted by bloggerz View Post
An external php file and im calling it through php include
well of course it wont work then ;)

its a wordpress function.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-22-2011, 08:07 AM   #24
potter
Confirmed User
 
Industry Role:
Join Date: Dec 2004
Location: Denver
Posts: 6,559
Quote:
Originally Posted by fris View Post
it will only show on the front page.

using that code if i view a category or tag page or full post, it doesnt show the ad.

only on the home, not any paged page2,page3, etc.
Well, it's not-category, and not-paged. My point was

Why not simply use:

Code:
<?php if (is_home()) {?>

ad here.

<?php } ?>
??

Because using

Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
Is exactly the same as putting:

Code:
<?php if (is_home()) {?>

ad here.

<?php } ?>
and
Code:
<?php if (!is_archive()) {?>

ad here.

<?php } ?>
On the same page. So not only will it show up on the home page, but it would want to be shown on any page that ISN'T an archive page.

Maybe I'm not explaining myself, but I just don't understand the point of having alllll those extra OR statements?
__________________

potter is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-22-2011, 09:45 AM   #25
fris
Too lazy to set a custom title
 
fris's Avatar
 
Industry Role:
Join Date: Aug 2002
Posts: 55,339
Quote:
Originally Posted by potter View Post
Well, it's not-category, and not-paged. My point was

Why not simply use:

Code:
<?php if (is_home()) {?>

ad here.

<?php } ?>
??

Because using

Code:
<?php if (is_home() || !is_archive() || !is_paged() || !is_category() || !is_tag() || !is_single()) {?>

ad here.

<?php } ?>
Is exactly the same as putting:

Code:
<?php if (is_home()) {?>

ad here.

<?php } ?>
and
Code:
<?php if (!is_archive()) {?>

ad here.

<?php } ?>
On the same page. So not only will it show up on the home page, but it would want to be shown on any page that ISN'T an archive page.

Maybe I'm not explaining myself, but I just don't understand the point of having alllll those extra OR statements?
ya you would still need to have !is_paged() though, cause home is considered page2 page3 of the index
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence.


WP Stuff
fris is online now   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 02-22-2011, 10:19 AM   #26
potter
Confirmed User
 
Industry Role:
Join Date: Dec 2004
Location: Denver
Posts: 6,559
Quote:
Originally Posted by fris View Post
ya you would still need to have !is_paged() though, cause home is considered page2 page3 of the index
weird... I suppose it'll all make sense if I ever use wordpress again and see the code and the way the system functions.
__________________

potter 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.