Friday, April 3, 2015

How to building your own WordPress plugin

This post will tell you steps to building your own WordPress plugin.
Today CMS WordPress is a very popular platform or the most popular blogging. It use plugin to extended it ability to perform a lot of functions with a very successful. WordPress plugin is so easy to build just create a main file structure and use CMS provided any function and event hooks to drive your tools and it is use PHP to make pretty accessible.
Now let's start together with a simple plugin:

+ At first is create a folder and named it: limon-font-type
+ And i Create a file name : limon-font-type.php
+ In this file limon-font-type.php it start write code step by step:

<?php
add_action('admin_menu', 'myfirstplugin_admin_actions');
function myfirstplugin_admin_actions(){
    add_options_page('Limon font type', 'Limon font type', 'manage_options', __FILE__, 'myfirstplugin_admin');
}
function myfirstplugin_admin(){
    ?>
    <div class="wrap">
    <p> How to use: please copy this shortcode to put where you want.</p>
    <p> Using ex: <b> &lt;font&gt;Text to display&lt;/font&gt;</b></p>
    <p>Vidoe:</p>
    <p><iframe width="560" height="315" src="//www.youtube.com/embed/rret" frameborder="0" allowfullscreen></iframe>
    </p>
    <p>Support: <br />- ratha089@gmail.com / Tel:070 969909 / <a href="http://www.esatra.com/">www.esatra.com</a> </p>
    <h4>Thank you for using my pluging</h4>
    <?php
}
function limonfonttypePluginLinks($links, $file)
{
    if ($file == basename(dirname(__FILE__)).'/'.basename(__FILE__) && function_exists("admin_url"))
    {
        //add settings page
        $manage_link = '<a href="'.admin_url('options-general.php?page=limon-font-type/limon-font-type.php').'">'.__('Settings').'</a>';
        array_unshift($links, $manage_link);
    }
    return $links;
}
add_filter('plugin_action_links', 'limonfonttypePluginLinks', 10, 2);
?>

++Get this testing pluging:limon-font-type.zip

No comments:

Post a Comment