Skip to content

Instantly share code, notes, and snippets.

View meetKowshik's full-sized avatar

Kowshik Ahmed meetKowshik

  • Dhaka, Bangladesh
View GitHub Profile
@meetKowshik
meetKowshik / Sitemap template for WC
Created October 23, 2019 04:28
Sitemap template for WC
<?php
/**
* Template Name: Sitemap
*/
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main">
@meetKowshik
meetKowshik / Get the tags or categories from the wordpress db in custom way
Created October 14, 2019 04:45
Get the tags or categories based on post ID from the wordpress db in custom way
//=== here postId is the Post ID which is passing from a shortcode function
function eventsCats($postId) {
global $wpdb;
$get_term_taxonomy_id_q = "SELECT term_taxonomy_id FROM wp_yjigapdowy_term_relationships WHERE object_id = $postId"; // get the term taxonomy id from the db based on product id
$get_term_taxonomy_id_arr = $wpdb->get_results($get_term_taxonomy_id_q, ARRAY_N);
// store term taxonomy id array
$get_term_taxonomy_id = array();
@meetKowshik
meetKowshik / Showing smart shopping bar on Category, Product, Cart page, Checkout page in BigCommerce
Last active April 6, 2022 22:23
Showing smart shopping bar on Category, Product, Cart page, Checkout page in BigCommerce
First add the below html code where you want to show in the category.html, product.html and cart.html
<div class="shipping-bar-wrapper" data-coupon-code="{{lang 'freeDelivery'}}"></div>
Add the freeDevlivery(the coupon amount) text to the en.json file in the lang file.
Add this Js code to global.js in the assets/js/theme folder
fetch('/api/storefront/cart', {
credentials: 'same-origin'
})
.then(function(response) {
@meetKowshik
meetKowshik / Showing only the listing that are bookmarked by the user in Directories Pro
Last active April 21, 2020 21:08
Showing only the listing that are bookmarked by the user in Directories Pro
function theme_free_user_bookmarkedlisting_shortcode( $atts, $content= null ) {
$user = wp_get_current_user();
$current_user_id = $user->ID;
$base_url = get_site_url();
global $wpdb;
$listingEntityId = $wpdb->get_results("SELECT vote_entity_id FROM wp_yjigapdowy_drts_voting_vote WHERE vote_field_name = 'voting_bookmark' AND vote_bundle_name='practitioner_dir_ltg' AND vote_user_id = $current_user_id AND vote_value = '1.00' ");
@meetKowshik
meetKowshik / Browser back button disable in wordpress
Created June 14, 2019 22:05
Browser back button disable in wordpress
<?php if(is_page('page title')){ ?>
<script type = "text/javascript" >
history.pushState(null, null, 'page-slug');
window.addEventListener('popstate', function(event)
{
history.pushState(null, null, 'page-slug');
});
</script>
<?php }?>
@meetKowshik
meetKowshik / Dropdown activate in touch device
Last active October 10, 2019 21:06
Dropdown Activate in touch device (working for iphone X landscape mode, Ipad and Ipad pro)
$(window).resize(function() {
if($(this).innerWidth() > 800 && $(this).innerWidth() < 1367) {
if(/Ipad/i.test(navigator.userAgent)) {
$('Paste the navigation selector here').on('click', function(e) {
if($(this).hasClass('special class whether this one has submenu or not')) {
return false;
}
})
} else if (/Mobi/i.test(navigator.userAgent)) {
$('Paste the navigation selector here').on('click', function(e) {
@meetKowshik
meetKowshik / window resize event listener control
Created April 13, 2019 16:32
window resize event listener control
It's better not to overwrite the default window event resize functionality. in order run a function on window resize, this method can be a good way
var addEvent = function(object, type, callback) {
if (object == null || typeof(object) == 'undefined') return;
if (object.addEventListener) {
object.addEventListener(type, callback, false);
} else if (object.attachEvent) {
object.attachEvent("on" + type, callback);
} else {
object["on"+type] = callback;
}
@meetKowshik
meetKowshik / Resolve fs not exist error in npm
Created March 5, 2019 16:34
Resolve fs not exist error in npm
node: {
fs: "empty"
}
@meetKowshik
meetKowshik / Scroll to top
Last active December 19, 2019 13:42
Scroll to top button
html
// add this after footer
<a href="#scrollto_top" class="scrolltop"><i class="fa fa-chevron-up"></i>Scroll to top</a>
// add id "top" to header element
css
.scrolltop {
display: none;
position: fixed;
bottom: 70px;
@meetKowshik
meetKowshik / Including banner in Stencil
Created December 5, 2018 21:45
Including single banner from multiple banners in Stencil
{{#if banners.top}}
{{#each banners.top}}
{{#contains this "bannaer-title"}}
{{{ this }}}
{{/contains}}
{{/each}}
{{/if}}