Skip to content

Instantly share code, notes, and snippets.

View stebrech's full-sized avatar

Stefan Brechbühl stebrech

View GitHub Profile
@unruthless
unruthless / CSS for <sup> and <sub>
Created May 26, 2010 01:31
CSS for <sub> and <sup>
sub, sup {
/* Specified in % so that the sup/sup is the
right size relative to the surrounding text */
font-size: 75%;
/* Zero out the line-height so that it doesn't
interfere with the positioning that follows */
line-height: 0;
/* Where the magic happens: makes all browsers position
@senlin
senlin / add-breadcrumb-navigation.php
Created March 15, 2012 17:54
Add Breadcrumb Navigation
<?php // Add Breadcrumb Navigation
function write_breadcrumb() {
$pid = $post->ID;
$trail = '<a href="/">'. __('Home', 'textdomain') .'</a>';
if (is_front_page()) {
// do nothing
}
elseif (is_page()) {
$bcarray = array();
@krogsgard
krogsgard / custom-field-advanced-body-class.php
Created June 20, 2012 16:57
add a body class based on a post's custom field value
<?php
// check for '_my_custom_field' meta key on pages and page parents and add a body class if meta value equals 'some-value'
add_filter('body_class','krogs_custom_field_body_class');
function krogs_custom_field_body_class( $classes ) {
global $post;
@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/
@sergejmueller
sergejmueller / .htaccess
Created August 10, 2012 18:06
Auszug aus einer .htaccess mit Caching-Mechanismen
# CHARSET
AddDefaultCharset utf-8
# DEFLATE
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/html text/plain text/css
AddOutputFilterByType DEFLATE application/javascript application/json
AddOutputFilterByType DEFLATE text/xml application/xml
AddOutputFilterByType DEFLATE application/rss+xml application/atom+xml
<?php
/**
* Load the stylesheet from the parent theme with theme version added automatically.
*
*/
function theme_name_parent_styles() {
$parent = get_template();
$parent = wp_get_theme( $parent );
@sergejmueller
sergejmueller / ttf2woff2.md
Last active March 9, 2024 13:37
WOFF 2.0 – Learn more about the next generation Web Font Format and convert TTF to WOFF2
@grappler
grappler / functions.php
Last active January 21, 2017 08:06
// add ie conditional html5 shim to header
<?php
// add ie conditional html5 shim to header
function _s_add_ie_html5_shim () {
echo '<!--[if lt IE 9]>';
echo '<script src="' . get_template_directory_uri() . '/js/html5.js"></script>';
echo '<![endif]-->';
}
add_action('wp_head', '_s_add_ie_html5_shim');
@sergejmueller
sergejmueller / .htaccess
Last active June 16, 2016 08:34
Stop search engines from indexing .txt, .log, .xml, .css and .js files in Apache
<FilesMatch "\.(txt|log|xml|css|js)$">
Header set X-Robots-Tag "noindex"
</FilesMatch>
anonymous
anonymous / Menu-toggle-svg-animation.markdown
Created December 9, 2014 08:35
Menu toggle svg animation