my wp plugin code:
<?php
/*
Plugin Name: ...
...
*/
class Pform {
function __construct() {
add_shortcode('pform', array($this, 'show_form');
}
function show_form() {
$html = <<<EOT
<form id="pform" action="#">
...
</form>
EOT;
return $html;
}
}
function efinstall() {
$tb_name = $wpdb->prefix . 'table';
if($wpdb->get_var("show tables like '$tb_name'") != $tb_name)
{
$sql = "CREATE TABLE " . $tb_name . " (
id mediumint(9) NOT NULL AUTO_INCREMENT,
...
UNIQUE KEY id (id)
);";
require_once(ABSPATH . 'wp-admin/includes/upgrade.php');
dbDelta($sql);
$form = new Pform();
}
}
register_activation_hook(__FILE__,'efinstall');
?>
After plugin activation db table is successfully created and no error is added to log, but [pform] shortcode doesn't work and there is no it in
<?php
global $shortcode_tags;
echo "<pre>"; print_r($shortcode_tags); echo "</pre>";
?>
output.
Any help would be appreciated!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire