Skip to content

Instantly share code, notes, and snippets.

View dev-sahab's full-sized avatar
🙂
First, solve the problem.Then write the code

Sahab Uddin dev-sahab

🙂
First, solve the problem.Then write the code
View GitHub Profile
@dev-sahab
dev-sahab / slider-progress.html
Created August 10, 2025 12:44
webflow slider progressbar
<script>
window.Webflow ||= [];
window.Webflow.push(function () {
const mask = document.querySelector('#w-slider-mask-1');
const slides = mask ? Array.from(mask.querySelectorAll('.animated-slides.w-slide')) : [];
const progressFill = document.querySelector('.slider-progress-fill');
const totalSlides = Math.max(slides.length, 1);
function updateProgress(idx) {
if (!progressFill) return;
const safeIdx = Math.max(0, Math.min(idx, totalSlides - 1));
@dev-sahab
dev-sahab / create-warning-in-front-end.php
Created July 10, 2025 08:05
create custom warning entire website
add_action('template_redirect', function () {
if (!is_user_logged_in() || !current_user_can('manage_options')) {
// Display custom error message
wp_die(
'<h1>Something went wrong!</h1><p>We are experiencing a temporary issue. Please check back soon.</p>',
'Error',
array('response' => 503)
);
}
});
@dev-sahab
dev-sahab / lenis.html
Last active May 27, 2025 06:02
Lenis integration Code
<link rel="stylesheet" href="https://unpkg.com/lenis@1.2.3/dist/lenis.css">
<script src="https://unpkg.com/lenis@1.2.3/dist/lenis.min.js"></script>
<script>
let lenis = new Lenis({
lerp: 0.1,
wheelMultiplier: 0.8,
gestureOrientation: "vertical",
normalizeWheel: false,
smoothTouch: false,
});
@dev-sahab
dev-sahab / gist:7ab6e21acc3d51fedf2b605ed6d945e1
Created May 13, 2025 04:00
Add support for custom taxonomies in WooCommerce REST API
// 1. Expose taxonomy in REST and register it for products
function register_merken_taxonomy_for_rest() {
$taxonomy = 'merken';
register_taxonomy_for_object_type($taxonomy, 'product');
$tax = get_taxonomy($taxonomy);
if ($tax) {
$tax->show_in_rest = true;
$tax->rest_base = $taxonomy;
@dev-sahab
dev-sahab / counter-animation.html
Last active July 12, 2025 17:38
Webflow counter animation
<script>
(function() {
const animateNumber = (element, target, duration) => {
let startTime;
const initialNumber = 0;
const easingFunction = t => 1 - Math.pow(1 - t, 4);
const animate = time => {
if (!startTime) startTime = time;
$args = array(
'post_type' => 'post',
'order' => $settings['order'],
'orderby' => $settings['order_by'],
'offset' => $offset,
'posts_per_page' => $post_per_page,
'post__not_in'=> $settings['post_exclude'],
'post__in'=> $settings['post_inlude'],
'ignore_sticky_posts' => $ignore_sticky_posts
);
// elementor fronted view
$(window).on("elementor/frontend/init", function () {
elementorFrontend.hooks.addAction(
"frontend/element_ready/widgetName.default", functionName
);
});
/**
* Custom Icons package
* Call this function in elementor custom widget plugin.php file
* @param array $tabs
* @return void
*/
public function tp_add_custom_icons_tab($tabs = array())
{
// Append new icons