Pardon newbie question - but I've been fighting this for a few days... Writing a WP plugin - I've created a WP menu that calls specific functions:
function my_plugin_options() {
if ( !current_user_can( 'manage_options' ) ) {
wp_die( __( 'You do not have sufficient permissions to access this page.' ) );
}
echo '<div class="wrap">';
echo '<p>This is the page for the main info.</p>';
echo '</div>';
The middle echo statement prints the text on the page. Here's what I want it to do: go down one subdirectory from where this file is currently listed and insert a separate .PHP file in the that space. Any assistance appreciated.
Figured it out myself:
replace the middle echo with
require_once plugin_dir_path( __FILE__ ) . 'subdir/filename.html';
You can use PHP function dirname() http://php.net/manual/en/function.dirname.php You'll get parent directory if you use this code
dirname(plugin_dir_path(__FILE__)