user1122925
user1122925

Reputation: 237

Wordpress require_once( ) - path returning an error

<?php 
require_once (bloginfo('template_url') . '/form_producer/form_producer.php');
$form_prod_url = bloginfo('template_url').'/form_producer';
?>

How can I edit the PHP above to include 'form_producer.php' and the file 'form_producer'.

All this does is return an error and I'm unsure why.

EDIT: I have changed bloginfo to ('template_url') which is where the folders are. Still returning errors

Upvotes: 0

Views: 2001

Answers (2)

Pekka
Pekka

Reputation: 449733

For your include statement, use template_directory (the physical path) instead of template_url (the URL):

require_once (bloginfo('template_directory') . '/form_producer/form_producer.php');

for the URL, I don't understand which path you want to create. If you want to point to the form_producer directory, your

$form_prod_url = bloginfo('template_url').'/form_producer';

should work. If it doesn't, show us what those strings contain and how they vary from what you want.

Upvotes: 2

silly
silly

Reputation: 7887

you have a syntax error in your second line, try this

<?php 
require_once (get_bloginfo('url') . 'form_producer/form_producer.php');
$form_prod_url = get_bloginfo('url').'/form_producer';
?>

Upvotes: 0

Related Questions