Skip to content

Instantly share code, notes, and snippets.

View discoform's full-sized avatar

Matt discoform

View GitHub Profile
<-- from https://thinkshout.com/blog/2014/12/creating-dynamic-menus-in-jekyll/ -->
{% assign url_parts = page.url | split: '/' %} {% assign url_parts_size = url_parts | size %} {% assign rm = url_parts |
last %} {% assign base_url = page.url | replace: rm %}
<ul>
{% for node in site.pages %} {% if node.url contains base_url %} {% assign node_url_parts = node.url | split: '/' %} {% assign
node_url_parts_size = node_url_parts | size %} {% assign filename = node_url_parts | last %} {% if url_parts_size ==
node_url_parts_size and filename != 'index.html' %}
////////////////////////////
// 404 redirect home
function redirect_404() {
if (is_404()) {
// $mail_body = 'This page generated a 404 error: ' . $_SERVER['REQUEST_URI'];
// $mail_body .= "\nReferrer : " . $_SERVER['HTTP_REFERER'];
// wp_mail( '[email protected]', '404 page detected', $mail_body);
wp_redirect( home_url() );
////////////////////////////
// REMOVE WP EMOJI
remove_action('wp_head', 'print_emoji_detection_script', 7);
remove_action('wp_print_styles', 'print_emoji_styles');
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
<div id="share-buttons">
<h5>Share this:</h5>
<!-- I got these buttons from simplesharebuttons.com -->
<!-- Buffer -->
<a href="https://bufferapp.com/add?url=<?php the_permalink(); ?>&amp;text=<?php the_title_attribute(); ?>" target="_blank" title="Buffer <?php the_title_attribute(); ?>">
<img src="https://simplesharebuttons.com/images/somacro/buffer.png" alt="Buffer" />
@discoform
discoform / functions.php
Created March 4, 2017 17:33 — forked from jameskoster/functions.php
WooCommerce - dequeue css (2.1+)
// Remove each style one by one
add_filter( 'woocommerce_enqueue_styles', 'jk_dequeue_styles' );
function jk_dequeue_styles( $enqueue_styles ) {
unset( $enqueue_styles['woocommerce-general'] ); // Remove the gloss
unset( $enqueue_styles['woocommerce-layout'] ); // Remove the layout
unset( $enqueue_styles['woocommerce-smallscreen'] ); // Remove the smallscreen optimisation
return $enqueue_styles;
}
// Or just remove them all in one line