Archived topic
Insert PHP code into footer.php
3 replies · Started by Robert Cioffi on July 5, 2017
Viewing posts 1–4 of 4
I'm trying to isert this code into my footer.php
if ( ($eventlisturl = get_post_meta( $post->ID, 'eventlisturl', true ) )) {
$eventlistoutput = file_get_contents( $eventlisturl );
$search = array( "$location", "$url" );
$replace = array( get_the_title(), "http://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
$eventlistoutput = str_replace( $search, $replace, $eventlistoutput );
echo $eventlistoutput;
}
I've also tried using the footer hook, but in either case the code just prints out on the bottom of my site. Any thoughts? Thanks.
PHP needs to be entered with opening and closing Tags
<?PHP code ?>
I thought so. Thanks.
Your welcome
This archived topic is closed to new replies.