Skip to content

Instantly share code, notes, and snippets.

@lilumi
lilumi / scroll.js
Created February 19, 2020 21:45
Scroll arrow hides on scroll (optimized for passive listeners)
//scroll arrow hides on scroll
function hideOnScroll() {
var scroll_el = document.getElementById('scroll');
if ( document.getElementById('app').scrollTop > 20 ) {
scroll_el.style.display = "none";
} else {
scroll_el.style.display = "block";
}
}
@lilumi
lilumi / ul-ol.css
Created February 15, 2020 19:02
Colored Ul & OL
ul, ol {
margin: 0 0 32px 0; /* same as for P */
padding: 0 0 0 1.2em;
}
ul {
list-style: none;
}
ol {
<?php
/*
Plugin Name: Enable/Disable plugins when doing local dev
Plugin URL: https://gist.github.com/pbiron/52bb63042cf220256ece89bc07fb57b0
Description: If the WP_LOCAL_DEV constant is true, enables/disables plugins that you specify
Version: 0.1
License: GPL version 2 or any later version
Author: Paul V. Biron/Sparrow Hawk Computing
Author URI: https://sparrowhawkcomputing.com
*/
@lilumi
lilumi / ie10_gray_img.php
Created September 5, 2019 11:59
IE10 IE9 IE8 gray filter using inline generated svg
<?php
$thumbnail_id = get_post_thumbnail_id();
$thumbnail_url = get_the_post_thumbnail_url( get_the_ID(), $thumb_size );
$html .= '<div '.qode_get_inline_style($overlay_styles).' class="portfolio_shader"></div>';
$html .= '<div class="image_holder">';
$html .= '<span class="image">';
if ((preg_match('/MSIE\s(?P<v>\d+)/i', @$_SERVER['HTTP_USER_AGENT'], $A) && $A['v'] <= 11) || preg_match('/Trident/i', @$_SERVER['HTTP_USER_AGENT'], $B)) {
$html .= '<svg xmlns="http://www.w3.org/2000/svg" id="svgroot-' . $thumbnail_id . '" viewBox="0 0 476 401" width="476" height="401" style="background-image:url(' . $thumbnail_url . ')">
@lilumi
lilumi / show_hidden_acf_fields.php
Created September 3, 2019 11:31
Show system protected custom fields in wp backend metabox
<?php
add_filter( 'is_protected_meta', 'lm_show_hidden_cf', 10, 3 );
function lm_show_hidden_cf( $protected, $meta_key, $meta_type ) {
return false;
}
@lilumi
lilumi / wp-config.php
Created August 20, 2019 20:30
Increase Upload file limit in wp-config.php
@ini_set( 'upload_max_filesize' , '1024M' );
@ini_set( 'post_max_size', '1024M');
@ini_set( 'memory_limit', '256M' );
@ini_set( 'max_execution_time', '300' );
@ini_set( 'max_input_time', '300' );
@lilumi
lilumi / .htaccess
Created August 20, 2019 20:22
Increase Upload file size in .htaccess
php_value upload_max_filesize 1024M
php_value post_max_size 1024M
php_value memory_limit 256M
php_value max_execution_time 300
php_value max_input_time 300
@lilumi
lilumi / fresh_editor_style.php
Created August 19, 2019 09:30
Always Fresh Editor_style in TinyMCE WYSIWYG
<?php
add_filter( 'mce_css', 'lm_fresh_editor_style' );
/**
* Adds a parameter of the last modified time to all editor stylesheets.
*
* @wp-hook mce_css
* @param string $css Comma separated stylesheet URIs.
* @return string $css Comma separated stylesheet URIs with version timestamp.
*/
@lilumi
lilumi / boo_gallery.php
Created July 26, 2019 13:53
Convert standart Gallery to bootstrap format
@lilumi
lilumi / tiny_mce.php
Last active July 25, 2019 15:53
Add button to TinyMCE
<?php
/**
* Registers an editor stylesheet for the theme.
*/
function lm_theme_add_editor_styles() {
add_editor_style( get_stylesheet_directory_uri().'/editor-style.css?ver='.filemtime(get_stylesheet_directory().'/editor-style.css')); //by default editor-style.css
}
add_action( 'admin_init', 'lm_theme_add_editor_styles' );