View stop-video.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Stop all iframes or HTML5 <video>'s from playing | |
*/ | |
var stopVideos = function () { | |
var videos = document.querySelectorAll('iframe, video'); | |
Array.prototype.forEach.call(videos, function (video) { | |
if (video.tagName.toLowerCase() === 'video') { | |
video.pause(); | |
} else { | |
var src = video.src; |
View copy-to-clipboard.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function copyToClipboard() { | |
const cb = navigator.clipboard; | |
const el = document.getElementById('my-element'); | |
cb.writeText(el.innerText); | |
} |
View flush-lists.css
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* source: https://stackoverflow.com/a/43763137/315045 */ | |
ol, ul { | |
padding-left: 0; | |
} | |
li { | |
list-style: none; | |
padding-left: 1.25rem; | |
position: relative; |
View polyfills.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- | |
Only load polyfills for old browsers | |
@see https://devhints.io/polyfill.io | |
@see https://polyfill.io | |
--> | |
<script>if(!(window.Promise&&[].includes&&Object.assign&&window.Map)){document.write('<script src="https://cdn.polyfill.io/v3/polyfill.min.js"></scr'+'ipt>')}</script> | |
<!-- Same as above, but also loads Fetch API polyfill --> | |
<script>if(!(window.fetch&&window.Promise&&[].includes&&Object.assign&&window.Map)){document.write('<script src="https://cdn.polyfill.io/v3/polyfill.min.js?features=default,fetch"></scr'+'ipt>')}</script> |
View remove-wp-image-sizes.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function remove_default_image_sizes( $sizes) { | |
// sizes defined in media settings | |
unset( $sizes['thumbnail']); | |
unset( $sizes['medium']); | |
unset( $sizes['large']); | |
// auto-generated images since WP 5.3 | |
unset( $sizes['medium_large']); | |
unset( $sizes['1536x1536']); | |
unset( $sizes['2048x2048']); |
View block-editor-scripts.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Scripts to run when in WordPress Gutenberg editor | |
* | |
* Unregister any block styles we don't want user to be able to select | |
* or register our own custom block styles. | |
*/ | |
wp.domReady( () => { | |
// Unregister any block styles we don't want user to be able to select | |
wp.blocks.unregisterBlockStyle( 'core/quote', 'default' ); | |
wp.blocks.unregisterBlockStyle( 'core/quote', 'large' ); |
View detect-ie.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var isIE = /*@cc_on!@*/false || !!document.documentMode, // Internet Explorer 6-11 | |
isEdge = !isIE && !!window.StyleMedia; // Edge 20+ | |
if(isIE || isEdge) { | |
// do something... | |
} |
View functions.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Customize number of posts displayed per Custom Post Type | |
* | |
* @see https://mondaybynoon.com/wordpress-posts-per-page-per-custom-post-type/ | |
*/ | |
function custom_posts_per_page($query) { | |
if(!is_admin()) { | |
switch ($query->query_vars['post_type']) { | |
case 'name_of_cpt1': | |
$query->query_vars['posts_per_page'] = -1; |
NewerOlder