0

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

Edited by bradly.spicer

2
Contributors
2
Replies
4
Views
4 Years
Discussion Span
Last Post by bradly.spicer
-1

I would suggest visting some beginner tutorials, I don't think you quite understand how to code in PHP.

0

That is an absolutely waste of a post. It's not a matter of working with just PHP it is the fact I have to use the Wordpress functionality. Please don't waste time on my thread.
Just to prove how stupid you are, I edited it ever so slightly and got it working

Edited by bradly.spicer

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.