Skip to content

Instantly share code, notes, and snippets.

View Zodiac1978's full-sized avatar
🤔
Overthinking things since 1978

Torsten Landsiedel Zodiac1978

🤔
Overthinking things since 1978
View GitHub Profile
@Zodiac1978
Zodiac1978 / .htaccess
Last active March 15, 2024 08:29
Make your Website faster - a safe htaccess way
#
# Sources:
# http://stackoverflow.com/questions/7704624/how-can-i-use-gzip-compression-for-css-and-js-files-on-my-websites
# http://codex.wordpress.org/Output_Compression
# http://www.perun.net/2009/06/06/wordpress-websites-beschleuinigen-4-ein-zwischenergebnis/#comment-61086
# http://www.smashingmagazine.com/smashing-book-1/performance-optimization-for-websites-part-2-of-2/
# http://gtmetrix.com/configure-entity-tags-etags.html
# http://de.slideshare.net/walterebert/die-htaccessrichtignutzenwchh2014
# http://de.slideshare.net/walterebert/mehr-performance-fr-wordpress
# https://andreashecht-blog.de/4183/
@Zodiac1978
Zodiac1978 / functions.php
Created July 20, 2012 14:30
My standard functions.php with many useful features
<?php
/* http://codex.wordpress.org/Customizing_the_Read_More */
function remove_more_jump_link($link) {
$offset = strpos($link, '#more-');
if ($offset) {
$end = strpos($link, '"',$offset);
}
if ($end) {
$link = substr_replace($link, '', $offset, $end-$offset);
@Zodiac1978
Zodiac1978 / threaded_comment_feed_enhancer.php
Last active December 29, 2015 16:39
Threaded Comment Feed Enhancer - Adds an info text in comment body from comment feed if it is a threaded comment
<?php
/**
* Plugin Name: Threaded Comment Feed Enhancer
* Plugin URI: http://torstenlandsiedel.de
* Text Domain: threaded-comment-feed-enhancer
* Domain Path: /languages
* Description: Enhances the threaded comments feed
* Version: 1.2.0
* Author: Torstenlandsiedel
* Author URI: http://torstenlandsiedel.de
@Zodiac1978
Zodiac1978 / .htaccess
Last active January 27, 2024 14:06
Safer WordPress with these .htaccess additions
# Don't show errors which contain full path diclosure (FPD)
# Use that line only if PHP is installed as a module and not per CGI
# try using a php.ini in that case.
# Change mod_php5.c to mod_php7.c if you are running PHP7
<IfModule mod_php5.c>
php_flag display_errors Off
</IfModule>
# Don't list directories
<IfModule mod_autoindex.c>
@Zodiac1978
Zodiac1978 / functions.php
Last active August 29, 2015 14:07
Load Parent Theme CSS in Child Theme without using @import
<?php
function twentytwelve_child_scripts() {
wp_deregister_style( 'twentytwelve-style' );
wp_register_style( 'twentytwelve-style', get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'twentytwelve-child-style', get_stylesheet_uri(), array( 'twentytwelve-style' ) );
}
add_action( 'wp_enqueue_scripts', 'twentytwelve_child_scripts', 11 );
<?php
function tl_umlaut_repair( $content ) {
/*
* Why?
* For everyone getting this warning from W3C: "Text run is not in Unicode Normalization Form C."
* http://www.w3.org/International/docs/charmod-norm/#choice-of-normalization-form
*/
/*
@Zodiac1978
Zodiac1978 / functions.php
Created December 3, 2014 22:53
Remove "website" field from comment form
<?php
add_filter('comment_form_default_fields', 'url_filtered');
function url_filtered($fields)
{
if(isset($fields['url']))
unset($fields['url']);
return $fields;
}
<?php
function md_filter_curly_double_quotes( $translations, $text, $context, $domain ) {
if ( 'opening curly double quote' == $context && '&#8220;' == $text ) {
$translations = '&#8222;';
} else if ( 'closing curly double quote' == $context && '&#8221;' == $text ) {
$translations = '&#8220;';
}
return $translations;
@Zodiac1978
Zodiac1978 / show-php-version.php
Last active October 14, 2023 02:49
Show PHP version and if PHP is running in 32-bit or 64-bit mode in At-a-glance dashboard widget
<?php
/*
Plugin Name: Show PHP Version
Description: Shows the current PHP version in the "At a Glance" admin dashboard widget.
Version: 1.1
Requires at least: 3.8
Author: Torsten Landsiedel
Author URI: http://torstenlandsiedel.de
*/
@Zodiac1978
Zodiac1978 / wp-config.php
Last active July 22, 2016 09:07
Interesting things for your wp-config.php
// Disabling the plugin and theme editor for more security
define('DISALLOW_FILE_EDIT', true);
// Check for a local config file
if ( file_exists( dirname( __FILE__ ) . '/wp-local-config.php' ) ) {
/* Get the settings for the development site */
include( dirname( __FILE__ ) . '/wp-local-config.php' );
} else {
// Settings for live site