Skip to content

Instantly share code, notes, and snippets.

<?php
/*
* Hero slider Shortcode
* =======================================================
* Register Hero slider shortcode
* =======================================================
*/
<?php
//functions php
add_filter( 'woocommerce_add_to_cart_fragments', 'woocommerce_header_add_to_cart_fragment' );
function woocommerce_header_add_to_cart_fragment( $fragments ) {
global $woocommerce;
ob_start();
?>
<a class="cart-contents" href="<?php echo wc_get_cart_url(); ?>" title="<?php esc_html_e('View your shopping cart', 'text_domain'); ?>">
<?php
//functions php
add_action('init', 'themename_custom_icon_set');
function themename_custom_icon_set() {
if( function_exists( 'kc_add_icon' ) ) {
kc_add_icon( get_template_directory_uri().'/css/material-design-iconic-font.min.css' );
kc_add_icon( get_template_directory_uri().'/css/flaticon.css' );
<div class="product-tablist">
<ul class="tab-style">
<li class="active" data-view="grid-view"><i class="fa fa-th"></i></li>
<li data-view="list-view"><i class="fa fa-th-list"></i></li>
</ul>
</div>
//add archive product
<div class="product-bottom-area grid-view clearfix">
<?php
//this code is functions.php
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
delete_post_meta($postID, $count_key);
add_post_meta($postID, $count_key, '0');
/*woocommerce pagination*/
.woocommerce nav.woocommerce-pagination{}
.woocommerce nav.woocommerce-pagination ul.page-numbers{}
.woocommerce nav.woocommerce-pagination ul li{}
.woocommerce nav.woocommerce-pagination ul li a{}
.woocommerce nav.woocommerce-pagination ul li span.current,
.woocommerce nav.woocommerce-pagination ul li a:hover{}
.woocommerce nav.woocommerce-pagination ul li a.prev,
.woocommerce nav.woocommerce-pagination ul li a.next{}
<?php
function themename_body_classes( $classes ) {
// body calss for page
if ( is_singular( 'page' ) ) {
global $post;
$classes[] = 'page-' . $post->post_name;
}
return $classes;
}
add_filter( 'body_class', 'themename_body_classes' );
<?php
function themeName_get_the_id(){
if(is_woocommerce()){
$id = get_option( 'woocommerce_shop_page_id' );
} elseif(is_home() && !is_front_page()){
$id = get_option( 'page_for_posts' );
} else {
$id = get_the_id();
}
<?php
//templates\global\quantity-input.php
//remove qty class from input field
//add the markup below after input field
<div class="qty">
<a class="plus" href="javascript:void(0);">
<i class="fa fa-plus"></i>
</a>
<a class="minus" href="javascript:void(0);">
<i class="fa fa-minus"></i>
<?php
//
$date_events = get_post_meta(get_the_ID(), '_eduhome_events_date',true);
$date_formet = new DATETIME( $date_field );
<div class="running-offer__time" data-countdown="<?php echo $date_formet->format('Y'); ?>/<?php echo $date_formet->format('m'); ?>/<?php echo $date_formet->format('d'); ?>">
</div>