Skip to content

Instantly share code, notes, and snippets.

<!-- Meta Pixel Code -->
<script>
!function(f,b,e,v,n,t,s)
{if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};
if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';
n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];
s.parentNode.insertBefore(t,s)}(window, document,'script',
'https://connect.facebook.net/en_US/fbevents.js');
Code Snippet
// Automatically shortens WooCommerce product titles on the main shop, category, and tag pages
// to a set number of characters
function short_woocommerce_product_titles_chars( $title, $id ) {
if ( ( is_shop() || is_product_tag() || is_product_category() ) && get_post_type( $id ) === 'product' ) {
// Kicks in if the product title is longer than 60 characters
if ( strlen( $title ) > 40) {
// Shortens it to 60 characters and adds ellipsis at the end
return substr( $title, 0, 40 ) . '...';
function wc_billing_field_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Billing details' :
$translated_text = __( 'Billing Info', 'woocommerce' );
break;
}
return $translated_text;
}
add_filter( 'gettext', 'wc_billing_field_strings', 20, 3 );
Created header using this plugin: https://wordpress.org/plugins/header-footer-elementor/
Step 1 – Now edit the above header in Elementor and add a Custom ID to the outermost section (here we are using my-custom-id ).
Step 2 – Now add following custom CSS. You can add it to the customizer under the ‘Additional CSS’ section or use
any external plugin that provides an area to add custom CSS.
#custom-sticky-section.elementor-section{
position: fixed;
left: 0;
@mohsinworld
mohsinworld / Allow Unsupported File Upload to WordPress Website
Created January 28, 2023 21:48
Ad that code right under "define( 'WP_DEBUG', false );" inside wp-config.php file
define('ALLOW_UNFILTERED_UPLOADS', true);
@mohsinworld
mohsinworld / Update Cart Automatically on Quantity Change
Last active December 29, 2022 10:44
Add this code the functions.php file (CSS to hide update button) Source: https://rudrastyh.com/woocommerce/remove-update-cart-button.html
.woocommerce button[name="update_cart"],
.woocommerce input[name="update_cart"] {
display: none!important;
}
====================================================================
add_action( 'wp_footer', function() {
@mohsinworld
mohsinworld / Disable Automatic Updates
Last active November 9, 2022 10:40
Need to add this code into functions.php file inside the themes folder
// Disable core auto-updates
add_filter( 'auto_update_core', '__return_false' );
// Disable auto-updates for plugins.
add_filter( 'auto_update_plugin', '__return_false' );
// Disable auto-updates for themes.
add_filter( 'auto_update_theme', '__return_false' );
<iframe src="https://gocast123.me/embed.php?player=desktop&v=tenspk" name="play" width="100%" height="412" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<a href="https://www.youtube.com/embed/7jMlFXouPk8" target="play">Play This</a>
@mohsinworld
mohsinworld / Embed YouTube Playlist Into Website
Last active October 2, 2022 16:25
"PLJfJ0pgBPYK9o9Bdk7-yajxvCduglPfGa" this playlist ID will be replaced by the actual playlist ID
<iframe width="100%" height="412" src="https://www.youtube.com/embed/videoseries?list=PLJfJ0pgBPYK9o9Bdk7-yajxvCduglPfGa&?controls=0" frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>