Skip to content

Instantly share code, notes, and snippets.

View stalukder03's full-sized avatar

Sajib Talukder stalukder03

View GitHub Profile
@stalukder03
stalukder03 / Redux-required-arg-exampes.php
Created September 19, 2017 04:02 — forked from dovy/Redux-required-arg-exampes.php
Example of the required attribute for the Redux Framework.
<?php
$options = array(
'required' => array('id','equals',array( 1,3 ) ) // Multiple values
);
$options = array(
'required' => array('id','equals', array( 1 ) ) // Single value
);
@stalukder03
stalukder03 / add-wordpress-settings-page.php
Created September 19, 2017 11:07 — forked from DavidWells/add-wordpress-settings-page.php
WordPress :: Add Settings Page with All Fields
<?php
/*
Plugin Name: Homepage Settings for BigBang
Plugin URI: http://www.inboundnow.com/
Description: Adds additional functionality to the big bang theme.
Author: David Wells
Author URI: http://www.inboundnow.com
*/
// Specify Hooks/Filters
@stalukder03
stalukder03 / add-to-cart.php
Created September 21, 2017 09:09 — forked from Jplus2/add-to-cart.php
Add quantity button and ajax functionality to add to cart button on product archive page.
<?php
/**
* Custom Loop Add to Cart.
*
* Template with quantity and ajax.
*/
if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly.
global $product;
@stalukder03
stalukder03 / gist:60214f8e17bc5a69d9333caed2894c5e
Created September 21, 2017 09:42 — forked from webaware/gist:6260468
WooCommerce purchase page add-to-cart with quantity and AJAX, without customising any templates. See blog post for details: http://snippets.webaware.com.au/snippets/woocommerce-add-to-cart-with-quantity-and-ajax/
<?php
/**
* start the customisation
*/
function custom_woo_before_shop_link() {
add_filter('woocommerce_loop_add_to_cart_link', 'custom_woo_loop_add_to_cart_link', 10, 2);
add_action('woocommerce_after_shop_loop', 'custom_woo_after_shop_loop');
}
add_action('woocommerce_before_shop_loop', 'custom_woo_before_shop_link');
@stalukder03
stalukder03 / gist:6825f25c27b0d6784f6d91cd3767cd93
Created September 25, 2017 18:19 — forked from mohammadmursaleen/gist:9622098e43afdab6025e
Adding custom fields above WOOCOMMERCE add to cart button
<?php
// To add custom data above add to cart button in woocommerce
// step 1
add_action('wp_ajax_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback');
add_action('wp_ajax_nopriv_wdm_add_user_custom_data_options', 'wdm_add_user_custom_data_options_callback');
function wdm_add_user_custom_data_options_callback()
<?php
/*
Register Fonts
*/
function studio_fonts_url() {
$font_url = '';
/*
Translators: If there are characters in your language that are not supported
by chosen font(s), translate this to 'off'. Do not translate into your own language.
git rm -r --cached .
git add .
git commit -m "fixing .gitignore"
@stalukder03
stalukder03 / gist:1bbcdc1a4ff6087fa746e2d03d9f7a46
Created November 21, 2017 09:25
Disable Redux activation redirect
add_action( 'redux/construct', 'radium_remove_as_plugin_flag' );
/**
* Remove plugin flag from redux. Get rid of redirect
*
* @since 1.0.0
*/
function radium_remove_as_plugin_flag() {
ReduxFramework::$_as_plugin = false;
}
/**
* Escape translated strings with:
*/
__( ‘Hello world’, ‘text-domain’ ); _e( ‘Hello world’, ‘text-domain’ );.
/**
* If there is no HTML use:
*/
esc_html__( ‘Hello world’, ‘text-domain’ ); esc_html_e( ‘Hello world’, ‘text-domain’ );
@stalukder03
stalukder03 / creatSpanTag.php
Created December 28, 2017 07:46 — forked from mdjwel/creatSpanTag.php
Convert a special sign to HTML Tag
<?php
function Convert_to_htmlTag($string, $tagSign='|') {
$firstSign = strpos($string, $tagSign);
$lastSign = strpos($string, $tagSign, $firstSign+1);
$strArray = str_split($string);
$replaceSigns = array($firstSign=>'<span class="se-s-color">', $lastSign=>'</span>');
$replaceSigns = array_replace($strArray, $replaceSigns);
echo implode($replaceSigns);
}