Skip to content

Instantly share code, notes, and snippets.

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

Chinmoy Paul cpaul007

🏠
Working from home
View GitHub Profile
@cpaul007
cpaul007 / bu_heading_element_controls.php
Last active September 25, 2022 18:18
Adding Custom Tag control in Heading element
<?php //* do not add this line
/**
* enter the code into the functions.php file
*/
add_filter( "bricks/elements/heading/controls", 'bu_filter_heading_element_controls' );
function bu_filter_heading_element_controls( $controls ) {
$controls['tag']['options']['custom'] = esc_html__('Custom');
@cpaul007
cpaul007 / change_place_order_text.php
Created June 8, 2022 14:05
Change place order text
<?php //* do not include this line
add_filter( 'woocommerce_order_button_text', 'ouwoo_custom_place_order_text');
function ouwoo_custom_place_order_text( $button_text ) {
$button_text = "ENTERYOURTEXT";
return $button_text;
}
@cpaul007
cpaul007 / translate_no_product_in_cart_text.php
Created May 26, 2022 03:05
Translate no products in cart text
<?php //* do not include this line
add_filter( 'gettext_woocommerce', 'ouwoo_translate_cart_text', 10, 3);
function ouwoo_translate_cart_text( $translated_text, $text, $domain ) {
switch( $translated_text ) {
case 'No products in the cart.' :
$translated_text = "Please add some products from our shop, so we can generate a quote for you.";
break;
}
return $translated_text;
@cpaul007
cpaul007 / ba_img_initial_offset.php
Last active May 4, 2022 02:42
Changing the initial offset value with ACF custom field
<?php //* do not include this line if you are adding into the functions.php file
/**
* Write the code in snippets plugin
*/
add_filter( 'before_after_image_initial_offset', 'ou_change_before_after_image_initial_offset');
function ou_change_before_after_image_initial_offset( $offset ) {
global $post;
if( ! is_a( $post, 'WP_Post') )
@cpaul007
cpaul007 / hide-element.php
Last active December 21, 2021 16:18
Conditionally hide the Zion element
<?php // do not include this line and enter the bottom code in your theme's functions.php file
/**
* Hiding the element based on the condition
*
* @author Chinmoy Paul
* @version 1.0
*/
class EmptyElement {
public function render_element( $extra_data ) {
echo '';
@cpaul007
cpaul007 / close-ocp-menu-click.js
Last active December 14, 2021 09:32
Closing the off-canvas panel after clicking on the menu item
(function($){
$(document).ready(function(){
let ocps = document.querySelectorAll('.oxy-ou-off-canvas');
ocps.forEach((oc) => {
let menuitems = oc.querySelectorAll('.menu-item');
menuitems.forEach( (menuItem) => {
let anchor = $(menuItem).children('a');
anchor.on('click', function(e){
@cpaul007
cpaul007 / get_on_sale_wc_products_ids.php
Created June 28, 2021 06:58
Get on sale product IDs for Repeater
<?php
/**
* Getting on sale product ids
* @use wc_get_product_ids_on_sale function
* return string
*/
function ouwoo_wc_get_product_ids_on_sale() {
return implode( ",", (array) wc_get_product_ids_on_sale() );
}
@cpaul007
cpaul007 / add_custom_remove_icon.php
Created April 11, 2021 13:28
How to add custom remove icon in Menu/Ultimate Cart
<?php //* Don't add this line
add_action( 'woocommerce_before_mini_cart_contents', 'ouwoo_custom_remove_icon', 11 );
function ouwoo_custom_remove_icon() {
remove_filter( 'woocommerce_cart_item_remove_link', 'ouwoo_woo_cart_remove_button', 10, 2 );
add_filter( 'woocommerce_cart_item_remove_link', 'ouwoo_add_custom_remove_button_icon', 10, 2 );
}
function ouwoo_add_custom_remove_button_icon($remove_link, $cart_item_key ) {
@cpaul007
cpaul007 / change-coupon-field-placeholder-text.php
Created December 7, 2020 10:42
Changing the placeholder text of coupon input field
<?php
add_filter( 'gettext_woocommerce', 'ouwoo_coupon_placeholder_text', 10, 3);
function ouwoo_coupon_placeholder_text( $translated_text, $text, $domain ) {
switch( $translated_text ) {
case 'Enter coupon code' :
$translated_text = "ENTER YOUR TEXT HERE";
break;
}
return $translated_text;
@cpaul007
cpaul007 / new-total-text.php
Created November 20, 2020 12:14
Change New Total Text
<?php
add_filter( 'gettext_woocommerce', 'ouwoo_new_total_text', 10, 3);
function ouwoo_new_total_text( $translated_text, $text, $domain ) {
switch( $translated_text ) {
case 'New Total:' :
$translated_text = "ENTER YOUR TEXT HERE";
break;
}
return $translated_text;