Skip to content

Instantly share code, notes, and snippets.

@wildprogrammers141992
Last active October 24, 2019 02:14
Show Gist options
  • Select an option

  • Save wildprogrammers141992/60f2b8246675e3d4b61b4a39c27e465c to your computer and use it in GitHub Desktop.

Select an option

Save wildprogrammers141992/60f2b8246675e3d4b61b4a39c27e465c to your computer and use it in GitHub Desktop.
Lead Generator root file
<?php
/**
* Plugin Name: Lead Generator Plugin
* Description: A walkthrough for most of the WordPress plugin development concepts.
* Version: 1.0.0
* Author: Wild Programmers
* Author URI: https://www.wildprogrammers.com
* License: GPL v3
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
* Text Domain: leadGenerator
* Domain Path: languages
*
* @package Lead Generator Plugin
* @category Core
* @author Wild Programmers
*/
/**
* Activation Hook
*
* Register plugin activation hook.
*
* @package Lead Generator
* @since 1.0.0
*/
register_activation_hook(__FILE__, 'lgp_install');
/**
* Plugin Setup (On Activation)
*
* Does the initial setup,
* save default values for the plugin options.
*
* @package Lead Generator
* @since 1.0.0
*/
function lgp_install() {
global $wpdb;
$options = array(
'phone_label' => esc_html__( 'Phone Number', 'leadGenerator' ),
'email_label' => esc_html__( 'Email Address', 'leadGenerator' ),
'budget_label' => esc_html__( 'Budget', 'leadGenerator' ),
'min_budget' => 5000,
'max_budget' => 0,
'date_inserted_label' => 'Date Inserted',
'time_inserted_label' => 'Time Inserted'
);
update_option('lgp_options',$options);
}
/**
* Deactivation Hook
*
* Register plugin deactivation hook.
*
* @package Lead Generator
* @since 1.0.0
*/
register_deactivation_hook(__FILE__, 'lgp_deactivation');
/**
* Plugin Setup (On Deactivation)
*
* @package Lead Generator
* @since 1.0.0
*/
function lgp_deactivation() {
lgp_unregister_post_type();
}
/**
* Uninstallation Hook
*
* Register plugin uninstallation hook.
*
* @package Lead Generator
* @since 1.0.0
*/
register_uninstall_hook(__FILE__, 'lgp_uninstallation');
/**
* Plugin Uninstallation (On Uninstalation)
*
* @package Lead Generator
* @since 1.0.0
*/
function lgp_uninstallation() {
// Delete the option
delete_option('lgp_options');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment