Skip to content

Instantly share code, notes, and snippets.

@mohsinworld
mohsinworld / Add Country Code with Flag in Elementor Forms
Created February 3, 2026 21:48
Canda & USA is the default country. "number" should be the number field's ID
HTML widget 1:
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.5.0/css/intlTelInput.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/intl-tel-input/18.5.0/js/intlTelInput.min.js"></script>
HTML widget 2:
<script>
jQuery(window).on('elementor/frontend/init', function () {
elementorFrontend.hooks.addAction(
@mohsinworld
mohsinworld / Footer Copyright Text with Dynamic Year Change
Last active February 3, 2026 20:17
Use that code on WPCode then call it using shortcode [simple_copyright]
@mohsinworld
mohsinworld / Elementor Pro or Free Logo Shrink CSS
Created December 15, 2025 14:14
Add this sticky-logo CSS as custom CSS on the logo's advance tab. Add that CSS as custom CSS
.elementor-sticky--effects .sticky-logo img {
width: 320px!important;/*-- edit the pixels to change to desired shrinking size --*/
}
.sticky-logo img {
transition: .5s all ease-in-out;
}
@media screen and (max-width: 767px) {
.elementor-sticky--effects .sticky-logo img {
// Add Math CAPTCHA to WooCommerce Checkout
add_action('woocommerce_after_order_notes', 'custom_math_captcha_checkout');
function custom_math_captcha_checkout($checkout) {
$num1 = rand(1, 10); // Generate first random number
$num2 = rand(1, 10); // Generate second random number
$sum = $num1 + $num2; // Calculate the sum
// Store the sum in a session for later validation
WC()->session->set('math_captcha_sum', $sum);
@mohsinworld
mohsinworld / Display Current Year in WordPress Using Shortcode
Created September 27, 2024 22:15
[year] shorcode will show the current year
function currentYear( $atts ){
return date('Y');
}
add_shortcode( 'year', 'currentYear' );
@mohsinworld
mohsinworld / Shrink Sticky Menu (shrink the logo) Using Elementor & Astra Free
Last active September 26, 2025 05:11
This code should add in Elementor cutom CSS & logoimage should add into custom CSS classes box
.logoimage {
max-width: 180px;
width: 180px;
transition: 0.5s all ease-in-out;
}
.elementor-sticky--effects .logoimage {
max-width: 90px;
width: 90px;
transition: 0.5s all ease-in-out;
/wp-admin/admin.php?page=wpcf7&action=validate
@mohsinworld
mohsinworld / Roatating Image Like Vinyl
Created June 15, 2024 07:26
Have to add this as custom CSS on that widget
selector {
display: inline-block;
animation: rotate 5s linear infinite;
}
@keyframes rotate {
from {
transform: rotate(0deg);
}
to {
@mohsinworld
mohsinworld / WooCommerce Custom Delivery Days
Last active June 12, 2024 10:21
Add as PHP Snippet by WP Code Snippet Plugin. Insert Method: Auto Insert, Location: Run Everywhere.
// Add a custom delivery days range field to the product editing page
add_action('woocommerce_product_options_general_product_data', 'add_custom_delivery_days_range_field');
function add_custom_delivery_days_range_field() {
global $post;
// Get the current value, if it exists
$custom_delivery_days = get_post_meta($post->ID, '_custom_delivery_days', true);
echo '<div class="options_group">';