Website Design & Development Company - Pune, India.

WordPress Plugins
27Jan

WordPress Plugins

by Tanvi   |   27 Jan, 2017

WordPress is mainly divided into
a) Core
b) Themes
c) Plugins
Importance of Plugins:
Core WordPress files can’t be modified.  Because if wordpress is updated to new version it overwrites all core files. Hence if you want to add any additional functionality the plugins are used. The simple form of plugin is single PHP file. Hence more functionality can be added with the help of plugins using approved wordpress API’s. The plugin PHP file just requires a Plugin Header, a couple of PHP functions, and some kind hooks to attach your functions to. Hence plugins provide wider area without interfering core files.

Getting started with plugins:
Follow the procedures to install wordpress plugins
a.    Navigate to your WordPress installation’s wp-content directory.
b.    Open the plugins directory.
c.    Create a new directory and name it after your plugin (e.g. plugin-name).
d.    Open your new plugin’s directory.
e.    Create a new PHP file (it’s also good to name this file after your plugin, e.g. plugin-name.php).

Follow the process similar to command prompt
a.    WordPress$ cd wp-content
b.    wp-content$ cd plugins
c.    plugins$ mkdir plugin-name
d.    plugins$ cd plugin-name
e.    plugin-name$ vi plugin-name.php

In above examples vi is an editor. You can add any editor you want. Now that you’re editing your new plugin’s PHP file, you’ll need to add a plugin header comment.  This is a specially formatted PHP block comment that contains metadata about your plugin, such as its name and author.  At the very least, the plugin header comment must contain the name of your plugin.  Only one file in your plugin’s folder should have the header comment—if your plugin has multiple PHP files, only one of those files should have the comment.

    <?php
        /*
            Plugin Name: Your Plugin Name
        */
  ?>

After you save the file, you should be able to see your plugin listed in your WordPress site. Log in to your WordPress site, and click Plugins on the left navigation pane of your WordPress Admin. This page displays a listing of all the plugins your WordPress site has. Your new plugin should now be in that list.

Hooks: Actions and filters

There are mainly two types of hooks in Wordpress Plugin
a.    Actions
b.    filters
a.    Actions:  Actins work as they can add or change WordPress functionality, and filters allow to change content  as it is displayed on website

 

Share
input:focus, select:focus, textarea:focus { border-color: ##1abc9c; } a { color: ##1abc9c; } .radio i, .checkbox i { color: ##1abc9c; } .radio i:before { background-color: ##1abc9c; } .button, .btn-default { border-color: ##1abc9c; background-color: ##1abc9c; } .button:hover { color: ##1abc9c; } .page-header-top { background-color: ##1abc9c; } .page-header-bottom-alt { background-color: ##1abc9c; } .page-intro:after { background-color: ##1abc9c; } .page-intro:before { background-color: ##1abc9c; } .page-content-section-bg { background-color: ##1abc9c; } .page-content-section-bg:before { background-color: ##1abc9c; } .page-content-section-border { border-top-color: ##1abc9c; } .page-footer { background-color: ##1abc9c; } .block-head-1 { border-bottom-color: ##1abc9c; } .block-head-1 i { background-color: ##1abc9c; } .block-head-2:after { background-color: ##1abc9c; } .block-head-2 i:after, .block-head-2 i:before { background-color: ##1abc9c; } .block-head-3 { border-bottom-color: ##1abc9c; } .block-head-3 i:after { background-color: ##1abc9c; } .block-head-4:after { background-color: ##1abc9c; } .block-head-7 { border-bottom-color: ##1abc9c; } .block-head-7:after { background-color: ##1abc9c; } .page-content-section-bg .block-head-3 i { color: ##1abc9c; } .main-search button { color: ##1abc9c; } .main-search button:after { background: ##1abc9c; } .main-nav li a { color: ##1abc9c; } .main-nav li a:before { background-color: ##1abc9c; } .main-nav li ul { background-color: ##1abc9c; } .main-nav li li:hover > a, .main-nav li li.active > a, #block-newsletter-newsletter-subscribe .form-submit:hover, .block-product-details .add-wishlist .button-alt:hover, .block-product-details-2 .add-wishlist .button-alt:hover { color: ##1abc9c; } .main-nav .switcher { border-color: ##1abc9c; background-color: ##1abc9c; } .main-nav .mega > div { background-color: ##1abc9c; } #block-newsletter-newsletter-subscribe .form-submit, .btn-primary:hover, .btn-primary:focus, .btn-primary:active { border-color: ##1abc9c; background-color: ##1abc9c; } .art-portfolio ol li.active, .ui-slider-horizontal .ui-slider-handle, .ui-slider-horizontal .ui-slider-range, .btn-primary.link { background-color: ##1abc9c; } .btn-primary, .button:hover, .btn-default:hover, .btn-default:focus, .btn-default:active { border-color: ##1abc9c; color: ##1abc9c; } .btn-primary.link:hover, .btn-primary.link:focus, .btn-primary.link:active { color: ##1abc9c; } } @media screen and (max-width: 767px) { /* phone */ .main-nav ul { background-color: ##1abc9c; } .main-nav li a { color: #ecf0f1; } .main-nav li ul { background: #e9e9e9; } .main-nav li li { border-top-color: ##1abc9c; } .main-nav li li a { color: ##1abc9c; } .main-nav li li a:hover { background-color: ##1abc9c; color: #fff; } .main-nav li li ul { border-top-color: ##1abc9c; } .main-nav .mega ul li { border-top-color: ##1abc9c; } } .slider-revolution .fa:after { background-color: ##1abc9c; } .slider-revolution .title { border-top-color: 1px solid ##1abc9c; border-bottom-color: 1px solid ##1abc9c; } .slider-revolution .button-my { border-color: ##1abc9c; background-color: ##1abc9c; } .slider-revolution .button-my:hover { color: ##1abc9c; } .pagination-1 a:hover { border-color: ##1abc9c; color: ##1abc9c; } .pagination-1 .active, .pagination-1 .active:hover { border-color: ##1abc9c; background: ##1abc9c; } .pagination-2 a:hover { color: ##1abc9c; } .pagination-2 .active, .pagination-2 .active:hover { background: ##1abc9c; } .pagination-3 a:before { box-shadow: inset 0 0 0 1px ##1abc9c; } .pagination-3 .active:before, .pagination-3 .active:hover:before { background: ##1abc9c; } .pagination-4 a:hover { border-color: ##1abc9c; } .pagination-4 .active { border-color: ##1abc9c; background: ##1abc9c; } .pagination-5 a { border-color: ##1abc9c; background-color: ##1abc9c; color: ##1abc9c; } .block-benefits div:hover { border-color: ##1abc9c; background-color: ##1abc9c; } .block-benefits i { color: ##1abc9c; } .block-benefits-2 li i { color: ##1abc9c; } .block-benefits-2 .tabs a:hover { border-color: ##1abc9c; background-color: ##1abc9c; } .block-benefits-2 .tabs .active a, .block-benefits-2 .tabs .active a:hover { color: ##1abc9c; } .block-benefits-3 i { color: ##1abc9c; } .block-about .button { border-color: ##1abc9c; color: ##1abc9c; } .block-about .button:hover { background: ##1abc9c; color: #ecf0f1; } .block-about .owl-prev:hover, .block-about .owl-next:hover { color: ##1abc9c; } .block-about-2 .bar { background: ##1abc9c; } .block-about-2 .value { color: ##1abc9c; } .block-about-4 .owl-pagination div { border-color: ##1abc9c; background: ##1abc9c; } .block-about-5 .owl-prev, .block-about-5 .owl-next { display: inline-block; border-color: ##1abc9c; background-color: ##1abc9c; } .block-about-5 .owl-prev:hover, .block-about-5 .owl-next:hover { color: ##1abc9c; } .block-about-6 .icons a:hover { color: ##1abc9c; } .block-mission .year { background: ##1abc9c; } .block-mission .years a:after { border-bottom-color: ##1abc9c; } .block-recent-works ol li:hover { color: ##1abc9c; } .block-recent-works ol .active { border-color: ##1abc9c; background: ##1abc9c; } .block-recent-works .description { background: ##1abc9c; } .block-recent-works .description:before { border-right-color: ##1abc9c; } .block-recent-works-3 h3 { border-top-color: ##1abc9c; } .block-recent-works-3 .link { border-color: ##1abc9c; } .block-recent-works-3 .fancybox { background-color: ##1abc9c; } .block-recent-works-3 .owl-pagination div { border-color: ##1abc9c; background: ##1abc9c; } .block-recent-works-4:before { background: ##1abc9c; } .block-recent-works-4 .fancybox { background: ##1abc9c; } .block-recent-works-4 .owl-prev:hover, .block-recent-works-4 .owl-next:hover { color: ##1abc9c; } .block-recent-works-6 a:before { background: ##1abc9c; } .block-recent-works-6 .owl-prev, .block-recent-works-6 .owl-next { border-color: ##1abc9c; background: ##1abc9c; } .block-recent-works-6 .owl-prev:hover, .block-recent-works-6 .owl-next:hover { color: ##1abc9c; } .block-portfolio ol li:hover { color: ##1abc9c; } .block-portfolio ol li.active { border-bottom-color: ##1abc9c; } .block-portfolio ul .pic span:after, .block-portfolio ul .pic span:before { background: ##1abc9c; } .block-portfolio ul .pic span i { color: ##1abc9c; } .block-portfolio-2 ol li:hover { color: ##1abc9c; } .block-portfolio-2 ol li.active { background: ##1abc9c; } .block-portfolio-2 ul .pic:before { background: ##1abc9c; } .block-portfolio-2 ul .pic a { background: ##1abc9c; } .block-portfolio-2 ul .pic a:hover { color: ##1abc9c; } .block-portfolio-3 ol li:hover { color: ##1abc9c; } .block-portfolio-3 ol li.active { background: ##1abc9c; } .block-portfolio-4 h3 { border-top-color: ##1abc9c; } .block-portfolio-4 .link { border-color: ##1abc9c; } .block-portfolio-4 .fancybox { background: ##1abc9c; } .block-portfolio-5 ol li:hover { color: ##1abc9c; } .block-portfolio-5 ol li.active { background: ##1abc9c; } .block-portfolio-5 .info:before { background: ##1abc9c; } .block-portfolio-6 ol li:hover { color: ##1abc9c; } .block-portfolio-6 ol li.active { background: ##1abc9c; } .block-portfolio-6 ul a:before { background: ##1abc9c; } .block-portfolio-7 ol li:hover { color: ##1abc9c; } .block-portfolio-7 ol li.active { background: ##1abc9c; } .block-portfolio-7 ul li:before { background: ##1abc9c; } .block-portfolio-7 ul a:hover { color: ##1abc9c; } .block-portfolio-8 li div:before { background: ##1abc9c; } .block-portfolio-8 li a { background: ##1abc9c; } .block-clients .owl-prev, .block-clients .owl-next { color: ##1abc9c; } .block-testimonials-3 .carousel h3 { border-bottom-color: ##1abc9c; } .block-testimonials-3 .owl-pagination div { border-color: ##1abc9c; } .block-testimonials-3 .owl-pagination .active { background: ##1abc9c; } .block-testimonials-4 .owl-prev, .block-testimonials-4 .owl-next { border-color: ##1abc9c; background: ##1abc9c; } .block-testimonials-4 .owl-prev:hover, .block-testimonials-4 .owl-next:hover { color: ##1abc9c; } .block-services li a { border-color: ##1abc9c; } .block-services li a:hover { background-color: ##1abc9c; } .block-services-2 li a:hover { background: none; } .block-services-2 li a:after { box-shadow: inset 0 0 0 2px ##1abc9c; } .block-services-2 li a:hover:after { background-color: ##1abc9c; } .block-services-3 li a:hover { background: none; } .block-services-3 li a:after { box-shadow: inset 0 0 0 2px ##1abc9c; } .block-services-3 li a:before { background: ##1abc9c; box-shadow: inset 0 0 0 2px ##1abc9c; } .block-services-3 li a:hover:after { background-color: ##1abc9c; } .block-services-4 li a { border-color: ##1abc9c; } .block-services-4 li a:hover { background-color: ##1abc9c; } .block-services-5 li i { color: ##1abc9c; } .block-services-5 li i:hover { background: ##1abc9c; } .block-services-6 h3 span { color: ##1abc9c; } .block-services-6 li a { border-color: ##1abc9c; background: ##1abc9c; } .block-services-6 li a:hover { color: ##1abc9c; } .block-services-7 .info i { background: ##1abc9c; } .block-services-7 .carousel .active { background: ##1abc9c; } .block-services-7 .carousel .owl-prev, .block-services-7 .carousel .owl-next { border-color: ##1abc9c; background: ##1abc9c; } .block-services-7 .carousel .owl-prev:hover, .block-services-7 .carousel .owl-next:hover { color: ##1abc9c; } .block-pricing dt { color: ##1abc9c; } .block-pricing .price:before { background: ##1abc9c; } .block-pricing li:hover .inner { background: ##1abc9c; } .block-pricing li:hover .button { color: ##1abc9c; } .block-pricing li:hover .button:hover { background: ##1abc9c; } .page-content-section .block-pricing .inner { box-shadow: 0 0 0 1px ##1abc9c; } .block-pricing-2 dt { color: ##1abc9c; } .block-pricing-2 .price { background: ##1abc9c; } .block-pricing-2 .button { color: ##1abc9c; } .block-pricing-2 li:hover .inner { background: ##1abc9c; } .block-pricing-2 li:hover .button:hover { background: ##1abc9c; } .block-progress li i { border-color: ##1abc9c; color: ##1abc9c; } .block-team-2 .pic:before { background-color: ##1abc9c; } .block-team-2 .icons a { color: ##1abc9c; } .block-team-3 .pic:before { background-color: ##1abc9c; } .block-team-3 .icons a { color: ##1abc9c; } .block-team-3 .info h3 { color: ##1abc9c; } .block-team-list .pic span:after { background-color: ##1abc9c; } .block-team-list .icons a:hover { color: ##1abc9c; } .block-team-list .icons a:before { background: ##1abc9c; } .block-team-list .skills { border-top-color: ##1abc9c; border-bottom-color: ##1abc9c; } .block-team-grid .pic:before { background-color: ##1abc9c; } .block-skills i:before { background-color: ##1abc9c; } .block-skills .bar { border-color: ##1abc9c; background-color: ##1abc9c; } .block-skills-2 i:before { background-color: ##1abc9c; } .block-skills-2 .bar { border-color: ##1abc9c; background-color: ##1abc9c; } .block-capabilities h3 { color: ##1abc9c; } .block-capabilities-2 h3 { color: ##1abc9c; } .block-recent-posts .info { background-color: ##1abc9c; } .block-recent-posts-2:before { background-color: ##1abc9c; } .block-recent-posts-2 li .button { color: ##1abc9c; } .block-recent-posts-2 li .button:hover { background-color: ##1abc9c; } .block-recent-posts-2 .button-more { color: ##1abc9c; } .block-recent-posts-2 .button-more:hover { background-color: ##1abc9c; } .block-featured-posts .pic:before { background-color: ##1abc9c; } .block-blog-list .link { background: ##1abc9c; } .block-blog-list .date:before { background-color: ##1abc9c; } .block-blog-list .date-alt { background-color: ##1abc9c; } .block-blog-list .zoom { background-color: ##1abc9c; } .block-blog-grid .link { background: ##1abc9c; } .block-blog-grid .date:before { background-color: ##1abc9c; } .block-blog-grid .pic:hover .date { color: ##1abc9c; } .block-blog-grid .zoom { color: ##1abc9c; } .block-blog-details .date:before, .block-blog-details .reply:before, .block-blog-details .type:before { background-color: ##1abc9c; } .block-blog-details .date-alt { background-color: ##1abc9c; } .block-blog-details .share a:before { border-color: ##1abc9c; background: ##1abc9c; } .block-blog-details .share a:hover { color: ##1abc9c; } .block-blog-details .about:before { background: ##1abc9c; } .block-catalog-toolbar .view a:hover { border-color: ##1abc9c; color: ##1abc9c; } .block-catalog-toolbar .view .active, .block-catalog-toolbar .view .active:hover { border-color: ##1abc9c; background: ##1abc9c; } .block-catalog-toolbar .direction { border-color: ##1abc9c; background: ##1abc9c; } .block-catalog-toolbar .direction:hover { color: ##1abc9c; } .block-catalog-grid .pic:before { background: ##1abc9c; } .block-catalog-grid .badge { background: ##1abc9c; } .block-catalog-grid .price { color: ##1abc9c; } .block-catalog-grid .owl-prev, .block-catalog-grid .owl-next { border-color: ##1abc9c; background: ##1abc9c; } .block-catalog-grid .owl-prev:hover, .block-catalog-grid .owl-next:hover { color: ##1abc9c;; } .block-catalog-list .pic:after { background-color: ##1abc9c; } .block-catalog-list .badge:before { background-color: ##1abc9c; } .block-catalog-list .price { color: ##1abc9c; } .block-catalog-list .owl-prev, .block-catalog-list .owl-next { border-color: ##1abc9c; background-color: ##1abc9c; } .block-catalog-list .owl-prev:hover, .block-catalog-list .owl-next:hover { color: ##1abc9c;; } .block-product-details .price { color: ##1abc9c; } .block-product-details .button-alt { color: ##1abc9c; } .block-product-details-2 .button-alt { color: ##1abc9c; } .block-product-details-2 .share a:before { background-color: ##1abc9c; box-shadow: 0 0 0 2px ##1abc9c; } .block-product-details-2 .share a:hover { color: ##1abc9c; } .block-product-info .owl-prev, .block-product-info .owl-next { border-color: ##1abc9c; background-color: ##1abc9c; } .block-product-info .owl-prev:hover, .block-product-info .owl-next:hover { color: ##1abc9c; } .block-product-tabs .head .active { color: ##1abc9c; } .block-product-tabs .head .active:before { border-top-color: ##1abc9c; } .block-shopping-cart th { border-top-color: ##1abc9c; color: ##1abc9c; } .block-shopping-cart .price { color: ##1abc9c; } .block-shopping-cart .remove { border-color: ##1abc9c; background-color: ##1abc9c; } .block-shopping-cart .remove:hover { color: ##1abc9c; } .block-shopping-cart .quantity a { color: ##1abc9c; } .block-shopping-cart .empty td { border-bottom-color: ##1abc9c; } .block-shopping-cart-totals dd { color: ##1abc9c; } .block-shopping-cart-totals .button-alt { color: ##1abc9c; } .block-checkout-order td:last-child { color: ##1abc9c; } .block-checkout-payment label { color: ##1abc9c; } .block-welcome .icons i:after { border-color: ##1abc9c; background: ##1abc9c; } .block-welcome .icons a:hover i { color: ##1abc9c; } .block-pasteboard:before { background: ##1abc9c; } .block-pasteboard .icons a:hover { color: ##1abc9c; } .block-map-3 .block-head { color: ##1abc9c; } .block-contacts ul li:after, .block-contacts ul li:before { border-color: ##1abc9c; background-color: ##1abc9c; } .block-contacts ul li:before { background-color: #fff; } .block-contacts ul li span { border-bottom-color: ##1abc9c; } .block-contacts ul .active { color: ##1abc9c; } .block-contacts ul .active:before { background-color: ##1abc9c; } .block-contacts ol { border-top-color: ##1abc9c; } .block-contacts ol li { color: ##1abc9c; } .block-contacts ol li i:after { background-color: ##1abc9c; } .block-feedback .message i, .block-feedback-2 .message i { color: ##1abc9c; } .block-not-found h3 { color: ##1abc9c; } .block-not-found .pic:before { background-color: ##1abc9c; } .block-not-found .pic div:before { background-color: ##1abc9c; } .block-not-found-2 .button { color: ##1abc9c; } .block-not-found-2 .button:hover { background: ##1abc9c; } .block-coming-soon li:before { background-color: ##1abc9c; } .block-coming-soon-2 li:after { background-color: ##1abc9c; } .widget-categories a:hover, .widget-categories a.active { color: ##1abc9c; } .widget-top-posts a:hover { color: ##1abc9c; } .widget-text hr { border-top-color: ##1abc9c; } .widget-text em { color: ##1abc9c; } .widget-archive a:hover, .widget-archive a.active { color: ##1abc9c; } .widget-tags a:hover { color: ##1abc9c; } .widget-categories-filter a:hover { color: ##1abc9c; } .widget-categories-filter .active { color: ##1abc9c; } .widget-categories-filter .active span { background-color: ##1abc9c; } .widget-price-filter .ui-slider-range { background-color: ##1abc9c; } .widget-price-filter .ui-slider-handle { background-color: ##1abc9c; } .widget-color-filter .active:before { border-color: ##1abc9c; } .widget-top-products .pic i { background-color: ##1abc9c; } .main-nav ul { background-color: ##1abc9c; }