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
# Redirect visitors who request the root domain path (e.g. www.mywebsite.ch) to the appropriate language version | |
# Fallback to English version if no matching browser language defined | |
# Based on language version being at e.g. www.mywebsite.ch/de/ | |
# This has no effect on any subpaths of the website, and therefore has no effect on e.g. WordPress admin. | |
# Using a 302 temporary redirect header stops the redirection from being cached in the browser. | |
# language is ES-MX (Mexico) | |
RewriteCond %{HTTP:Accept-Language} ^es-mx [NC] | |
RewriteRule ^$ /mx/ [L,R=302] |
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
if(navigator.appVersion.indexOf("Windows ")!=-1){ | |
os = getWindowsOS(); | |
}else{ | |
os = navigator.platform; | |
} | |
function getWindowsOS(){ | |
// http://msdn.microsoft.com/en-us/library/ms537503(v=vs.85).aspx#PltToken | |
if(navigator.appVersion.indexOf("Windows NT 10.")!=-1){ | |
return 'Windows 10'; |
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
# BE | |
<flux:field.inline.fal name="downloadFile" multiple="FALSE" allowedExtensions="pdf" /> | |
# FE | |
<v:variable.set name="downloadFile" value="{v:content.resources.fal(field: 'downloadFile') -> v:iterator.first()}"/> | |
<a class="downlow" href="{downloadFile.url}">Download</a> |
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 | |
/** | |
* Complex WordPress meta query by start and end date (custom meta fields) | |
* Intended for use on the `pre_get_posts` hook. | |
* Caution; this makes the query very slow - several seconds - so should be | |
* implemented with some form of caching. | |
* | |
* mark@sayhello.ch 22.10.2019, based on code from 201 onwards | |
*/ |
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
^([\w.-]+)@(\[(\d{1,3}\.){3}|(?!hotmail|gmail|googlemail|yahoo|gmx|ymail|outlook|bluewin|protonmail|t\-online|web\.|online\.|aol\.|live\.)(([a-zA-Z\d-]+\.)+))([a-zA-Z]{2,4}|\d{1,3})(\]?)$ |
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 | |
$args = [ | |
'post_type' => 'post', | |
'posts_per_page' => -1, | |
'post_status' => 'any', | |
'meta_query' => [ | |
[ | |
'key' => 'hide_thumbnail', | |
'compare' => 'EXISTS' |
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
// get the current site's REST API base url | |
const restApiBaseUrl = wpApiSettings.root; | |
// get the element with the class name '.posts-container' from the document | |
const postsContainer = document.querySelector('.posts-container'); | |
// use restApiBaseUrl to get all of the posts from the rest api in a recursive async function. wrap the function in an IIFE. | |
// append the posts to the posts container as objects. add a class name to each element using the classNameBase 'shp-my-posts' and the post id. | |
(async function getPosts() { | |
// stop processing if there is no posts container |
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
transforms: { | |
from: [ | |
{ | |
type: 'block', | |
blocks: ['core/list'], | |
transform: ({ values }) => { | |
let entries = values.split('</li><li>'); | |
const link_pattern = /<a href=['"]#endnote[0-9]+['"]>([0-9]+)<\/a>/gi; | |
entries.forEach((entry, index) => { | |
entries[index] = entry.replace('<li>', '').replace('</li>', ''); |
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
if (!Array.prototype.find) { | |
Array.prototype.find = function(predicate) { | |
if (this == null) { | |
throw new TypeError('Array.prototype.find called on null or undefined'); | |
} | |
if (typeof predicate !== 'function') { | |
throw new TypeError('predicate must be a function'); | |
} | |
var list = Object(this); | |
var length = list.length >>> 0; |
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
/** | |
* External Dependencies | |
*/ | |
import classnames from 'classnames'; | |
/** | |
* WordPress Dependencies | |
*/ | |
const { __ } = wp.i18n; | |
const { addFilter } = wp.hooks; |
NewerOlder