• Home
  • About me
  • Gallery
  • WordPress
  • Life
  • Contact us

Laxman Prajapati

~ WordPress Blog

Laxman Prajapati

Tag Archives: Wordpress

How to create new plugin in Wp ?

10 Saturday Oct 2015

Posted by Laxman Prajapati in WordPress

≈ Leave a comment

Tags

Wordpress

/**
 * Plugin Name: 
 * Plugin URI: 
 * Description: 
 * Version: 
 * Author: 
 * Author URI: 
 * License: A "Slug" license name e.g. GPL2
 */

add_action( 'admin_menu', 'front_register' );

function front_register() {
	add_menu_page('FrontRegister', 'FrontRegister', 'manage_options', 'my-top-level-handle', 'back_register');
}

require_once(ABSPATH . WPINC . '/registration.php');
global $wpdb, $user_ID;

$result = mysql_query('ALTER TABLE wp_users ADD	user_lastname VARCHAR(60) AFTER user_login;');
$result = mysql_query('ALTER TABLE wp_users ADD user_address VARCHAR(250) AFTER display_name;');
$result = mysql_query('ALTER TABLE wp_users ADD	user_city VARCHAR(60) AFTER user_address;');
$result = mysql_query('ALTER TABLE wp_users ADD user_state VARCHAR(60) AFTER user_city;');
$result = mysql_query('ALTER TABLE wp_users ADD user_zip VARCHAR(60) AFTER user_state;');
$result = mysql_query('ALTER TABLE wp_users ADD	user_phone VARCHAR(60) AFTER user_zip;');
$result = mysql_query('ALTER TABLE wp_users ADD	user_category VARCHAR(60) AFTER user_phone;');

function back_register() {
	echo "hy";
}

function font_register() {
/*  Front Code Type Here */
}

add_shortcode( 'FrontRegister', 'font_register' );

// Shortcode [FrontRegister] 

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...

Hook to WordPress

05 Wednesday Feb 2014

Posted by Laxman Prajapati in Blog, WordPress

≈ Leave a comment

Tags

Hook, Hook to WordPress, Wordpress

header_image_550px

After your function is defined, the next step is to “hook” or register it with WordPress. To do this, call add_action() in the global execution space of your plugin file:

add_action ( 'hook_name', 'your_function_name', [priority], [accepted_args] );

where:

wordpress-hooks

hook_name

  • The name of an action hook provided by WordPress, that tells what event your function should be associated with.

your_function_name

  • The name of the function that you want to be executed following the event specified by hook_name. This can be a standard php function, a function present in the WordPress core, or a function defined by you in the plugin file (such as ’email_friends’ defined above).

priority

  • An optional integer argument used to specify the order in which the functions associated with a particular action are executed (default: 10). Lower numbers correspond with earlier execution, and functions with the same priority are executed in the order added to the action.

accepted_args

  • An optional integer argument defining how many arguments your function can accept (default 1), useful because some hooks can pass more than one argument to your function. This parameter is new in release 1.5.1.

Return Value

  • The (optionally modified) value of the first argument passed to the filter function.

In the example above, we would put the following line in the plugin file:

add_action ( 'publish_post', 'email_friends' );

Likewise, you can also Remove Actions from action hooks. See that section for details.

wordpress badges

Rate this:

Share this:

  • Facebook
  • Twitter
  • LinkedIn
  • Pinterest
  • Email
  • Print

Like this:

Like Loading...
Follow Laxman Prajapati on WordPress.com

About Me

Laxman Prajapati

Laxman Prajapati

Have to lose something to gain something

View Full Profile →

Total Blog Hits

  • 29,249 Views

Fish

Calendar

June 2022
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930  
« May    

Logo

wordpress-logo-stacked-rgb

Category

Animal Anniversary birthday Blog BuddyPress Family Flower Friends Goal Google Happiness Happy new year Health Independence Day Life Love Mind Fresh Natural PHP Positive Republic Day WordPress

Blogs I Follow

Success Life

“Success is not final, failure is not fatal: it is the courage to continue that counts.” ― Winston Churchill
“If at first you don't succeed, try, try again. Then quit. No use being a damn fool about it.” ― W. C. Fields
“Nearly all men can stand adversity, but if you want to test a man's character, give him power.” ― Abraham Lincoln
“Success is most often achieved by those who don't know that failure is inevitable.” ― Coco Chanel

Recent Posts

  • How to increase WordPress website speed without a plugin
  • How to install Twnety Twenty theme on WordPress Website?
  • How to download PDF file using WordPress codex
  • New Gallery Widget in WordPress 4.9
  • Template Hierarchy
  • WordPress Work Sheet
  • Merry Christmas
  • #SRK

Category

Animal Anniversary birthday Blog BuddyPress Family Flower Friends Goal Google Happiness Happy new year Health Independence Day Life Love Mind Fresh Natural PHP Positive Republic Day WordPress

Gallery

success
tree_success
succaess
success-secrets-1
15_5_orig
sucscess
success-1
success2
success

Blog at WordPress.com.

Tianu Gujarati Blog - Anurag Rathod

જેને કશું કામ કરવા ના હોય એ નવરો બેઠો બેઠો બ્લોગ લખે.

WordCamp Ahmedabad 2019 a.k.a 3.0

#WCAhmedabad

Hinal Sanghvi

Hinal Sanghvi

WordPress Educator Zac Gordon

A Blog for Tutorials, Free Videos, and Updates on Courses, Talks and Workshops

seenu625

love nature, and all things creative

Hello Beautiful Book Blog

beautiful nerdy bookish things

How Useful It Is

Trying to be Useful, one post at a time!

vlandaman.wordpress.com/

On Becoming Fearless

Dreaming, believing, learning then achieving

Dil Ki Kitaab ( दिल की किताब )

Privacy & Cookies: This site uses cookies. By continuing to use this website, you agree to their use.
To find out more, including how to control cookies, see here: Cookie Policy
  • Follow Following
    • Laxman Prajapati
    • Join 523 other followers
    • Already have a WordPress.com account? Log in now.
    • Laxman Prajapati
    • Customize
    • Follow Following
    • Sign up
    • Log in
    • Report this content
    • View site in Reader
    • Manage subscriptions
    • Collapse this bar
 

Loading Comments...
 

    %d bloggers like this: