Tuesday, January 17, 2012

How to create a short plugin with short code

ob_start();

/*

Plugin Name:Plugin_PDF

Plugin URI: http://vikasbruce.blogspot.com/


Author: Vikas Gautam



*/


add_action('admin_menu', 'add_admin_panel');

function add_admin_panel(){

$icon_path = get_option('siteurl').'/wp-content/plugins/'.basename(dirname(__FILE__)).'/icon';

add_menu_page('Plugin_PDF', 'Plugin_PDF','read','my-plug','',$icon_path.'/icon.png');

add_submenu_page('my-plug', 'Plugin_PDF', '1st Submenu', 'read', 'my-plug','my_menu_default');

}

function my_menu_default()

{

echo "Hello Admin Section ";

}
function show_data()
{
echo "hello user Section ";

}
add_shortcode('Download', 'show_data');

?>


by plugin you can easily use the shortcode [Download]

to show the data any post or page

to ahow the data in template you can use
echo do_shortcode([Download]);

5 comments:

  1. https://www.servage.net/blog/2009/03/20/create-a-cool-css-based-drop-down-menu/

    ReplyDelete
  2. http://aviathemes.com/aviaslider/

    ReplyDelete
  3. http://www.noupe.com/jquery/cool-and-useful-jquery-image-and-content-sliders-and-slideshows.html

    ReplyDelete
  4. http://www.tripwiremagazine.com/2012/02/jquery-image-slider-plugins.html

    ReplyDelete