Download Template Plugin Code

 

This page provides a form to download template code for writing a WordPress plugin. However, you don’t need any of this to write a WordPress plugin. Especially a simple one. You can get along OK by following the standard directions on how to create a plugin.

So why bother? If you write a more complex plugin, or several plugins, you have to figure out how to manage things like actions that should only happen on the first install, actions to take when upgrading from version X to version Y, and creating some boiler plate code related to creating an administrative options page, short codes and more. You also want to exercise best practices. See more on the Design Tenets page.

This template code and supporting documentation is my cut at template code that provides a code pattern for managing complexity, boiler plate code, convenience functions, and best practices for being a “good plugin citizen.”

Generate code for your plugin and see the Getting Started page.

NOTE: this template does NOT include support for WordPress Multisite.

(Example: "My Cool Plugin")
(Max 150 characters)
GPL-3, BSD
(Put just a name or an HTML A tag with link to your site)
(Directory name under wp-content/plugins/)
(label for i18n)
(like "PREFIX_Plugin.php")
Download

 

  68 Responses to “Download Template Plugin Code”

  1. Dude, yes! This is awesome. Great documentation as well. Thank you! Donation – done!

  2. SO SICK. Much needed and even more appreciated! Thanks 😀

  3. This is amazing. Thank you!

  4. Great stuff man!!!! Thanks! You saved me a ton of time.

  5. Takes a lot to get bookmarked by me…YOU DA MAN!

  6. WOW! This is great – thank you so much 🙂

  7. Lol, I have no idea what I’m going to do if this page ever goes away… this is incredibly useful.

  8. Exactly info I needed for my web following project. Thanks.

  9. You should throw some adsense on this page. Great tool!

  10. Thanks, very handy! Any chance of an announce list to be notified when you add new features?

    If interested in suggestions, I’d find a few more input field types on settings pages useful. And in the generate form, maybe put a checkbox to include some commonly used snippets like defining a post type and custom taxonomy.

  11. Simple awesome. Glad to pay $10 for this. Thank you so much!

  12. Thanks for taking the time to do this, it’s bloody useful

  13. This is AWESOME. Thank you so much for the time you put into this. It works great!

  14. Best template plugin for WordPress ever!

    You were third (in the UK) for a search of WordPress Template Plugin, which is also pretty good.

    Many many thanks! Once my new plugin is working, I will come back and donate!

  15. You say,

    “NOTE: this template does NOT include support for WordPress Multisite.”

    I have developed a plugin using this excellent template. I would like the plugin to multi-site compatible. How would you suggest that I proceed?

  16. Thank you Michael,

    I have done a little reading

    * “Professional WordPress” by Brad Williams et. al.
    * http://shibashake.com/wordpress-theme/write-a-plugin-for-wordpress-multi-site
    * http://www.wphub.com/tutorials/plugins-compatible-wordpress-multisite/
    * http://www.onextrapixel.com/2013/01/08/how-to-properly-code-your-plugin-for-a-wordpress-multisite/

    These are my early thoughts and will contain errors and omissions,

    Multisite (hereafter “Network”) changes some things relevant to your template

    * Plugins may be activated once for all present and _future_ blogs (Network activation) or activated for individual blogs

    * Plugin data can be stored in tables at the Network level or in tables as individual blogs

    * Network support additional features including
    ** superusers who manage a Network
    ** Network options
    *** Plugin authors must decide what are plugin options that are typically available two blog administrators in a back end administrator menu and what are network options that are only available to supers users in the network administrator menu.

    * Plugin code is called in the context of a blog with a $blog_id. This is important for reading and persisting data. For example, post data would be recalled from the current blog.

    The implications for your template can be viewed through the lens of the files

    * my-cool-plugin.php
    ** Comments to indicate that the author may set “Network: true” if the plugin is multisite compatible

    * MyCoolPlugin_Plugin.php
    ** Must optionally check for deployment within a Network and have a different behaviour

    * MyCoolPlugin_LifeCycle.php
    ** Lots of changes, needs to support Network Activation and/or activation of a single site within a Network

    * MyCoolPlugin_OptionsManager.php
    ** Must support Network Options

    At the moment it is true to say

    * “this template does not support multisite plugins”

    because there is not template code to support operation in a network.

    I am not sure it is true to say

    “this template is not multisite compatible”

    The later sentence implies that a plugin written using this template _must_ break. I think that this is not true. I have tested “Network activation” of plugin in a multisite network and it fails gracefully. That is to say that it simply returns with no message. When the plugin is activated on the site it works fine.

    If upon review and further testing you agree with my conclusion you may wish to change your communication to,

    “Multisite Compatibility
    A multisite network offers several capabilities to a plugin author such as network activation, network data storage and network options, that are not supported by this template. However a plugin written using this template should work correctly when activated within an individual site on the network.”

  17. Amazing tool, thanks

  18. Any update for supporting providers? I mean – wp_oembed_add_provider() ?

  19. msimpson – this site went down for a bit yesterday and I utterly panicked. I use this on a weekly basis, and it has become a huge part of my creation process.

    Do you have any plans to take this down at any point? Is this tool in version control, and would you consider making it open source?

    • I don’t plan to take it down. Every once in a while the hosting provider seems to have a problem. I should dump this on GitHub at some point.

  20. Great tool, need to use the wordpress css style the wrap or wrapper to make it look better.
    in my plugins i’m alway add a setting link in the WordPress plugins page
    Deactivate | Edit | Settings

  21. how can i create link to myu create plugin in wordpress?

  22. You code is a delight to read. So well done!

  23. Wonderful plugin generator! Strikes a good balance between functionality and cleanliness. Thanks a lot!

  24. Thank you … That’s all I can do at the moment!

  25. Github repo gone?

  26. faith in humanity… RESTORED!

    Thanks a lot man!

  27. Donated! Thanks a bunch for helping me get started with plugin development. 🙂

  28. Thanks for your amazing service, it’s really helpful for every developer. thaks again

  29. in the main php file plugin-name.php, on line 77 there is an add_action. The action name is plugins_loadedi, shouldn’t that be plugins_loaded??

  30. This is amazing, thanks so much – saved me a LOT of time.
    One question that’s driving me mad….

    I’m trying to populate the drop-down select options using a WP_Query.
    I have an array of IDs from the query and have tried to implode this array so that the string matches the format of your example options but the whole string shows as a single option instead of a new option for each comma in the string.

    Hope that makes sense! Any idea how I can get this to work?!
    Thanks!

  31. Super, thanks!

  32. Ohh thanks man, it’s good for noobs to start with

  33. Thank you for this, truly helpful and clean!

    In case it helps anyone I added an extra option to add the plugin into the top menu level:


    // In MyPlugin_LifeCycle.php
    public function addSettingsSubMenuPage() {
    //$this->addSettingsSubMenuPageToPluginsMenu();
    //$this->addSettingsSubMenuPageToSettingsMenu();
    $this->addSettingsSubMenuPageToTopLevelMenu();
    }

    ...
    protected function addSettingsSubMenuPageToTopLevelMenu() {
    $this->requireExtraPluginFiles();
    $displayName = $this->getPluginDisplayName();
    add_menu_page($displayName,
    $displayName,
    'manage_options',
    $this->getSettingsSlug(),
    array(&$this, 'settingsPage'),
    'dashicons-lightbulb' // Change icon as needed
    //, $menu_position
    );
    }

  34. Hmm é ninguém ter problemas com o fotos na carga deste blog?

    Estou tentando descobrir se é um problema do meu lado
    ou se é o blog. Qualquer respostas seria muito apreciada.

  35. I see you don’t monetize your page, don’t waste your traffic, you
    can earn additional bucks every month because you’ve
    got high quality content. If you want to know how to make extra $$$, search
    for: Boorfe’s tips best adsense alternative

  36. Thank you very much for this extremely useful resource. I’m just learning to write WP plugins and this helps tremendously. Thank you very much.

  37. Thank you. This has been useful in writing my 1st proper plugin for wordpress.

  38. You Rock!!! Thank you, great work.

  39. G᧐od post. І llearn something new and challenging on webѕites I stumbleupon everydаʏ.
    It will always be heelρful to read contеnt frߋm other aսthors and use somethіng fгom their weЬ sitеs.

  40. I have noticed you don’t monetize your website, don’t waste
    your traffic, you can earn additional cash every month.

    You can use the best adsense alternative for any type of website (they approve all
    websites), for more details simply search in gooogle: boorfe’s tips monetize your website

  41. I love u man

  42. Hello, do you sell your plugin generator script?

  43. Oi , eu li seu blog ocasionalmente e eu possuo uma similar e eu estava apenas curioso se você ganha um monte de spam observações?
    Se sim como é que parar , algum plugin ou alguma coisa que você pode recomendar?
    Recebo tanta coisa ultimamente que está me deixando louco então qualquer ajuda é muito apreciado.

  44. Спасибо за информацию!!!!!

  45. Hi there friends, how is the whole thing, and what you wish for
    to say regarding this piece of writing, in my view
    its really remarkable for me.

  46. Hi!

    You Need Leads, Sales, Conversions, Traffic for michael-simpson.com ?
    I Will Findet…

    Don’t believe me? Since you’re reading this message then you’re living proof that contact form advertising works!
    We can send your ad to people via their Website Contact Form.

    I WILL SEND 5 MILLION MESSAGES VIA WEBSITE CONTACT FORM

    IF YOU ARE INTERESTED, Contact us => lisaf2zw526@gmail.com

    Regards,
    Brough

  47. Я уверен, что мнение затронет всех
    поклонников авторского и действительно
    очень научного веб-сайта.

  48. Is Firepow Any Good for Creating WordPress Blogs?

  49. Круто! Некоторые пункты потрясающе
    тонко подмечены! Я ценю, что
    ты опубликовал эти посты и остальные данные они очень хороши.

  50. Автор мастерски ведет обсуждение по
    вопросу этой идеи именно в данном
    личном блоге, я прочитал
    все, и в данный момент мне также хочется прокомментировать материал.

  51. Все любят вещи, которые вы, ребята, так профессионально делаете.
    Настоящая научная работа и актуальные отчетности!
    Ваш блог замечательный!
    Я добавил адрес страницы в закладки!

    Ребята, вы крутые, огромный респект!

  52. Автор грамотно ведет разговор по поводу этой статьи
    именно в данном блоге, я прочитал все, и в данный момент
    мне также хочется прокомментировать информацию.

  53. идеальное, чтобы составить несколько
    планов на будущее. Я читал этот материал и, если необходимо,
    могу просто посоветовать вам немного интересных вещей
    или предложений. Может быть, вы могли бы написать последующие статьи
    в завершение этой. Я намереваюсь читать еще информации об этом!

  54. Hi, where i can find the repository for the generator?

    I’m work to make some changes to customize some code for specific uses…

    can you share it again on github?

  55. tool outof date check updated version on this site : wppb.me

  56. Grid and responsive system follows the twitter bootstrap system.

Leave a Reply to Lukáš Cancel reply

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>