Skip to content

Instantly share code, notes, and snippets.

View webhasan's full-sized avatar
🎯
GTM, GA4, Conversion Tracking (Coding Ninja)

Md Hasanuzzaman webhasan

🎯
GTM, GA4, Conversion Tracking (Coding Ninja)
View GitHub Profile
@webhasan
webhasan / functions.php
Last active October 2, 2016 11:30
Woocommerce Mini Cart
<?php
/**
* Wordpress Get The Widget
*/
if( !function_exists('get_the_widget') ){
function get_the_widget( $widget, $instance = '', $args = '' ){
ob_start();
@webhasan
webhasan / EDD_DB_class.php
Last active June 29, 2016 04:29
WordPess Databsase Abstract Class
<?php
// Exit if accessed directly
if ( ! defined( 'ABSPATH' ) ) exit;
/**
* EDD DB base class
*
* @package EDD
* @subpackage Classes/EDD DB
@webhasan
webhasan / post-page-list.php
Created May 16, 2016 06:14
custom item in wordpress list page
<?php
add_filter('manage_posts_columns', function($columns) {
$columns['thumbnail'] = __('Post Thumbnail','leo');
return $columns;
});
add_action('manage_posts_custom_column', function($column, $id) {
if($column == 'thumbnail') {
the_post_thumbnail( array(50, 50) );
}
@webhasan
webhasan / amazon-product-rating.php
Created April 18, 2016 03:58
Amazon Product Rating by ASIN
<?php
/**
* Amazon Rating Stars
*/
function amazon_stars($asin) {
$content = file_get_contents('http://www.amazon.com/gp/customer-reviews/widgets/average-customer-review/popover/ref=dpx_acr_pop_?contextId=dpx&asin='.trim($asin));
$result = preg_match('/([1,2,3,4,5]\.\d+) out of [1,2,3,4,5] stars/', $content, $matches);
$rating = $matches[1];
videoResponsive: function() {
var vidHeight,
vidWidth;
function videoRatio() {
if(window.innerWidth < 768 ) {
vidWidth = window.innerWidth - 30;
vidHeight = Math.round(9 / 16 * vidWidth );
}else if(window.innerWidth < 993 ) {
vidWidth = 720;
vidHeight = 405;
@webhasan
webhasan / sidrmenu.js
Last active May 20, 2016 02:49
Sidr Menu Advance Settings
$( '#main-menu>ul' ).clone().appendTo( $( '#sidr' ) );
$('#mobile-menu').sidr({
name: 'sidr',
side: 'right',
onOpen: function() {
$('#mobile-menu i').removeClass('fa-bars').addClass('fa-times');
},
onClose: function() {
@webhasan
webhasan / click-to-scroll.js
Last active June 11, 2021 04:03
Click to scroll menu
var navHeight = 0; //use valut for sticky menu height
$(document).on("scroll", onScroll);
$('#main-menu ul a[href*="#"]:not([href="#"]), #sidr a[href*="#"]:not([href="#"]').on('click', function (e) {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
e.preventDefault();
@webhasan
webhasan / responsive.css
Last active August 29, 2015 14:16
DIVI Theme Media Query
@media only screen and (max-width: 1100px) and (min-width: 981px) { /* content widht: 960px */
}
@media only screen and (max-width: 980px) { /* content widht: 690px */
}
@media only screen and (max-width: 767px) { /* content widht: 400px */
@webhasan
webhasan / plugins.php
Created January 23, 2015 13:13
TinyMCE Dummy Content Generator
add_action('admin_head', function(){
global $typenow;
//only post type post and page
if(! in_array($typenow, array('post','page'))) {
return;
}
add_filter('mce_external_plugins', function( $plugin_array){
$plugin_array['dummytext_plugin'] = plugins_url( '/js/tinymce-plugin.js', __FILE__ );
@webhasan
webhasan / class-my-custom-taxonomies.php
Last active August 29, 2015 14:13
WordPress Custom Taxonomy
<?php
/**
* The core plugin class file
*
* Defines the functions necessary to register our custom taxonomies with
* WordPress.
*
* @link http://code.tutsplus.com/series/the-beginners-guide-to-wordpress-taxonomies--cms-706
* @since 1.0.0