Hey guys! So I've been working on a plugin which allows people to add an iframe depending on the input fields and then that is displayed when a shortcode is created.
However It isn't making it a shortcode.
<?php
/*
Plugin Name: Minepress Minecraft Dynmap Plugin
Plugin URI: http://minepress.co.uk
Description: Minepress Minecraft Dynmap Plugin
Author: Bradly spicer
Version: 0.0.1
Author URI: http://minepress.co.uk
*/
/*Installation of Plugin */
/* What to do when the plugin is activated? */
register_activation_hook(__FILE__,'MP_Dynmap_install');
/* What to do when the plugin is deactivated? */
register_deactivation_hook( __FILE__, 'MP_Dynmap_remove' );
function MP_Dynmap_install() {
/* Create a new database field */
add_option("MP_Dynmap_data", 'Testing !! My Plugin is Working Fine.', 'This is my first plugin panel data.', 'yes');
}
function MP_Dynmap_remove() {
/* Delete the database field */
delete_option('MP_Dynmap_data');
}
/*Admin Menu of Plugin*/
add_action('admin_menu', 'MP_Dynmap_admin_menu');
function MP_Dynmap_admin_menu() {
add_options_page('Plugin Admin Options', 'Minepress Dynmap Settings', 'manage_options',
__FILE__, 'MP_Dynmap_options_page');
}
/*Content inside the admin page*/
function MP_Dynmap_options_page()
{
?>
<?php
/* Var */
$port= "2183";
?>
<?php screen_icon(); ?>
<h2>Minepress Dynamic Map Settings</h2>
<form method="post" action="options.php">
<?php wp_nonce_field('update-options'); ?>
Enter IP: <input name="MP_Dynmap_IP_data" type="text" id="MP_Dynmap_IP_data"
value="<?php echo get_option('MP_Dynmap_IP_data'); ?>" /><p>
Enter Width: <input name="MP_Dynmap_Width_data" type="text" id="MP_Dynmap_Width_data"
value="<?php echo get_option('MP_Dynmap_Width_data'); ?>" /><p>
Enter Height: <input name="MP_Dynmap_Height_data" type="text" id="MP_Dynmap_Height_data"
value="<?php echo get_option('MP_Dynmap_Height_data'); ?>" /><p>
<input type="hidden" name="action" value="update" />
<input type="hidden" name="page_options" value="MP_Dynmap_IP_data, MP_Dynmap_Height_data, MP_Dynmap_Width_data" />
<input type="submit" value="Save Changes" />
</form>
<?php
$ip = get_option('MP_Dynmap_IP_data');
$width = get_option('MP_Dynmap_Width_data');
$height = get_option('MP_Dynmap_Height_data');
print "Your server details are: ". $ip .":". $port. " the width will be ". $width ." pixels and the height will be " . $height . " pixels";
?>
<?php
/*end of content*/
}
?>
<?php
/******
* OutCome
******/
function MP_dynmap_shortcode() {
?><html>
<iframe width = "<?php echo $width?>" height ="<?php echo $height?>" id="frame" src="<?php
$ip = "http://95.154.235.37";
echo $ip . ':8123/'; ?>"></iframe>
</html><?php
add_shortcode('MP_Dynmap', 'MP_dynmap_shortcode');
}
?>
This is intended to be a public plugin. Any help is appreciated.
Thanks