Skip to content

Instantly share code, notes, and snippets.

View Thomas-A-Reinert's full-sized avatar

Thomas A. Reinert Thomas-A-Reinert

View GitHub Profile
@Thomas-A-Reinert
Thomas-A-Reinert / wp-config.php
Last active July 25, 2019 22:18
One WordPress wp-config.php to rule them all: Development-, Staging- and Live-Server.
<?php
/*
* One WordPress wp-config.php to rule them all: Development-, Staging- and Live-Server.
*/
// Define Environments
$environments = array(
'dev' => 'server.dev',
'staging' => 'staging.server.com',
'live' => 'www.server.com',
@Thomas-A-Reinert
Thomas-A-Reinert / wp-config.php
Last active July 25, 2019 21:44
Purpose of this Code-Snippet for WordPress 'wp-config.php' is to have a Single Configuration that does not need to be changed each Time you push a new Release to Dev / Staging / Live-Servers
<?php
if (file_exists(dirname(__FILE__) . '/wp-config-local.php')) {
// If File exists include Config for Dev-Server Environment
include(dirname(__FILE__) . '/wp-config-local.php');
} elseif (file_exists(dirname(__FILE__) . '/wp-config-staging.php')) {
// If File exists include Config for Staging-Server Environment
include(dirname(__FILE__) . '/wp-config-staging.php');
@Thomas-A-Reinert
Thomas-A-Reinert / .htaccess
Last active July 19, 2019 13:16
WordPress 301 redirection from subdirectory installation to other subdirectory
# The following code will not only affect the subdirectory itself but all content within!
# Add it to the top of your .htaccess file BEFORE WordPress´ own rules, starting with "# BEGIN WordPress"
# Move from "old"-directory to "new" directory
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^old/(.*)$ /new/$1 [R=301,L]
</IfModule>
# In case you want to move from a subdir to the root-directory just remove the "new" from the second parameter like this:
@Thomas-A-Reinert
Thomas-A-Reinert / wp-config.php
Created December 19, 2016 23:18
Optimized wp-config.php
<?php
/**
* Custom WordPress configurations on "wp-config.php" file.
*
* This file has the following configurations: MySQL settings, Table Prefix, Secret Keys, WordPress Language, ABSPATH and more.
* For more information visit {@link https://codex.wordpress.org/Editing_wp-config.php Editing wp-config.php} Codex page.
* Created using {@link http://generatewp.com/wp-config/ wp-config.php File Generator} on GenerateWP.com.
*
* @package WordPress
* @generator GenerateWP.com
@Thomas-A-Reinert
Thomas-A-Reinert / wp-config.php
Created December 19, 2016 22:17
The Standard wp-config.php
<?php
/**
* The base configuration for WordPress
*
* The wp-config.php creation script uses this file during the
* installation. You don't have to use the web site, you can
* copy this file to "wp-config.php" and fill in the values.
*
* This file contains the following configurations:
*
@Thomas-A-Reinert
Thomas-A-Reinert / invertRGBa.php
Created February 12, 2016 14:04
Function to invertRGBa values via PHP
<?php
/*
* Invert incoming RGB/RGBa CSS-String OR just values to RGBa values
* Expects a string in one of the following formats:
* 255, 255, 255, 0 // Just parameters with/without Alpha value
* rgba(255,255,0) // Full CSS value with/without Alpha value
*
* Thomas A. Reinert // www.tarthemems.com 2015
*/
<?xml version="1.0" encoding="utf-8" ?>
<!-- An dieser Stelle KÖNNTE eine DTD stehen, wie z.B.:
<!DOCTYPE addressbook SYSTEM "addressbook.dtd"> -->
<root>
<kontakt>
<anrede>Herr</anrede>
<titel>Professor</titel>
<titel>Doktor</titel>
<vorname>Otto</vorname>
@Thomas-A-Reinert
Thomas-A-Reinert / Alternative XML notation.xml
Created October 26, 2015 02:02
Alternative XML notation
<?xml version="1.1" encoding="utf-8" ?>
<root>
<image>
<source>bild.tif</source>
<subtitle>I am a Subtitle</subtitle>
</image>
<image source="bild.tif" subtitle="I am a Subtitle" />
</root>
@Thomas-A-Reinert
Thomas-A-Reinert / Some XML-Elements named.xml
Last active October 26, 2015 02:35
Some XML-Elements named
<?xml version="1.0" encoding="utf-8" ?>
<!-- xml-declaration -->
<root>
<!-- tag, rootelement -->
<container> I´m some content of the container Tag </container>
<!-- ^ opening tag ^--> <!-- ^ closing tag ^ -->
<!-- the <container> tag is also a child-element for the <root>-tag.. -->
<emptytag imanattributeyaknow="someimage.tif" />
<!-- ^ tag ^ --> <!-- ^ attribute ^ --><!-- ^ value ^ --><!-- ^ selfclosing tag ^ -->
</root>
@Thomas-A-Reinert
Thomas-A-Reinert / Closing XML-Tags.xml
Last active October 26, 2015 00:47
Closing XML-Tags
<?xml version="1.0" encoding="utf-8" ?>
<root>
<container>I´m some content of the container Tag</container>
<emptytag src="image.tif" subtitle="Closing an empty tag within the tag with a trailing slash" />
<emptytag src="image.tif" subtitle="Closing an empty tag like a container"></emptytag>
</root>