where you include the file try to give the full path
<?php bloginfo('template_directory'); ?>/js/jquery.php
سؤال
Warning: require_once(/js/jquery.php): failed to open stream: No such file or directory in /home1/jamie/public_html/drexelreviews.com/wp-content/themes/instant/functions.php on line 494
Fatal error: require_once(): Failed opening required '/js/jquery.php' (include_path='.:/opt/php54/lib/php') in /home1/jamie/public_html/drexelreviews.com/wp-content/themes/instant/functions.php on line 494
I open jquery.php and the file is blank,
Im not sure where this is coming from /opt/php54/lib/php Im running wordpress 3.8.1 in hostgator... any suggestions?
المحلول 3
where you include the file try to give the full path
<?php bloginfo('template_directory'); ?>/js/jquery.php
نصائح أخرى
If this is your dynamic js file you still need to enqueue it.. the code in functions.php can be something like this...
function my_scripts_method() {
wp_enqueue_script(
'custom-script',
get_stylesheet_directory_uri() . '/js/jquery.php',
array( 'jquery' )
);
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );
Io you are in a WordPress template file..
Try to call get_template_part('js/jquery');
Assuming you are using something like this to require the file
<?php require_once ('/js/jquery.php');?>
Wordpress will require the file from the root. so in this case there is no such file.
If you are requiring on a file inside your themes folder "e.g. foobar-theme" you need to require as
<?php require_once (get_template_directory_uri().'/js/jquery.php');?
>
Finall Note check if you have set the correct Mime type on top of your jquery.php (assuming your requirment is to run js code)
Content-Type: application/javascript