Skip to content

Instantly share code, notes, and snippets.

@ginocremer
ginocremer / gist:64b285fb79aeba49230dcf8ad0777a81
Created May 2, 2017
Cachify Snippet / .htaccess if WordPress is in a subdirectory/subfolder (e.g. "wordpress")
View gist:64b285fb79aeba49230dcf8ad0777a81
<IfModule mod_rewrite.c>
# ENGINE ON
RewriteEngine On
# GZIP FILE
<IfModule mod_mime.c>
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
RewriteCond %{QUERY_STRING} =""
@ginocremer
ginocremer / .htaccess Cachify
Created Jul 25, 2016
Original von Sergej Müller / Leider nicht mehr als Gist verfügbar, daher an dieser Stelle als neuer Gist.
View .htaccess Cachify
# BEGINN CACHIFY
<IfModule mod_rewrite.c>
# ENGINE ON
RewriteEngine On
# GZIP FILE
<IfModule mod_mime.c>
RewriteCond %{REQUEST_URI} /$
RewriteCond %{REQUEST_URI} !^/wp-admin/.*
RewriteCond %{REQUEST_METHOD} !=POST
@ginocremer
ginocremer / Exotische Dateitypen in Mediathek hochladen
Created Dec 29, 2014
Mit einem kleinen Snippet können Sie WordPress anweisen auch exotischere Dateitypen anstandslos anzunehmen.
View Exotische Dateitypen in Mediathek hochladen
add_filter('upload_mimes', 'add_custom_upload_mimes');
function add_custom_upload_mimes( $existing_mimes ){
$existing_mimes['zip'] = 'application/zip';
$existing_mimes['eps'] = 'application/eps';
$existing_mimes['rtf'] = 'text/richtext';
$existing_mimes['tiff'] = 'image/tiff';
return $existing_mimes;
}
@ginocremer
ginocremer / Eigene Farben pro Seite über eine eigene Body-Klasse
Created Dec 28, 2014
In vielen Fällen kann eine Klasse auf dem Body-Element nützlich sein. Zum Beispiel wenn Sie jeder einzelnen Seite eine eigene Farbgebung via CSS spendieren möchten.
View Eigene Farben pro Seite über eine eigene Body-Klasse
function add_top_parent_body_class( $classes ) {
if(is_page()):
$top_id = '';
$ancestors = get_ancestors(get_the_ID(),'page');
if ( !empty($ancestors)):
$top_id = end($ancestors);
$classes[] = 'top-parent-'.sanitize_title(get_the_title($top_id));
else:
$classes[] = 'top-parent-'.sanitize_title(get_the_title(get_the_ID()));
endif;
@ginocremer
ginocremer / gist:d911c7174bc0ade16f5e
Created Nov 22, 2014
SQL Anweisung Update Datenbank: Umzug WordPress
View gist:d911c7174bc0ade16f5e
UPDATE wp_posts SET post_content = REPLACE ( post_content, 'http://127.0.0.1:8080/wordpress', 'http://www.mein-blog.info');
UPDATE wp_options SET option_value = REPLACE ( option_value, 'http://127.0.0.1:8080/wordpress', 'http://www.mein-blog.info');
View Add Image Size WordPress
add_image_size( 'neues-mass', 1600, 1200 );
@ginocremer
ginocremer / Resize Images after Upload WordPress Media Library
Created Mar 21, 2014
Resize Images after Upload WordPress Media Library
View Resize Images after Upload WordPress Media Library
add_filter('wp_generate_attachment_metadata','replace_uploaded_image');
function replace_uploaded_image($image_data)
{
// if there is no large image : return
if ( !isset($image_data['sizes']['large']) )
return $image_data;
// paths to the uploaded image and the large image
$upload_dir = wp_upload_dir();
View TinyMCE Spellchecker Erwiterung
function Pixelbar_AddSpellChecker($initArray){
$initArray['spellchecker_languages'] = '+Francais=fr, +Deutsch=de, English=en';
return $initArray;
}
add_filter('tiny_mce_before_init', 'Pixelbar_AddSpellChecker');
@ginocremer
ginocremer / Exotische Dateitypen in WordPress hochladen
Created Mar 6, 2014
Upload erlauben von .swf, .tiff, .rtf oder .zip
View Exotische Dateitypen in WordPress hochladen
add_filter('upload_mimes', 'eigene_upload_mimes');
function eigene_upload_mimes( $vorhandene_mimes ){
$vorhandene_mimes['zip'] = 'application/zip';
$vorhandene_mimes['swf'] = 'application/x-shockwave-flash';
$vorhandene_mimes['rtf'] = 'text/richtext';
$vorhandene_mimes['tiff'] = 'image/tiff';
return $vorhandene_mimes;
}
You can’t perform that action at this time.