Site icon Hip-Hop Website Design and Development

wordpress plugin add web page when activate

I’ve written a WordPress plugin and need to make new web page when plugin activate I attempted by the next its loading solely html its not together with css style-sheet which is included in html file

if ( ! outlined( 'WPINC' ) ) {
die;

}

/CUSTOMIZE_THIS/_Controller::init();

class /CUSTOMIZE_THIS/_Controller {
operate init() {
register_activation_hook( _FILE, array( _CLASS, ‘activate’ ) );
register_deactivation_hook( _FILE, array( _CLASS, ‘deactivate’ ) );
}
operate activate() {
// Add choices, provoke cron jobs right here
register_uninstall_hook( _FILE, array( _CLASS, ‘uninstall’ ) );
}
operate deactivate() {
// Take away cron jobs right here
}
operate uninstall() {
// Delete choices right here
}
}
add_action( ‘customized’, ‘add_my_custom_page’ );

operate add_my_custom_page() {
// Create put up object
$my_post = array(
‘post_title’ => wp_strip_all_tags( ‘My Customized Web page’ ),
‘post_content’ => ‘My customized web page content material’,
‘post_status’ => ‘publish’,
‘post_author’ => 1,
‘post_type’ => ‘web page’,
);

// Insert the put up into the database
wp_insert_post( $my_post );

}

register_activation_hook(FILE, ‘add_my_custom_page’);

add_filter( ‘page_template’, ‘wpa3396_page_template’ );
operate wpa3396_page_template( $page_template )
{
if ( is_page( ‘My Customized Web page’ ) ) {
$page_template = dirname( FILE ) . ‘/registration.html’;
}
return $page_template;
}

add_action(‘wp_enqueue_scripts’,’register_my_scripts’);

operate register_my_scripts(){
if ( is_page( ‘My Customized Web page’ ) ) {
wp_enqueue_style( ‘style1’, plugins_url( ‘registration.css’ , FILE ) );
}
}