Skip to content

Instantly share code, notes, and snippets.

Avatar

Caspar Hübinger glueckpress

View GitHub Profile
@glueckpress
glueckpress / hmn.md.is.tabs.align.js
Created Jan 5, 2015
Vertically align team member content to clicked ui tabs on Human Made’s team page (http://hmn.md/is/).
View hmn.md.is.tabs.align.js
/**
* 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 / footnote.html
Last active Aug 29, 2015
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).
View footnote.html
<!-- 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 Aug 29, 2015
Mixed, nested ordered HTML lists; support request from https://plus.google.com/+ClaudioBott/posts/SYcohmFXc7g
View mixed-ol.css
ol {
list-style-type: decimal;
}
ol ol {
list-style-type: lower-roman;
}
@glueckpress
glueckpress / single_post_widget.php
Last active Nov 20, 2015
Makes a custom WordPress widget to display any published post.
View single_post_widget.php
<?php
// Make sure we have a theme domain for localization
if( ! defined( 'THEME_DOMAIN' ) )
define( 'THEME_DOMAIN', get_stylesheet() ); // Any translation has to go in your stylesheet directory
/**
* Makes a custom widget to display any published post.
*
* @package WordPress
@glueckpress
glueckpress / woocommerce-check-formal-locale.php
Last active Dec 14, 2015
[WordPress] Check whether the active locale is formal and whether a formal WooCommerce translation has been downloaded.
View woocommerce-check-formal-locale.php
<?php
/**
* Check whether formal language files exist for WooCommerce.
*
* - Admin locales are found in:
* - WP_LANG_DIR/woocommerce/woocommerce-admin-LOCALE.mo
* - WP_LANG_DIR/plugins/woocommerce-admin-LOCALE.mo
*
* - Front-end/global locales found in:
* - WP_LANG_DIR/woocommerce/woocommerce-LOCALE.mo
@glueckpress
glueckpress / dewp-project-contact.php
Last active Dec 14, 2015
[WordPress] Kontaktzeile für dewp-Projekte mit Link zum Slack-Channel des Projekts, sowie Link zur Registrierungsanleitung.
View dewp-project-contact.php
<?php
if ( ! function_exists( 'dewp_project_contact' ) ) :
/**
* Kontaktzeile für dewp-Projekte.
*
* @param array $channel Channel-Name und URL
* @return string Kontaktzeile
*/
function dewp_project_contact( $args = array() ) {
@glueckpress
glueckpress / no-comment.php
Last active Dec 14, 2015
[WordPress] This plugin started as a Gist, but can now be found at https://github.com/glueckpress/no-comment.
View no-comment.php
<?php
/**
* Plugin Name: No Comment
* Description: A plugin to close, disable and remove comments from the WordPress admin UI.
* Version: 0.1
* Author: Caspar Hübinger
* Author URI: https://profiles.wordpress.org/glueckpress/
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
@glueckpress
glueckpress / moderate-long-comments.php
Last active Dec 14, 2015
[WordPress] Sends a comment to moderation queue if it contains more than 499 words. Props @Ipstenu! https://twitter.com/Ipstenu/status/627130377828564993 **UPDATE:** This has become a plugin with a setting. https://github.com/glueckpress/comment-moderation-by-word-count
View moderate-long-comments.php
<?php
/**
* Plugin Name: Moderate Long Comments
* Description: Sends a comment to moderation queue if it contains more than 499 words.
* Version: 0.1
* Author: Caspar Hübinger
* Plugin URI: https://gist.github.com/glueckpress/34ae7508d9566131a249
* Author URI: https://profiles.wordpress.org/glueckpress
* License: GNU General Public License v2 or later
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
@glueckpress
glueckpress / wcl10n-example.php
Last active Dec 14, 2015
[WordPress] Exclude text domains from language files by wrapping them into custom functions instead of default l10n functions. (http://glck.be/6651/)
View wcl10n-example.php
<?php
/* String from your theme/plugin */
_e( 'Margaritas!', 'your-textdomain' );
__( 'Margaritas!', 'your-textdomain' );
/* Original string from WooCommerce: */
_e( 'Product', 'woocommerce' );
__( 'Product', 'woocommerce' );