Web Design & Development Forum

Web Developers Zone
  • FB
  • TW
  • LND
  • G+

How to Create a Simple WordPress Plugin

When offering assistance or providing various snippets we regularly encourage individuals to make a WordPress plugin to manage every one of their modifications. Right here is exactly how you produce an extremely basic plugin to house all your little bits and modifications.

WordPress Plugin Header.
Right here is everything needs to be in your plugin file for WordPress to recognize it once uploaded.

<?php
/*
Plugin Name:  My Custom Plugin
*/

Fundamental Framework
A WordPress plugin could consist of as little as a single PHP documents nonetheless for uniformity I always develop folder and a minimum of the solitary PHP data within it. The folder and the documents ought to have the exact same name with the exception of the file extension. We re visiting call our plugin My Custom Functions so the directory site and documents would certainly be called appropriately.

function my_custom_redirect () {
global $post;
if ( is_page() || is_object( $post ) ) {
if ( $redirect = get_post_meta($post-&gt;ID, ‘redirect’, true ) ) {
wp_redirect( $redirect );
exit;
}
}
}
add_action( ‘get_header’, ‘my_custom_redirect’ );

Folder: my-custom-functions
Submit: my-custom-functions. php.

When we re done we re going to publish this freshly created folder with the data inside it to our wp-content/plugins directory on our web server.
Essentials of a WordPress Plugin documents.

<?php
/*
Plugin Name: My Custom Functions
*/

function my_custom_redirect () {
global $post;
if ( is_page() || is_object( $post ) ) {
if ( $redirect = get_post_meta($post-&amp;gt;ID, ‘redirect’, true ) ) {
wp_redirect( $redirect );
exit;
}
}
}
add_action( ‘get_header’, ‘my_custom_redirect’ );

There are no question limitless discussions that can be had about all things that can enter into your plugin data yet I m going to cover the downright requirements to get you began rapidly.

One Response to “How to Create a Simple WordPress Plugin”

  1. Anonymous says:

    Hello Web Admin, I noticed that your On-Page SEO is is missing a few factors, for one you do not use all three H tags in your post, also I notice that you are not using bold or italics properly in your SEO optimization. On-Page SEO means more now than ever since the new Google update: Panda. No longer are backlinks and simply pinging or sending out a RSS feed the key to getting Google PageRank or Alexa Rankings, You now NEED On-Page SEO. So what is good On-Page SEO?First your keyword must appear in the title.Then it must appear in the URL.You have to optimize your keyword and make sure that it has a nice keyword density of 3-5% in your article with relevant LSI (Latent Semantic Indexing). Then you should spread all H1,H2,H3 tags in your article.Your Keyword should appear in your first paragraph and in the last sentence of the page. You should have relevant usage of Bold and italics of your keyword.There should be one internal link to a page on your blog and you should have one image with an alt tag that has your keyword….wait there’s even more Now what if i told you there was a simple WordPress plugin that does all the On-Page SEO, and automatically for you? That’s right AUTOMATICALLY, just watch this 4minute video for more information at. Seo Plugin

Leave a Reply