Skip to content

Instantly share code, notes, and snippets.

View manchumahara's full-sized avatar
💭
Life is beautiful!

Sabuj Kundu manchumahara

💭
Life is beautiful!
View GitHub Profile
@manchumahara
manchumahara / gist:5f8c13e30294f571718f8faed3735ec3
Created July 28, 2019 07:43
Filter 'woocommerce_product_get_image' to custom image
add_filter('woocommerce_product_get_image', 'downloadclub_woocommerce_product_get_image', 10, 6);
function downloadclub_woocommerce_product_get_image($image, $wc_product_obj, $size, $attr, $placeholder, $image2){
if ( $wc_product_obj->get_image_id() ) {
$product_id = $wc_product_obj->get_id();
$content_url = content_url();
$thumb_url = '';
function copyText( text ){
var div = document.createElement( 'div' );
div.innerHTML = text;
div.style.height = '';
div.style.position = 'fixed';
div.style.bottom = '0';
div.style.left = '0';
div.style.opacity = '0';
div.style.display = 'block';
div.style.overflow = 'hidden';
if ( defined('CBXPHPSPREADSHEET_PLUGIN_NAME') && cbxphpspreadsheet_loadable() ) {
//Include PHPExcel
require_once( CBXPHPSPREADSHEET_ROOT_PATH . 'lib/vendor/autoload.php' ); //or use 'cbxphpspreadsheet_load();'
//now take instance
$objPHPExcel = new \PhpOffice\PhpSpreadsheet\Spreadsheet();
//do whatever you need to do
}
<?php
/*
Plugin Name: CBX Accounting Override
Plugin URI: https://codeboxr.com
Description: CBX Accounting Override
Author: Codeboxr
Version: 1.0.0
Author URI: https://codeboxr.com
Text Domain: cbxaccountingoverride
Domain Path: /languages/
@manchumahara
manchumahara / gist:6a432b33c7422c803822cfb1dffc5f7e
Last active May 20, 2019 08:50
How to add Mongolian tögrög to CBX Accounting
add_filter('cbxwpsimpleaccounting_currencies', 'cbxwpsimpleaccounting_currencies_custom_currency');
//how to add new currency
/**
* Add new currency
*
* @param array $currency_arr
*
* @return array
add_filter('woocommerce_placeholder_img_src', 'downloadclub_woocommerce_placeholder_img_src', 10, 1);
function downloadclub_woocommerce_placeholder_img_src( $src ) {
return get_template_directory_uri() . '/assets/img/default_thumb.png';
}
add_filter('woocommerce_placeholder_img', 'downloadclub_woocommerce_placeholder_img', 10, 3);
function downloadclub_woocommerce_placeholder_img($image_html, $size, $dimensions){
$image = wc_placeholder_img_src( $size );
$image_html = '<img src="' . esc_attr( $image ) . '" alt="' . esc_attr__( 'Placeholder', 'woocommerce' ) . '" width="' . esc_attr( $dimensions['width'] ) . '" class="woocommerce-placeholder wp-post-image" height="' . esc_attr( $dimensions['height'] ) . '" />';
@manchumahara
manchumahara / gist:bcdb7bd4f4e2f1c6f9744da16cbb8d24
Created April 30, 2019 18:12
WC()->cart null or such error fix for wc 3.6.0 or higher
if ( version_compare( WC_VERSION, '3.6.0', '>=' )) {
require_once( WC_ABSPATH . 'includes/wc-cart-functions.php' );
require_once( WC_ABSPATH . 'includes/wc-notice-functions.php' );
if ( null === WC()->session ) {
$session_class = apply_filters( 'woocommerce_session_handler', 'WC_Session_Handler' );
// Prefix session class with global namespace if not already namespaced
if ( false === strpos( $session_class, '\\' ) ) {
$session_class = '\\' . $session_class;
@manchumahara
manchumahara / buddyposting_object.php
Last active February 3, 2020 09:57
buddyPress posting for poll vote example
$buddy_post = array(
'id' => false,
// Pass an existing activity ID to update an existing entry.
'action' => sprintf(__( '%s has voted poll: <a target="_blank" href = "%s">%s</a>', 'cbxpollproaddon' ), bp_core_get_userlink( bp_loggedin_user_id() ), esc_url(get_permalink( $poll_id )), esc_attr(get_the_title( $poll_id )) ),
// The activity action - e.g. "Jon Doe posted an update"
'content' => apply_filters( 'cbxpoll_buddypress_vote_usernote', __( '<blockquote>I have voted on this poll, why not you ?</blockquote>', 'cbxpollproaddon' ), $user_id, $poll_id ),
'component' => 'cbxpoll',
// The name/ID of the component e.g. groups, profile, mycomponent
'type' => 'cbxpoll_vote',
// The activity type e.g. activity_update, profile_updated
<?php
//action
do_action('tagname');
do_action('tagname2', 'asdasd', 2);
add_action('tagname', 'callback_function');
add_action('tagname2', 'callback_function2', 10, 2);
function callback_function()
{
//timeline
var timelineLimit = 7;
var timelineHalf = 3;
var timelineTotal = 0;
var timelineLimitO = 0;
var timelineHalfO = 0;
var timelineActive = 0;
var timelineSwiper = new Swiper ('.timeline .swiper-container', {
direction: 'vertical',