No ratings yet.

 

basics of creating wordpress plugin

Open the new file in a text editor and add the following text:
<?php
/*
Plugin Name: Important Posts
Plugin URI:
Description: Declares a plugin that will be visible in the
WordPress admin interface
Version: 1.0
Author: Farooq Shaikh
Author URI: http://websolutionsdone.com
License:
*/
?>

important wordpres functions used in pluign:

get_theme_root(): Returns the address of the theme installation directory
site_url() and home_url(): Return the site address
includes_url(): Provides the location of WordPress include files
wp_upload_dir(): Indicates the directory where user-uploaded files are stored
get_template_directory_uri(): Retrieves the URI to the current theme’s files
admin_url(): Provides the address of the WordPress administrative pages
content_url(): Indicates where the wp-content directory can be found
is_front_page() function is very useful when you are looking at implementing functionality that will only be displayed if the WordPress site is displaying its front page.

get_the_title(): This function gives us quick access to the item’s title
get_permalink(): A function that returns the item’s permalink (a URL that is always associated with this post or page even after it is no longer featured on a website’s front page)

plugin creating example
shortcode example in wordpress plugin:

how to provide shortcode snippet using plugin
add_shortcode( ‘FB’, ‘facebook_feed_shortcode’ );
implementation:

facebook_feed_shortcode function:
function twitter_feed_shortcode( $atts ) {
$output = ‘<a href=”http://facebook.com/farooq”>
facebook Feed</a>’;
return $output;
}

Please rate this