This file contains hidden or 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
/*———— -Handling query strings- ————*/ | |
let getQueryString = function ( field, url ) { | |
var href = url ? url : window.location.href; | |
var reg = new RegExp( '[?&]' + field + '=([^&#]*)', 'i' ); | |
var string = reg.exec(href); | |
return string ? string[1] : null; | |
}; | |
let i = getQueryString('i'); |
This file contains hidden or 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
$0.textContent.replace(/\s/g, '%20'); |
This file contains hidden or 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 enqueue_recaptcha_scripts() { | |
wp_enqueue_script( 'google-recaptcha', 'https://www.google.com/recaptcha/api.js', array(), '0.0.1', true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'enqueue_recaptcha_scripts' ); | |
function add_async_defer_attributes($tag, $handle) { | |
if ( 'google-recaptcha' !== $handle ) | |
return $tag; | |
return str_replace( ' src', ' async defer src', $tag ); |
This file contains hidden or 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
import { isMobile , isMobileSize } from '../helpers/utilities'; | |
import store from '@/modules/PubSub/store/index.js'; | |
const BrowserTabs = (() => { | |
class BrowserTabs { | |
constructor() { | |
this.hidden = null; | |
this.visibilityChange = null; | |
this.store = store; | |
this.title = document.title; |
This file contains hidden or 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 | |
get_header(); | |
$cat_id = get_queried_object_id(); | |
$is_category = is_category($cat_id); | |
$query_cat_id = $is_category ? $cat_id : null; | |
$cat_data = get_category($cat_id); | |
$post_id = $is_category ? $cat_id : get_option('page_for_posts'); | |
//means-- if it's a category, set the ID to that category page so we can get its title etc. |
This file contains hidden or 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
copyToClipboard(str) { | |
/* ——— Derived from: https://hackernoon.com/copying-text-to-clipboard-with-javascript-df4d4988697f | |
improved to add iOS device compatibility——— */ | |
const el = document.createElement('textarea'); // Create a <textarea> element | |
let storeContentEditable = el.contentEditable; | |
let storeReadOnly = el.readOnly; | |
el.value = str; // Set its value to the string that you want copied | |
el.contentEditable = true; |
This file contains hidden or 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
"Include Media Breakpoint": { | |
"prefix": "media", | |
"body": [ | |
"@include media('${1|>=,<=,>,<|}${2|480px,768px,1024px,1170px|}') {", | |
"\t$0", | |
"}", | |
], | |
"description": "@include-media plugin sccs breakpoint" | |
}, |
This file contains hidden or 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 | |
$upload_dir = wp_upload_dir(); | |
$custom_files_path = $upload_dir['baseurl'] . '/files/'; | |
//...continued | |
?> |
This file contains hidden or 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
getSiblings(elem) { | |
var siblings = []; | |
var sibling = elem.parentNode.firstChild; | |
for (; sibling; sibling = sibling.nextSibling) { | |
if (sibling.nodeType !== 1 || sibling === elem) continue; | |
siblings.push(sibling); | |
} | |
return siblings; | |
} |
This file contains hidden or 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 | |
/*Template Name: Some Template */ | |
?> |