Plugin Author
Damian
(@timersys)
HI Mdotk can you be more specific ? What you mean by PHP does not run?
You can also use do_shortcode() functions if you feel more confortable with shortcodes
Thread Starter
mdotk
(@mdotk)
Hi there, I mean the PHP command is not executed. If I look in the site source code in Chrome it does not show up – there is an error in the PHP above somewhere (I don’t know PHP).
Do you know what the specific PHP code would be for targeting Americans only with an Adsense ad block?
Thanks
Plugin Author
Damian
(@timersys)
That one should work. Try changing united states for US
Thread Starter
mdotk
(@mdotk)
Thanks for continuing to work with me on this one…
I put the following exactly in my footer.php
<?php if ( geot_target(array( 'United States' )) ) {
ADSENSE ADS
} ?>
And get:
2015/05/11 15:37:25 [error] 29406#0: *26913941 FastCGI sent in stderr: “PHP message: PHP Parse error: syntax error, unexpected ‘ADS’ (T_STRING) in /var/www/site.com/htdocs/wp-content/themes/twentyfourteen-child-theme/footer.php on line 20” while reading response header from upstream, client: 42.113.219.189, server: site.com, request: “GET /url/ HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “www.site.com”, referrer: “http://www.site.com/url/”
And if I put the following in, exactly
<?php if ( geot_target(array( 'United States' )) ) {
ADSENSE
} ?>
I get:
2015/05/11 15:39:45 [error] 29405#0: *26917982 FastCGI sent in stderr: “PHP message: PHP Parse error: syntax error, unexpected ‘}’ in /var/www/site.com/htdocs/wp-content/themes/twentyfourteen-child-theme/footer.php on line 21” while reading response header from upstream, client: 209.155.200.206, server: site.com, request: “GET / HTTP/1.1”, upstream: “fastcgi://127.0.0.1:9000”, host: “www.site.com”
Thread Starter
mdotk
(@mdotk)
Thanks for continuing to work with me on this one…
I put the following exactly in my footer.php
<?php if ( geot_target(array( 'United States' )) ) {
ADSENSE ADS
} ?>
And get:
2015/05/11 15:37:25 [error] 29406#0: *26913941 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected 'ADS' (T_STRING) in /var/www/site.com/htdocs/wp-content/themes/twentyfourteen-child-theme/footer.php on line 20" while reading response header from upstream, client: 42.113.219.189, server: site.com, request: "GET /url/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.site.com", referrer: "http://www.site.com/url/"
And if I put the following in, exactly
<?php if ( geot_target(array( 'United States' )) ) {
ADSENSE
} ?>
I get:
2015/05/11 15:39:45 [error] 29405#0: *26917982 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected '}' in /var/www/site.com/htdocs/wp-content/themes/twentyfourteen-child-theme/footer.php on line 21" while reading response header from upstream, client: 209.155.200.206, server: site.com, request: "GET / HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.site.com"
Do I need to use echo or PHP include or something for the actual adsense ad code? Would you happen to know how to do that?
Thank you!!
Plugin Author
Damian
(@timersys)
But you need to put some actual code in middle to get it working and if it’s html code you need to close php tags. For example:
<?php if ( geot_target(array( 'United States' )) ) {?>
HTML CODE IN HERE
<?php} ?>
Thread Starter
mdotk
(@mdotk)
Thank you, I feel like we are getting close! Now the error is:
2015/05/11 16:06:16 [error] 29406#0: *26968181 FastCGI sent in stderr: "PHP message: PHP Parse error: syntax error, unexpected end of file in /var/www/site.com/htdocs/wp-content/themes/twentyfourteen-child-theme/footer.php on line 58" while reading response header from upstream, client: 68.57.3.112, server: site.com, request: "GET /cheats/ HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.site.com", referrer: "http://www.site.com/"
Plugin Author
Damian
(@timersys)
just paste the whole footer in some service like pastebin