Skip to content

Instantly share code, notes, and snippets.

View solid-pixel's full-sized avatar

Alessandro Benassi solid-pixel

View GitHub Profile
@solid-pixel
solid-pixel / functions.php
Created May 12, 2016 13:49
Dequeue Merriweather font - Twenty sixteen
function wp_dequeue_google_fonts() {
wp_dequeue_style( 'twentysixteen-fonts' );
}
add_action( 'wp_enqueue_scripts', 'wp_dequeue_google_fonts', 20 );
@solid-pixel
solid-pixel / functions.php
Created May 12, 2016 13:50
Twenty Sixteen - Unregister Sidebar
//// Unregister Sidebar
function remove_some_widgets(){
unregister_sidebar( 'sidebar-1' );
}
add_action( 'widgets_init', 'remove_some_widgets', 11 );
@solid-pixel
solid-pixel / header.php
Created May 12, 2016 13:51
Twenty Sixteen - Add Logo
<!-- Website LOGO -->
<div class="site-branding">
<img src="<?php echo get_stylesheet_directory_uri(); ?>/images/logo.png" width="250px" height="90px" alt="The Lexington">
</div>
<!-- /Website LOGO -->
@solid-pixel
solid-pixel / index.html
Last active June 8, 2016 10:01
Top bar notice
<style>
@media all and (max-width:768px) {
#top-wrapper * {
float: none !important;
text-align: center !important;
padding: 6px ;
}
}
#top-notice {
background: #AE9363;
@solid-pixel
solid-pixel / functions.php
Created June 13, 2016 15:17
Fix Wordpress "HTTP Error" on media upload
add_filter( 'wp_image_editors', 'change_graphic_lib' ); function change_graphic_lib($array) { return array( 'WP_Image_Editor_GD', 'WP_Image_Editor_Imagick' ); }
@solid-pixel
solid-pixel / scripts.js
Created June 28, 2016 09:48
Reduce input text size based on number of characters
jQuery('#target').keypress(function() {
var textLength = jQuery(this).val().length;
if(textLength < 10) {
// Do noting
} else if (textLength < 13) {
jQuery(this).css('font-size', '85%');
} else if (textLength > 16) {
jQuery(this).css('font-size', '70%');
@solid-pixel
solid-pixel / scripts.js
Created June 30, 2016 10:48
Smooth Scroll
$(function() {
$('a[href*="#"]:not([href="#"])').click(function() {
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html, body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
@solid-pixel
solid-pixel / smooth-scroll.php
Created June 30, 2016 12:28
Smooth Scroll Wordpress Plugin
<?php
/**
* Plugin Name: Smooth Scroll
* Plugin URI: http://
* Description: Smooth scroll for anchor links
* Version: 1.0.0
* Author:
* Author URI: http://
* License: GPL2
*/
@solid-pixel
solid-pixel / index.html
Created October 30, 2016 14:44
Isometric Grid Idea
<body>
<div class="row grid-container">
<div class="columns large-3 medium-6 small-12 grid-item">
<img src="http://placehold.it/300">
</div>
<div class="columns large-3 medium-6 small-12 grid-item">
<img src="http://placehold.it/300">
</div>
<div class="columns large-3 medium-6 small-12 grid-item">
<img src="http://placehold.it/300">
@solid-pixel
solid-pixel / page.php
Created January 6, 2017 14:32
Grab Custom Posts from specific Taxonomy
<ul>
<?php
$query = new WP_Query( array(
'post_type' => 'course', //post type slug
'tax_query' => array(
array(
'taxonomy' => 'course_type', //taxonomy slug
'field' => 'slug',
'terms' => 'post-graduate') //term slug
)) );