Skip to content

Instantly share code, notes, and snippets.

View Rupashdas's full-sized avatar
🏠
Working from home

Rupash Das Rupashdas

🏠
Working from home
  • Chittagong, Bangladesh
View GitHub Profile
@Rupashdas
Rupashdas / elementor-widget-extension.php
Last active June 1, 2020 21:35
Boilerplate Extension for creating new widget plugin for elementor
<?php
/*
Plugin Name: Timer element for elementor
Plugin URI: https://devrupash.com
Description: Timer element for elementor
Version: 1.0
Author: Rupash Das
Author URI: https://devrupash.com
License: GPLV2 or later
Text Domain: timerelement
@Rupashdas
Rupashdas / elementor-widget.php
Last active June 1, 2020 21:34
Boilarplate widget for elementor
<?php
class Elementor_Faq_Widget Extends \Elementor\Widget_Base {
public function get_name() {
return "widgetName";
}
public function get_title() {
return __( "Widget Title", "textdomain" );
}
public function get_icon() {
return "fa fa-home";
<?php
/**
* Create Shortcode for WooCommerce Cart Menu Item
*/
function canvas_cart_item() {
ob_start();
$cart_count = WC()->cart->cart_contents_count; // Set variable for cart item count
$cart_url = wc_get_cart_url(); // Set Cart URL
$(document).on('click', 'selector', function() {
var range = document.createRange();
var selector = $(this).next(".data")[0];
var statusSelector = $(this).prev('.copy-status');
console.log(statusSelector);
range.selectNode(selector);
window.getSelection().removeAllRanges();
window.getSelection().addRange(range);
document.execCommand("copy");
window.getSelection().removeAllRanges();
var headerheight = $('#header_sticky').height();
$(window).on('scroll', function () {
var scroll = $(window).scrollTop();
if (scroll < headerheight) {
$("#header_sticky").removeClass("sticky_bar");
} else {
$("#header_sticky").addClass("sticky_bar");
}
});
<?php
$orderby = 'name';
$order = 'asc';
$hide_empty = false ;
$cat_args = array(
'orderby' => $orderby,
'order' => $order,
'hide_empty' => $hide_empty,
);
function ts_quantity_plus_sign() {
echo '<button type="button" class="plus" >+</button>';
}
add_action( 'woocommerce_before_add_to_cart_quantity', 'ts_quantity_minus_sign' );
function ts_quantity_minus_sign() {
echo '<button type="button" class="minus" >-</button>';
}
<?php
function rw_breadcrumbs() {
$showOnHome = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show
$delimiter = '/'; // delimiter between crumbs
$home = 'Home'; // text for the 'Home' link
$showCurrent = 1; // 1 - show current post/page title in breadcrumbs, 0 - don't show
$before = '<li class="active">'; // tag before the current crumb
$after = '</li>'; // tag after the current crumb
/* Medium Layout: 992 to 1200px. */
@media only screen and (min-width: 992px) and (max-width: 1200px) {
}
/* Tablet Layout: 768px to 991px */
@media only screen and (min-width: 768px) and (max-width: 991px) {
}
/* Tablet & Mobile Layout: 991px */
@media only screen and (max-width: 991px) {
@Rupashdas
Rupashdas / Hex-to-rgb-color.php
Created October 12, 2021 10:56
Hexadecimal to RGB color converter
<?php
class RGB {
private $color;
private $red;
private $green;
private $blue;
public function __construct( $colorCode = '' ) {
$this->color = ltrim($colorCode, "#" );
$this->parseColor();
}