Skip to content

Instantly share code, notes, and snippets.

View nickcernis's full-sized avatar

Nick Cernis nickcernis

  • Innsbruck, Austria
  • 21:30 (UTC +02:00)
View GitHub Profile
@nickcernis
nickcernis / style.css
Last active January 20, 2016 02:36
Simple Social Icons font conflict fix
@font-face {
font-family: 'ssi-fontello';
src: url('../font/fontello.eot?78492063');
src: url('../font/fontello.eot?78492063#iefix') format('embedded-opentype'),
url('../font/fontello.woff?78492063') format('woff'),
url('../font/fontello.ttf?78492063') format('truetype'),
url('../font/fontello.svg?78492063#fontello') format('svg');
font-weight: normal;
font-style: normal;
}
@nickcernis
nickcernis / functions.php
Last active January 24, 2016 21:23
Fix for the wpMandrill WordPress plugin for blogs that send both plain text and HTML email
<?php
// Add to functions.php and leave the “Content” box unticked in Settings > Mandrill
// Be sure to omit the opening <?php tag when copying this code
// Add paragraph breaks to plain text notifications sent by Mandrill
add_filter('mandrill_payload', 'wpmandrill_auto_add_breaks');
function wpmandrill_auto_add_breaks($message) {
$html = $message['html'];
@nickcernis
nickcernis / functions.php
Created December 4, 2014 10:10
Fix for breadcrumbs appearing on iThemes ghost pages with Genesis themes
<?php // be sure to remove this line!
// Workaround for iThemes Exchange breadcrumbs issue.
// Strip breadcrumbs on iThemes Exchange ghost pages unless
// Genesis settings have enabled breadcrumbs on pages.
add_action( 'genesis_before_content', 'studiopress_it_exchange_breadcrumbs' );
function studiopress_it_exchange_breadcrumbs() {
global $post;
@nickcernis
nickcernis / functions.php
Created September 20, 2016 10:14
Reorder Simple Social Icons
<?php
add_filter( 'simple_social_default_profiles', 'custom_reorder_simple_icons' );
function custom_reorder_simple_icons( $icons ) {
// Set your new order here
$new_icon_order = array(
'bloglovin' => '',
'dribbble' => '',
'email' => '',
include config/theme-info.make
include src/make/theme-info-original.make
include src/make/show-help-from-comments.make
.PHONY: help sass build watch bump gitinit rename undo-rename dist clean b r ur gi ts
help: show-help-from-comments
## Watch and build Sass files only. Compiles all Sass to style.css, unminified.
sass:
@nickcernis
nickcernis / parsing-urls.js
Created July 27, 2016 15:34
Parsing URLs in JavaScript
// From https://news.ycombinator.com/item?id=12172180
var parser = document.createElement('a');
parser.href = "http://example.com:3000/pathname/?search=test#hash";
parser.protocol; // => "http:"
parser.hostname; // => "example.com"
parser.port; // => "3000"
parser.pathname; // => "/pathname/"
parser.search; // => "?search=test"
parser.hash; // => "#hash"
parser.host; // => "example.com:3000"
@nickcernis
nickcernis / functions.php
Created October 20, 2017 12:31
Strip the ellipsis from the Genesis read more text in the Featured Page widget
<?php
add_filter( 'get_the_content_more_link', 'custom_remove_ellipsis' );
/**
* Strips the ellipsis from the Genesis more link.
*
* @param string $more_link_html The current more link HTML.
* @return string The link HTML without the ellipsis.
*/
function custom_remove_ellipsis( $more_link_html ) {
$link_without_ellipsis = str_replace( '&#x02026;', '', $more_link_html );
@nickcernis
nickcernis / functions.php
Last active May 26, 2018 19:18
Add a login/logout link to the menu bar of any Genesis child theme
<?php // add everything except for this opening line to your functions file
add_filter( 'wp_nav_menu_items', 'sp_add_loginout_link', 10, 2 );
function sp_add_loginout_link( $items, $args ) {
// Change 'primary' to 'secondary' to put the login link in your secondary nav bar.
if ( $args->theme_location != 'primary' ) {
return $items;
}
@nickcernis
nickcernis / functions.php
Created July 31, 2018 17:02
Fix Google Schema error for custom logos on WordPress sites.
<?php
/**
* Fix Google Schema error, "The property logo is not recognised by Google for an object of type WPHeader".
*
* @param string $html The logo HTML.
*
* @return string The modified HTML.
*/
add_filter( 'get_custom_logo', function( $html ) {
$html = str_replace( 'itemprop="logo"', 'itemprop="image"', $html );
@nickcernis
nickcernis / command.md
Created August 26, 2018 07:47
Delete all node_modules directories
❯ find /Path/to/parent/folder -name "node_modules" -type d -prune -exec rm -rf '{}' +