Wednesday, November 9, 2022
HomeWordPress Developmentplugin improvement - right solution to embody an exterior HTML web page...

plugin improvement – right solution to embody an exterior HTML web page in WP-admin


I need to add a web page that I’ve already to seem within the WP-admin, so I added a brand new merchandise to WP admin menu

add_action('admin_menu', 'test_plugin_setup_menu');
 
perform test_plugin_setup_menu(){
    add_menu_page( 'Check Plugin Web page', ' add conent', 'manage_options', 'test-plugin', 'test_init' );
}
 
perform test_init(){
    //echo "<h1>Good day World!</h1>";
    echo file_get_contents("..wp-contentpluginsmy-pluginform2.php");

}

Discover right here in my test_init I simply throw the file through file_get_contents

And my form2 file contents HTML headers:

<!DOCTYPE html>
<html>
<head>
<!-- Newest compiled and minified CSS -->
<hyperlink rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="nameless">

<hyperlink href="https://cdn.jsdelivr.internet/npm/froala-editor@3.0.0/css/froala_editor.pkgd.min.css" rel="stylesheet" kind="textual content/css" />
<script kind="textual content/javascript" src="https://cdn.jsdelivr.internet/npm/froala-editor@3.0.0/js/froala_editor.pkgd.min.js"></script>

<model>
 ...
</model>

</head>
<physique>
<!-- HTML for FORM code goes right here -->
</physique>


Now my 2 questions are :

Is that this the proper approach to do that? is there any WordPress-ish approach to do that correctly utilizing file_get_contents will not execute the PHP elements of the file (HTML code printed with a PHP loop)…

Additionally, does the truth that my customized HTML/PHP file has some types and JS imported by itself trigger any battle with the complete web site and the theme? or are these solely used domestically within the context of the shape?

Edit: further query, as soon as the above points are addressed how do I forestall direct entry to …my-plugin/form2.php

RELATED ARTICLES

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisment -
Google search engine

Most Popular

Recent Comments