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 | |
/** | |
* 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 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
/** | |
* Run this in the browser's developer console. | |
* Provided with no guarantees! Worked perfectly when published. | |
* | |
* mark-at-sayhello.ch / 30.1.2025 | |
*/ | |
(()=> { | |
let galleryCounters = {}; // Stores counters for each gallery legend |
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
# 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 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 | |
register_block_bindings_source('my-custom-prefix/current-year', [ | |
'label' => __('Current year', 'my-custom-prefix'), | |
'get_value_callback' => 'my_custom_prefix_current_year', | |
]); | |
function my_custom_prefix_current_year() | |
{ |
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
^([\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 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
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 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 | |
namespace PT\MustUse\Blocks\CoreEmbed; | |
class Block | |
{ | |
public function run() | |
{ | |
add_filter('render_block_core/embed', [$this, 'render'], 10, 2); | |
} |
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
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 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
# 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 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 | |
$args = [ | |
'post_type' => 'post', | |
'posts_per_page' => -1, | |
'post_status' => 'any', | |
'meta_query' => [ | |
[ | |
'key' => 'hide_thumbnail', | |
'compare' => 'EXISTS' |
NewerOlder