Skip to content

Instantly share code, notes, and snippets.

// mobile menu
let tpMenuHTML = $('.tp-mobile-menu-active > ul').clone();
let tpOffcanvasMenu = $('.tp-offcanvas-menu > nav');
tpOffcanvasMenu.append(tpMenuHTML);
if($(tpOffcanvasMenu).find('.sub-menu').length != 0){
$(tpOffcanvasMenu).find('.sub-menu').parent().append('<button class="tp-sidemenu-close"><i class="fas fa-chevron-right"></i></button>');
}
<div class="wrapper">
<div class="progress-circle" data-bg-w="conic-gradient( #4d5bf9 0% 90%,#e0e0e0 90% 100%)">
<span>90%</span>
</div>
</div>
$("[data-bg-w]").each(function () {
$(this).css("background", $(this).attr("data-bg-w"))
})
// menu
function demo_main_menu(){
wp_nav_menu(array(
'theme_location' => 'main-menu',
'container' => '',
'menu_class' => '',
'fallback_cb' => 'Demo_Walker_Nav_Menu::fallback',
'walker' => new Demo_Walker_Nav_Menu,
));
}
@ThemePure
ThemePure / Sass Loop
Created January 12, 2025 14:51
Sass Loop
// for margin top
@for $x from 1 through 10 {
.mt-#{3 * $x}{
margin-top: 3px * $x;
}
}
// form padding top
@for $x from 1 through 10 {
.pt-#{2 * $x}{
//one
function custom_reviews_with_progress_bar() {
global $product;
// Get product reviews
$reviews = $product->get_rating_counts();
$total_reviews = array_sum($reviews);
$average_rating = $product->get_average_rating();
// Define star levels
@ThemePure
ThemePure / Custom Buy Now Button Add In Woo
Last active January 3, 2025 13:43
Custom Buy Now Button Add In Woo
// Add "Buy Now" button next to Add to Cart button
function add_buy_now_button() {
global $product;
$product_id = $product->get_id();
$checkout_url = wc_get_checkout_url();
@ThemePure
ThemePure / smart plugin filter
Last active November 12, 2024 12:07
Smart Plugin Filter
// compare_false
add_filter( 'woosc_button_position_archive', '__return_false' );
add_filter( 'woosc_button_position_single', '__return_false' );
// quickview_false
add_filter( 'woosq_button_position', '__return_false' );
// wishlist_false
add_filter( 'woosw_button_position_archive', '__return_false' );
add_filter( 'woosw_button_position_single', '__return_false' );
@ThemePure
ThemePure / pagination.php
Created October 30, 2024 15:02
blog pagination
function demo_navigation(){
$pages = paginate_links( array(
'type' => 'array',
'prev_text' => __('<svg width="16" height="11" viewBox="0 0 16 11" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M6.17749 10.105L1.62499 5.55248L6.17749 0.999981" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
<path d="M14.3767 5.55249L1.75421 5.55249" stroke="currentColor" stroke-width="1.5" stroke-miterlimit="10" stroke-linecap="round" stroke-linejoin="round"/>
</svg>
Prev','harry'),
'next_text' => __('Next
<svg width="16" height="11" viewBox="0 0 16 11" fill="none" xmlns="http://www.w3.org/2000/svg">
@ThemePure
ThemePure / tag.php
Last active October 30, 2024 15:00
Blog tag
function demo_tags(){
$post_tags = get_the_tags();
if ($post_tags) {
foreach ($post_tags as $tag) {
?>
<a href="<?php echo get_tag_link($tag); ?>"><?php echo esc_html( $tag->name); ?></a>
<?php
}
} else {
?>
@ThemePure
ThemePure / Blog Query
Last active January 27, 2025 18:08
WP Query With Cat
$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
);