frist create a custom widget class that extend the default wordpress widget class this code is from the official wordpress code reference
class My_Widget extends WP_Widget {
/**
* Sets up the widgets name etc
/** | |
* Remove back ticks in Gravity Forms Email Headers | |
* | |
* For some odd reason Gravity Forms includes quotes in the "From" sender name. This is inconsistent with other mail senders so this removes the quotes. | |
* | |
* @param $email | |
* @param $message_format | |
* @param $notification | |
* | |
* @return mixed |
<?php // do not copy this line | |
if( ! function_exists( 'ij_child_custom_woocommerce_states' ) ) { | |
function ij_child_custom_woocommerce_states( $states ) { | |
$states['LK'] = array( | |
'PU' => __( 'Punjab', 'woocommerce' ), | |
'BOL' => __( 'Bolichistan', 'woocommerce' ), | |
'SND' => __( 'Sindh', 'woocommerce' ), | |
'KPK' => __( 'Khyber Pakhtunkhowa', 'woocommerce' ), |
<?php | |
/** WooCommerce Template Hooks ********************************************************/ | |
/** | |
* Sale flashes | |
*/ | |
add_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 ); | |
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 ); |
-- phpMyAdmin SQL Dump | |
-- version 4.8.5 | |
-- https://www.phpmyadmin.net/ | |
-- | |
-- Host: localhost:8889 | |
-- Generation Time: Jun 07, 2019 at 07:58 AM | |
-- Server version: 5.7.25 | |
-- PHP Version: 7.3.1 | |
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO"; |
<?php | |
/** | |
* Update the attached image's description, caption & | |
* alt text with values from the product when the image is imported. | |
* | |
* @param integer $attachment_id Attachment ID of imported image. | |
* @param Dfrps_Image_Importer $image_importer | |
*/ | |
function mycode_update_image_meta( $attachment_id, $image_importer ) { |
<?php | |
add_action('wp_ajax_register_user_front_end', 'register_user_front_end', 0); | |
add_action('wp_ajax_nopriv_register_user_front_end', 'register_user_front_end'); | |
function register_user_front_end() { | |
$new_user_name = stripcslashes($_POST['new_user_name']); | |
$new_user_email = stripcslashes($_POST['new_user_email']); | |
$new_user_password = $_POST['new_user_password']; | |
$user_nice_name = strtolower($_POST['new_user_email']); | |
$user_data = array( | |
'user_login' => $new_user_name, |
frist create a custom widget class that extend the default wordpress widget class this code is from the official wordpress code reference
class My_Widget extends WP_Widget {
/**
* Sets up the widgets name etc
<?php | |
/* | |
Plugin Name: PMG Widget Tututorial | |
Plugin URI: http://pmg.co/category/wordpress | |
Description: How to create WordPress Widgets. | |
Version: 1.0 | |
Author: Christopher Davis | |
Author URI: http://pmg.co/people/chris | |
License: GPL2 | |
*/ |