add_feed failed to open stream

Remove the last / in include(TEMPLATEPATH . ‘/events.php/’); If you cannot find a file, check with file_exists( $path ) first. Also TEMPLATEPATH is deprecated now, use get_stylesheet_directory() instead. And your feed is located at /gpevent’, not/gpevents’ as Stephen Harris noted.

How can I include an external file in a post or page?

Use get_template_part to insert regularly used files throughout your site. Example of use: get_template_part( ‘PATH/FILE_NAME’ ); Where PATH is the location of the file you want to include, usually a folder within your theme/child-theme example(my-template-folder) NOTE! without leading slash. FILE_NAME is the name of your file, WITHOUT extension, example (my-regular-code.php becomes my-regular-code). So the above … Read more

Having trouble linking to file using relative path

I got this to work by using include_once(plugin_dir_path( __FILE__ ) . ‘/../tpls/frontend.php’); The file I’m using include_once in is itself included from the index.php file in the plugin’s root directory so, according to the documentation on the subject, a relative path to the file will be relative to the root directory, not the inc folder. … Read more

Wp Enviroment problem with included file

The error indicates that your file “floater.php” is being called outside of a WordPress generated page. Add this to the top of the file to be able to use WordPress functions. EDIT: See Brian Fegter response on using the server path for your include. if ( !function_exists( ‘get_bloginfo’ ) ) require( ‘../../../wp-blog-header.php’ ); // check … Read more

Can not include file from plugin into theme

This is because you are trying to include a directory by URL, you need to call path, you can use the constant WP_PLUGIN_DIR. Modifying the variable acf_url to the following would work. $acf_url = WP_PLUGIN_DIR . ‘/advanced-custom-fields/acf.php’;

What’s the best way to ‘include’ a file in WordPress?

You can include the PHP files in WordPress just the same way you do it anywhere else. However, WordPress offers more constants and functions for defining a path for the include() function. Instead of using $_SERVER[“DOCUMENT_ROOT”], move your PHP file to your theme’s folder, and use this to include it: require_once ( get_template_directory() . “/data.php”); … Read more