Skip to content

Instantly share code, notes, and snippets.

// Woocommerce Show All products on Shop page
/**
* Change number of products that are displayed per page (shop page)
*/
add_filter( 'loop_shop_per_page', 'new_loop_shop_per_page', 20 );
function new_loop_shop_per_page( $cols ) {
// $cols contains the current number of products per page based on the value stored on Options -> Reading
// Return the number of products you wanna show per page.
@mmh4560
mmh4560 / css
Created March 16, 2019 20:22
Edit The Input Chcekbox Css
input[type="checkbox"] {
transform: scale(2);
-ms-transform: scale(2);
-webkit-transform: scale(2);
margin-top: 8px;
}
// Just add those code in your functions.php file
// Function to change email address
function wpb_sender_email( $original_email_address ) {
return 'tim.smith@example.com';
}
// Function to change sender name
function wpb_sender_name( $original_email_from ) {
return 'Tim Smith';
@mmh4560
mmh4560 / cart.html
Created January 13, 2019 10:58
How to add Woocommerce Cart Icon in home page
<!-- Use this code where do you want to show your cart icon -->
<div class='my-cart'>
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php _e('View Cart'); ?>"><?php echo sprintf ( _n( '%d item', '%d items', WC()->cart->get_cart_contents_count() ), WC()->cart->get_cart_contents_count() ); ?> - <?php echo WC()->cart->get_cart_total(); ?></a>
</div>
/* Here is css */
.cart-contents::before {
font-family: WooCommerce;
@mmh4560
mmh4560 / style.css
Last active January 5, 2021 02:57
Register Custom Fonts WordPress
/* At first Upload your desire fonts the try it */
@font-face {
font-family: "Arvo";
src: url(http://www.example.com/wp-content/themes/your-theme/fonts/Arvo-Regular.ttf);
font-weight: normal;
}
/* Now you can use it in for your Html code something like this*/
<div id="f1_container">
<div id="f1_card" class="shadow">
<div class="front face">
<img src="/images/Windows%20Logo.jpg"/>
</div>
<div class="back face center">
<p>This is nice for exposing more information about an image.</p>
<p>Any content can go here.</p>
</div>
</div>
<?php
// [desktoponly] shortcode
add_shortcode('desktoponly', 'wp_snippet_desktop_only_shortcode');
function wp_snippet_desktop_only_shortcode($atts, $content = null){
if( !wp_is_mobile() ){
return wpautop( do_shortcode( $content ) );
} else {
return null;
}
}
@mmh4560
mmh4560 / shortcode.php
Created October 26, 2018 05:07
Contact Form 7 Shortcode in static template
<?php echo do_shortcode( '[contact-form-7 id="1234" title="Contact form 1"]' ); ?>
@mmh4560
mmh4560 / gist:9906fcdd4f8a8df86c482d4c8aa0f664
Created October 21, 2018 11:51
Leverage Browser Caching
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)\.html$ $1.html [nc]
RewriteCond %{HTTP_HOST} !^www.greatamericanautotransportation.com$ [NC]
RewriteRule ^(.*)$ http://www.greatamericanautotransportation.com$1 [L,R=301]
</IfModule>
# BEGIN EXPIRES
<IfModule mod_expires.c>
<?php get_header(); ?>
<div class="content-outer-wrap">
<div class="content-wrap">
<div class="footer-wrap">
<div class="content">
<div class="col1">
<div class='myimage-wrap'>
<div class='flower'></div>
<div class='imageframe'>
<div class="top-image">