Create page and content
-
Hello,
I’am a beginer in plugin développement, and i am trying to create a page with an form inside…
I create a class in which i use wp_insert_post and it is ok, but now, i don’t know how(or where!?) should i write code for my form…
This class is instancied from admin menu.That’s an extract of code:
<?php class register_page { private $id_page; public function __construct() { //Cree une page $my_post = array( 'post_title' => 'Inscription Individuelle Generee', 'post_content' => 'This is my Page.', 'post_type' => 'page', 'post_status' => 'publish', 'post_author' => 1, ); // Insert the post into the database $id_page = wp_insert_post( $my_post ); // //add_action('the_post', array($this,'register_page_construct')); add_filter('publish_post', array($this,'register_page_construct')); // write in table a log to controle this code is active include_once plugin_dir_path( __FILE__ ).'/sql_tool.php'; $sqlTool = new sql_tool(); $sqlTool->debug_log("creation de la page"); } public function register_page_construct($content) { // if ( is_page ($id_page) ) // { echo "<h1>COUCOU</h1>"; //write in table a log to controle this code is active include_once plugin_dir_path( __FILE__ ).'/sql_tool.php'; $sqlTool = new sql_tool(); $sqlTool->debug_log("page_chargee"); // } } } ?>Please help me!
Thanks,
Sebastien
Viewing 6 replies - 1 through 6 (of 6 total)
Viewing 6 replies - 1 through 6 (of 6 total)
The topic ‘Create page and content’ is closed to new replies.