Skip to content

Instantly share code, notes, and snippets.

View MrImranJaved's full-sized avatar
🙂
Open For Opportunity

Imran Javed MrImranJaved

🙂
Open For Opportunity
View GitHub Profile
@MrImranJaved
MrImranJaved / gravity-forms-strip-email-from-name-back-ticks.php
Last active February 1, 2022 14:15 — forked from DevinWalker/gravity-forms-strip-email-from-name-quotes.php
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 in the "From Name" email headers.
/**
* 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' ),
@MrImranJaved
MrImranJaved / WooCommerce_hooks.php
Last active February 1, 2022 14:23 — forked from alexpani/woo_hooks.php
Gli Hook per 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";
@MrImranJaved
MrImranJaved / update-image-meta.php
Created April 21, 2022 09:08 — forked from EricBusch/update-image-meta.php
Update the attached image's description, caption & alt text with values from the product. [datafeedr][dfrps]
<?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 ) {
@MrImranJaved
MrImranJaved / functions.php
Created June 9, 2022 20:29 — forked from vishalbasnet23/functions.php
User Registration Front End WordPress with Ajax
<?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,

create wordpress custom widget

add this code to you function.php file

create the custom widget class

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
@MrImranJaved
MrImranJaved / widget-tut.php
Created December 5, 2023 12:00 — forked from chrisguitarguy/widget-tut.php
An example of how to build your own WordPress widget
<?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
*/