I start developing my first WordPress plugin. All in all it works so far, but there is one point: I can´t include a second php file in the main plugin file.
Situation: Latest Divi and WordPress.
The plugin is used in the Divi via the Divi "code"-module. When I save the page in the Divi builder it works as long as I DON´T have included second file. When it is included I get the error the page can´t be saved. When I put // before the include line it´s getting saved without any problems.
I include it like this (part of the main plugin file):
function MYPLUGIN_shortcode($atts,$content) {
$finalContent="empty";
if(file_exists(plugin_dir_path( __FILE__ ) . 'second.php')) {
//include( plugin_dir_path( __FILE__ ) . 'second.php');
} else {
$finalContent = "second.php not found";
}
return $finalContent;
}
}
Just to add: the $finalContent should get calculated in the second.php file