Skip to content

Instantly share code, notes, and snippets.

Avatar

Lukas Jakob Hafner sftsk

View GitHub Profile
@sftsk
sftsk / launch.json
Last active Dec 18, 2019
XDebug with Local & Bedrock
View launch.json
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Listen for XDebug",
"type": "php",
"request": "launch",
@sftsk
sftsk / site.conf
Created Aug 31, 2017
local by flywheel config for bedrock multisite
View site.conf
server {
server_name _;
return 302 $scheme://domain.dev$request_uri;
}
server {
server_name ~^(.*)\.domain\.dev$ domain.dev;
root /app/public/;
index index.php index.html index.htm;
@sftsk
sftsk / polylang_trans_extractor.js
Created Aug 18, 2017
Extractor for Polylang translations
View polylang_trans_extractor.js
var attrText = "attr_de,attr_it\n";
jQuery('.wp-list-table.widefat.fixed.striped.stringstranslations tbody tr').each(function () {
attrText += jQuery('td[data-colname="Zeichenfolge"]', jQuery(this)).clone().children().remove().end().text() + ',' + jQuery(':text', jQuery(this)).val() + "\n";
});
console.log(attrText);
@sftsk
sftsk / nginx-multisite-fix.conf
Last active Jun 21, 2022
fix nginx multisite redirect loop using roots/bedrock
View nginx-multisite-fix.conf
if (!-e $request_filename) {
rewrite /wp-admin$ $scheme://$host$uri/ permanent;
rewrite ^(/[^/]+)?(/wp-.*) /wp$2 last;
rewrite ^(/[^/]+)?(/.*\.php) /wp$2 last;
}
@sftsk
sftsk / gist:5a0f1f6df7c5202e7fb487a09be8787a
Created Nov 8, 2016
Browser language based forward .htaccess
View gist:5a0f1f6df7c5202e7fb487a09be8787a
# redirect first visitors basing on their language or redirect if language not specified
# in URL. If italian, redirect to italian
# if lang is Italian use it
RewriteCond %{THE_REQUEST} !\s/(de|it|app|wp)/ [NC]
RewriteCond %{HTTP:Accept-Language} ^it [NC]
RewriteRule ^ /it%{REQUEST_URI} [L,NC,R=301]
# otherwise use German
RewriteCond %{THE_REQUEST} !\s/(de|it|app|wp)/ [NC]
RewriteRule ^ /de%{REQUEST_URI} [L,NC,R=301]
View gist:bdcea9f35b883f322d0eadcaf317a1be
[26-Sep-2016 13:10:42 Europe/London] PLL_Language Object
(
[term_id] => 54649
[name] => Deutsch
[slug] => de
[term_group] => 0
[term_taxonomy_id] => 54649
[taxonomy] => language
[description] => de_DE
[parent] => 0