get public plugin url wordpress code example
Example 1: how to get plugin directory path in wordpress
if ( is_admin() ) {
include_once( plugin_dir_path( __FILE__ ) . 'includes/admin-functions.php' );
} else {
include_once( plugin_dir_path( __FILE__ ) . 'includes/front-end-functions.php' );
}
Example 2: how to get plugin directory path in wordpress
function myplugin_scripts() {
wp_register_style( 'foo-styles', plugin_dir_url( __FILE__ ) . 'assets/foo-styles.css' );
wp_enqueue_style( 'foo-styles' );
}
add_action( 'wp_enqueue_scripts', 'myplugin_scripts' );
Answer
http: