Skip to content

Instantly share code, notes, and snippets.

View glueckpress's full-sized avatar

Caspar Hübinger glueckpress

View GitHub Profile
$colours:
"red" #FF0000,
"blue" #001EFF,
"green" #00FF00,
"yellow" #F6FF00;
@each $i in $colours{
.#{nth($i, 1)}-background {
background: nth($i, 2);
}
@glueckpress
glueckpress / footer.php
Last active November 16, 2020 17:48
[WordPress] Offer filterable text strings in WordPress themes and child themes. Makes it easy to adjust original text, fully translatable. Example footer.php borrowed from _s (underscores) starter theme by @Automattic. http://glck.be/5740/
@glueckpress
glueckpress / wp-config.php
Last active May 13, 2019 13:08
[WordPress] Enable debug mode via URL. Props @bueltge.
<?php
/**
* Better: use nonces, or less obvious query arguments.
* http://glueckpress.com/?show_me=💩
*/
if ( isset( $_GET['show_me'] ) && $_GET['show_me'] === '💩') {
define( 'WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
} else {
define( 'WP_DEBUG', false );
@glueckpress
glueckpress / real-favicons.php
Last active December 14, 2015 21:34
[WordPress] Mini plugin, adds favicons, touch icons and tiles for desktop browsers, iOS, Android and Windows. Generated HTML output via http://realfavicongenerator.net/. Requires a sub-directory /img to store all images in. HEADS UP: This is no longer needed as of WordPress 4.3!
<?php
/**
* Plugin Name: Real Favicons
* Description: Adds favicons, touch icons and tiles for desktop browsers, iOS, Android and Windows. Generate HTML output via <a href="http://realfavicongenerator.net/">realfavicongenerator.net</a>. Store all generated images in sub-directory /img.
* Version: 2014.01
* Author: Caspar Hübinger
* Author URI: http://glueckpress.com/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@glueckpress
glueckpress / glckprss-sticky-posts.php
Last active December 14, 2015 21:33
[WordPress] Removes sticky posts from WordPress default loop, sets up a custom sticky posts query. Sticky posts query can be implemented with one single template tag. Markup completely filterable. — http://glck.be/5916/
<?php
/**
* Separate sticky posts from the main loop into their own query.
*
* Display a query of sticky posts anywhere in your templates
* using a simple echo glckprss_sticky_posts().
* Query template output is stored in a transient for performance win,
* updated any time the 'sticky_posts' option get updated.
*
* Require in theme’s functions.php like:
@glueckpress
glueckpress / foo-custom-text-strings.php
Last active December 14, 2015 21:33
[WordPress] Mini example plugin. Modify default (not translated) language strings of a plugin. Beware: Might result in performance issues when applied to many strings.
<?php
/**
* Plugin Name: Custom Text Strings for Foo Plugin
* Description: Modify default (not translated) language strings of a plugin. Beware: Might result in performance issues when applied to many strings.
* Version: 2014.10
* Author: Caspar Hübinger
* Author URI: http://glueckpress.com/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*/
@glueckpress
glueckpress / hmn.md.is.tabs.align.js
Created January 5, 2015 09:57
Vertically align team member content to clicked ui tabs on Human Made’s team page (http://hmn.md/is/).
/**
* Vertically align team member content to clicked ui tabs.
*
* @link http://hmn.md/is/
*
*/
( function( $ ) {
$( '.ui-tabs-anchor', '.about-teamlist' ).on( 'click', function( e ) {
@glueckpress
glueckpress / trim-spam-comment-text.php
Last active December 29, 2019 19:23
[WordPress] Trims text of spam comments on Admin→Comments→Spam down to a maximum of 42 characters. Will save you a heck of annoyance when you need to skim through spam comments. Because many of them tend to have looong paragraphs of text you don’t really wanna deal with; they are spam, after all.
<?php
/**
* Plugin Name: Trim Spam Comment Text
* Description: Trims text of spam comments on <a href="/wp-admin/edit-comments.php?comment_status=spam">Admin→Comments→Spam</a> down to a maximum of 42 characters. Will save you a heck of annoyance when you need to skim through spam comments. Because many of them tend to have looong paragraphs of text you don’t really wanna deal with; they are spam, after all.
* Version: 0.0.2
* Author: Caspar Hübinger
* Author URI: https://glueckpress.com/
* Plugin URI: https://gist.github.com/glueckpress/7316116faa491e09d199/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@glueckpress
glueckpress / footnote.html
Last active March 23, 2023 19:48
HTML footnotes. Click on anchor #a(n): skips down to anchor #f(n) inside footnote. Click on anchor #f(n) inside footnote: skips back up to anchor #a(n).
<!-- Line-breaks suiting auto-p in WordPress: -->
Paragraph with a footnote<a id="a1" href="#f1"><sup>[1]</sup></a> and more text afterwards.
Another paragraph with another footnote<a id="a2" href="#f2"><sup>[2]</sup></a> and more text afterwards.
<!-- At the end of all paragraphs: -->
<footer class="footnotes">
<a id="f1" href="#a1">[1]</a> Footnote #1 here.
@glueckpress
glueckpress / mixed-ol.css
Last active August 29, 2015 14:18
Mixed, nested ordered HTML lists; support request from https://plus.google.com/+ClaudioBott/posts/SYcohmFXc7g
ol {
list-style-type: decimal;
}
ol ol {
list-style-type: lower-roman;
}