{"id":2510,"date":"2005-05-03T09:05:58","date_gmt":"2005-05-03T09:05:58","guid":{"rendered":"http:\/\/www.soulhuntre.com\/items\/date\/2005\/05\/03\/myplugin-v1\/"},"modified":"2005-05-03T09:05:58","modified_gmt":"2005-05-03T09:05:58","slug":"myplugin-v1","status":"publish","type":"post","link":"http:\/\/legacyiamsenseiken.local\/2005\/05\/03\/myplugin-v1\/","title":{"rendered":"MyPlugin V1"},"content":{"rendered":"

Snippets from a WordPress plugin I am working on… I spent a little time
\nhacking on this to get used to the structure. It’s pretty sweet and thanks to
\nthe "Writing
\na Plugin<\/a>" page it isn’t even crazy hard. Here is a step by step breakdown of
\nan actual, functioning (but lame) plugin called "MyPlugin".<\/p>\n

<\/p>\n

\n

<?php<\/p>\n

\/*
\n\tPlugin Name: MyPlugin
\n\tPlugin URI: http:\/\/www.soulhuntre.com
\n\tDescription: An example, minimalist WordPress plug-in
\n\tVersion: 1.0
\n\tAuthor: Soulhuntre
\n\tAuthor URI: http:\/\/www.soulhuntre.com
\n\t*\/<\/i><\/p>\n

\t\/\/ To register your plug-in with the menu system (under options)
\n\t\/\/ first you have to define a function that registers your new
\n\tadministration page.
\n\t\/\/ lets add our panel to the admin page, under "options" <\/i>
\n\tfunction MyPlugin_addmenu() {
\n    if (function_exists(‘add_options_page’)) {
\n        add_options_page(
\n            ‘MyPlugin’,
\n\t\/\/ plugin name
\n            ‘MyPlugin’,
\n\t\/\/ plugin name
\n            10, \/\/ only
\n\tadmins can use this
\n           
\n\tbasename(__FILE__), \/\/ a filename (unique)
\n            ‘MyPlugin_adminpage’
\n\t\/\/ the render function
\n        );
\n    }
\n\t}<\/p>\n

\t\/\/ Then, you need render function to actually display your admin page
\n\twhen the time is right…
\n\t\/\/ notice how it is defined in the add_options_page call above?
\n\t<\/i>function MyPlugin_adminpage(){
\n    echo "<h2>Hello World!<\/h2>";
\n\t}<\/p>\n

\/\/ And finally, we register a handler with WordPress
\/\/ so that our add
\n\tto menu function will be called at the right time…
\n\t<\/i>add_action(‘admin_menu’, ‘MyPlugin_addmenu’);<\/p>\n

?><\/p>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"

Snippets from a WordPress plugin I am working on… I spent a little time hacking on this to get used to the structure. It’s pretty sweet and thanks to the "Writing a Plugin" page it isn’t even crazy hard. Here is a step by step breakdown of an actual, functioning (but lame) plugin called "MyPlugin".<\/p>\n","protected":false},"author":3,"featured_media":53162,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"aside","meta":{"footnotes":""},"categories":[278],"tags":[],"_links":{"self":[{"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/posts\/2510"}],"collection":[{"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/comments?post=2510"}],"version-history":[{"count":0,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/posts\/2510\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/media\/53162"}],"wp:attachment":[{"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/media?parent=2510"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/categories?post=2510"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/legacyiamsenseiken.local\/wp-json\/wp\/v2\/tags?post=2510"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}