Skip to content

Instantly share code, notes, and snippets.

@mmh4560
mmh4560 / WP_query and shortcode
Created August 11, 2017 16:07
Practise advace shortcode and WP_query funtions.
<?php
/*
Shortcode practise
*/
function query_shortcode($attr, $content = null) {
extract( shortcode_atts( array(
'type' => 'post',
'count' => 3,
@mmh4560
mmh4560 / codestar-metabox.php
Created August 30, 2017 05:53
Practise codestarframework
<?php
require_once( get_template_directory() . '/inc/cs-framwork/cs-framework.php');
function indst_tm_opt_mtbx($options){
$options = array();
$options[] = array(
'id' => 'indst_tm_slide_meta',
'title' => 'Slider Options',
'post_type' => 'inds-slider',
@mmh4560
mmh4560 / slider-with-meta..php
Last active September 4, 2017 04:50
metabox, shortcode
<?php // Slider Shortcode
function inds_owl_slider() {
register_post_type( 'inds-slider', array(
'labels' => array(
'name' => 'Sliders',
'add_new' => 'Add New Slider',
'add_new_item' => 'Add New Slider',
'edit_item' => 'Edit Slider',
),
<?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">
@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>
@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"]' ); ?>
<?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;
}
}
<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>
@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;
// 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';