Skip to content

Instantly share code, notes, and snippets.

@ginocremer
ginocremer / Aktivieren Sie die Beitragsbilder in der functions.php
Last active August 29, 2015 14:09
Praxis-Workshop: Theme-Entwicklung
add_theme_support( 'post-thumbnails' );
@ginocremer
ginocremer / gist:d911c7174bc0ade16f5e
Created November 22, 2014 21:32
SQL Anweisung Update Datenbank: Umzug WordPress
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');
@ginocremer
ginocremer / Eigene Farben pro Seite über eine eigene Body-Klasse
Created December 28, 2014 10:26
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.
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 / Exotische Dateitypen in Mediathek hochladen
Created December 29, 2014 21:37
Mit einem kleinen Snippet können Sie WordPress anweisen auch exotischere Dateitypen anstandslos anzunehmen.
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 / .htaccess Cachify
Created July 25, 2016 13:26
Original von Sergej Müller / Leider nicht mehr als Gist verfügbar, daher an dieser Stelle als neuer Gist.
# 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 / gist:64b285fb79aeba49230dcf8ad0777a81
Created May 2, 2017 19:23
Cachify Snippet / .htaccess if WordPress is in a subdirectory/subfolder (e.g. "wordpress")
<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} =""