Skip to content

Instantly share code, notes, and snippets.

View Korveld's full-sized avatar
🏠
Working from home

Kirill Korveld

🏠
Working from home
View GitHub Profile
filter: drop-shadow(0 2px 6px rgba(88, 88, 88, 0.59));
var lastScrollTop = 0;
$(window).scroll(function(event) {
var st = $(this).scrollTop();
if (st > lastScrollTop) {
//Scroll Down
}
else if (st == lastScrollTop) {
//do nothing
//In IE this is an important condition because there seems to be some instances where the last scrollTop is equal to the new one
}
@Korveld
Korveld / yoast_seo_opengraph_change_image_size.php
Created November 27, 2019 11:34 — forked from amboutwe/yoast_seo_opengraph_change_image_size.php
Code snippet to change or remove OpenGraph output in Yoast SEO. There are multiple snippets in this code.
<?php
/********* DO NOT COPY THE PARTS ABOVE THIS LINE *********/
/* Change size for Yoast SEO OpenGraph image for all content
* Credit: Yoast Development team
* Last Tested: May 24 2019 using Yoast SEO 11.2.1 on WordPress 5.2.1
*/
add_filter( 'wpseo_opengraph_image_size', 'yoast_seo_opengraph_change_image_size' );
function yoast_seo_opengraph_change_image_size( $string ) {
@Korveld
Korveld / tw_remove_menu_pages.php
Created April 11, 2020 12:02 — forked from michael-cannon/tw_remove_menu_pages.php
Remove custom post type submenu pages.
<?php
function tw_remove_menu_pages() {
// remove testimonials menu section
// remove_menu_page( 'edit.php?post_type=testimonials-widget' );
// remove categories
remove_submenu_page( 'edit.php?post_type=testimonials-widget', 'edit-tags.php?taxonomy=category&amp;post_type=testimonials-widget' );
// remove tags
@Korveld
Korveld / jquery ui tooltip disable fade out on mouseleave element
Last active April 23, 2020 13:56
jquery ui tooltip disable fade out on mouseleave element
(function($) {
var uiTooltipTmp = {
options: {
hoverTimeout: 200,
tooltipHover: false // to have a regular behaviour by default. Use true to keep the tooltip while hovering it
},
// This function will check every "hoverTimeout" if the original object or it's tooltip is hovered. If not, it will continue the standard tooltip closure procedure.
timeoutHover: function (event,target,tooltipData,obj){
var TO;
@Korveld
Korveld / bootstrap tooltip disable fade out on mouseleave element
Created April 24, 2020 10:44
bootstrap tooltip disable fade out on mouseleave element
tooltip.popover({
trigger: 'manual',
template: '<div class="popover" role="tooltip"><h3 class="popover-header"></h3><div class="popover-body"></div></div>',
offset: 0,
placement: 'auto',
delay: 100,
}).on({
mouseenter: function () {
var $this = $(this)
$this.popover("show")
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>slickGoTo usage example</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/slick-carousel@1.8.1/slick/slick.css">
<link rel="stylesheet" href="http://kenwheeler.github.io/slick/slick/slick-theme.css">
<style>
.slider img {
@Korveld
Korveld / jQuery delay between addClass or removeClass
Last active September 9, 2020 10:10
jQuery delay between addClass or removeClass
$("#div").addClass("error").delay(1000).queue(function(next){
$(this).removeClass("error");
next();
});
// OR
$("#div").addClass("error").delay(1000).queue(function(){
$(this).removeClass("error").dequeue();
});
@Korveld
Korveld / Get list of woocommerce categories
Last active September 9, 2020 10:10
Get list of woocommerce categories
<?php
$cat_args = array(
'orderby' => 'name',
'order' => 'asc',
'hide_empty' => false,
// 'include' => 177 // (array|string) Array or comma/space-separated string of term ids to include. Default empty array.
);
$product_categories = get_terms( 'product_cat', $cat_args );
@Korveld
Korveld / W3 total cache change filenames after clear cache
Last active October 28, 2020 16:32
W3 total cache change filenames after clear cache
<?php
add_action( 'w3tc_flush_all', 'action_w3tc_flush_all', 10, 1 );
function action_w3tc_flush_all() {
$vers = "v_".date("Y_m_d_H_i_s")."_";
update_option( "w3_files_version", $vers);
}
add_filter('w3tc_minify_urls_for_minification_to_minify_filename', 'w3tc_filename_filter', 20, 3);
function w3tc_filename_filter($minify_filename, $files, $type ) {
$vers = get_option("w3_files_version");