damondicenzo;11021021 wrote:It's in a wordpress blog. So "home" is referring to the home page.
I tried fiddling around with it and have this now, that still doesn't work:
if(is_home() ) {
// nothing
} else {
function get_youtube($url){
$youtube = "http://www.youtube.com/oembed?url=". $url .";
}
$url = "http://www.youtube.com/watch?v=I8M_uCnxhwY";
print_r(get_youtube($url));
}
Pay attention to your syntax highlighting: see how the code changes colors (red text w/blue vars)? You've got an extra double-quote(") when you define [font=monospace]$youtube[/font] in your function, which is causing most of your code to be treated as part of that string. (Aside from that typo, you're also not returning anything from the function, so [font=monospace]print[/font]ing it is useless.)
You probably meant to do something like this?
<?php
// assuming is_home() returns TRUE or FALSE, yes?
if( !is_home() ){
$code = "I8M_uCnxhwY";
print get_youtube( $code );
}
function get_youtube( $code ){
return "<iframe width='560' height='315' src='http://www.youtube.com/embed/$code?rel=0' frameborder='0' allowfullscreen></iframe>";
}