Skip to content

Instantly share code, notes, and snippets.

View akshuvo's full-sized avatar

Akhtarujjaman Shuvo akshuvo

View GitHub Profile
@akshuvo
akshuvo / woocommerce-settings-tab-demo.php
Created February 25, 2020 22:11 — forked from BFTrick/woocommerce-settings-tab-demo.php
A plugin demonstrating how to add a WooCommerce settings tab.
<?php
/**
* Plugin Name: WooCommerce Settings Tab Demo
* Plugin URI: https://gist.github.com/BFTrick/b5e3afa6f4f83ba2e54a
* Description: A plugin demonstrating how to add a WooCommerce settings tab.
* Author: Patrick Rauland
* Author URI: http://speakinginbytes.com/
* Version: 1.0
*
* This program is free software: you can redistribute it and/or modify
@akshuvo
akshuvo / ajax-boilerplate.js
Last active February 24, 2020 05:26
Ajax boilerplate for jquery
$(document).on('click', '#am_posts_navigation aa', function (e) {
e.preventDefault();
var $this = $(this);
var paged = parseInt($this.text());
var href = $this.attr('href');
var data = {
action: 'wt_ajax_tour_search',
@akshuvo
akshuvo / functions.php
Created February 23, 2020 04:30 — forked from EddyRespondek/functions.php
Wordpress - Simple AJAX Pagination
function get_posts_for_pagination() {
$html = '';
$paged = ( $_GET['page'] ) ? $_GET['page'] : 1;
$post_type = $_GET['posttype'];
if ( empty($post_type) ) {
return '';
}
if( filter_var( intval( $paged ), FILTER_VALIDATE_INT ) ) {
@akshuvo
akshuvo / function.php
Created February 10, 2020 10:39
Add a Copyright Field to the Media Uploader in WordPress
<?php
/**
* Adding a "Copyright" field to the media uploader $form_fields array
*
* @param array $form_fields
* @param object $post
*
* @return array
*/
function add_copyright_field_to_media_uploader( $form_fields, $post ) {
@akshuvo
akshuvo / AutoScaleWithScreenSize.js
Created February 8, 2020 10:07
Auto Scale With Screen Size
// body auto scale
jQuery(document).ready(function($){
if( window.outerWidth > 767 ){
$(window).on('resize',function(){
var baseW = 1920;
var docW = window.outerWidth;
var docH = $(document).height();
var ePos = $('.footerend').position().top;
@akshuvo
akshuvo / FullWidthContainerJs.js
Created January 20, 2020 12:34
Full Width Container using Jquery
// FullWidth Container JS
function fullwidthInit(selector){
function fullWidth(selector){
$(selector).each(function(){
$(this).width("100%").css({ marginLeft : "-0px" });
var window_width = $(window).width();
var left_margin = "-"+$(this).offset().left+"px";
@akshuvo
akshuvo / Redirect-when-cart-is-empty.php
Last active January 20, 2020 07:09
Redirect when cart is empty
<?php
function cart_empty_redirect_to_shop() {
global $woocommerce;
if ( is_page('cart') and !sizeof($woocommerce->cart->cart_contents) ) {
wp_redirect( get_permalink( wc_get_page_id( 'shop' ) ) ); exit;
}
}
add_action('template_redirect', 'cart_empty_redirect_to_shop');
@akshuvo
akshuvo / Responsive-Media-Queries.css
Last active September 18, 2023 21:47
Responsive breakdown - Media Query CSS
/*Responsive*/
/*
##Device = Desktops
##Screen = 1281px to higher resolution desktops
*/
@media (min-width: 1281px) {
@akshuvo
akshuvo / All Country List
Created January 8, 2020 05:02
All Country List
Afghanistan
Albania
Algeria
Andorra
Angola
Antigua and Barbuda
Argentina
Armenia
Australia
Austria
@akshuvo
akshuvo / hide-editor.php
Created January 6, 2020 09:17 — forked from ramseyp/hide-editor.php
Hide the content editor for certain pages in WordPress
<?php
/**
* Hide editor on specific pages.
*
*/
add_action( 'admin_init', 'hide_editor' );
function hide_editor() {
// Get the Post ID.