Skip to content

Instantly share code, notes, and snippets.

View imuhammadshoaib's full-sized avatar
🎯
Focusing

Muhammad Shoaib imuhammadshoaib

🎯
Focusing
View GitHub Profile
@imuhammadshoaib
imuhammadshoaib / functions.php
Created October 20, 2021 11:45
Custom Validatation For Phone Number Field Contact Form 7
<?php
function custom_filter_wpcf7_is_tel( $result, $tel ) {
$result = preg_match( '/^(?:0)\d{9}+$/', $tel );
return $result;
}
add_filter( 'wpcf7_is_tel', 'custom_filter_wpcf7_is_tel', 10, 2 );
?>
@imuhammadshoaib
imuhammadshoaib / script.js
Created October 3, 2021 21:55
How to remove Nitropack footer?
jQuery(document).ready(function(){
setTimeout(function(){
//var np_tag = jQuery("template").eq(38).attr("id");
var np_tag = jQuery("template").last().attr("id");
console.log(np_tag);
//alert(tag_new);
jQuery("#" + np_tag).css("display", "none");
@imuhammadshoaib
imuhammadshoaib / section-collection.liquid
Last active November 20, 2022 10:46
Add Read More & Read Less Button on Collection Description
{% if collection.description != blank %}
<div class="collection--description">
{% capture readmore %}
<div id="truncated">{{ collection.description | strip_html | truncatewords: 10, "... <a class='read-more-collection' data-no-instant>Read More</a>" }}</div>
<div id="fullDescription" style="display: none">{{ collection.description | append: " <a class='read-more-collection' data-no-instant>Read Less</a>" }}</div>
{% endcapture %}
{{ readmore }}
</div>
{% endif %}
@imuhammadshoaib
imuhammadshoaib / functions.php
Created March 15, 2021 13:42 — forked from yratof/functions.php
Getting the Video ID from ACF OEmbed, then using that ID to call in videos without bloat
<?php
/* Parse the video uri/url to determine the video type/source and the video id */
function parse_video_uri( $url ) {
// Parse the url
$parse = parse_url( $url );
// Set blank variables
$video_type = '';
$video_id = '';
@imuhammadshoaib
imuhammadshoaib / cartDiscount.liquid
Created November 12, 2020 10:59 — forked from atikju/cartDiscount.liquid
Shopify - Apply Discount / Coupon / Promo Code on cart page
<div class="cart-promo">
<h2>ENTER A PROMO CODE</h2>
<input type="text" id="devPromo">
<a href="/checkout?discount=none" id="redemDevPromo">Apply Coupon</a>
</div>
<script>
$(document).ready(function(){
//listen to the promo button click
$('#redemDevPromo').on('click', function(event){
//disable the button event
@imuhammadshoaib
imuhammadshoaib / function.php
Created August 17, 2020 16:16
Move Product Tabs Under the Short Description
/**
* @snippet Move product tabs beside the product image - WooCommerce
* @how-to Get CustomizeWoo.com FREE
* @sourcecode https://businessbloomer.com/?p=393
* @author Rodolfo Melogli
* @testedwith WooCommerce 3.5.2
* @donate $9 https://businessbloomer.com/bloomer-armada/
*https://www.businessbloomer.com/woocommerce-move-product-tabs-short-description/
*/
@imuhammadshoaib
imuhammadshoaib / wc-add-additional-information.php
Created August 17, 2020 15:50 — forked from woogists/wc-add-additional-information.php
[Frontend Snippets][Editing product data tabs] Add additional information
/**
* Check if product has attributes, dimensions or weight to override the call_user_func() expects parameter 1 to be a valid callback error when changing the additional tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
global $product;
if( $product->has_attributes() || $product->has_dimensions() || $product->has_weight() ) { // Check if product has attributes, dimensions or weight
@imuhammadshoaib
imuhammadshoaib / wc-add-custom-tab.php
Created August 17, 2020 15:50 — forked from woogists/wc-add-custom-tab.php
[Frontend Snippets][Editing product data tabs] Add a custom tab
/**
* Add a custom product data tab
*/
add_filter( 'woocommerce_product_tabs', 'woo_new_product_tab' );
function woo_new_product_tab( $tabs ) {
// Adds the new tab
$tabs['test_tab'] = array(
'title' => __( 'New Product Tab', 'woocommerce' ),
@imuhammadshoaib
imuhammadshoaib / wc-custom-tab.php
Created August 17, 2020 15:50 — forked from woogists/wc-custom-tab.php
[Frontend Snippets][Editing product data tabs] Customize a tab
/**
* Customize product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_custom_description_tab', 98 );
function woo_custom_description_tab( $tabs ) {
$tabs['description']['callback'] = 'woo_custom_description_tab_content'; // Custom description callback
return $tabs;
}