Skip to content

Instantly share code, notes, and snippets.

View anythinggraphic's full-sized avatar
☺️
Be the reason someone smiles today.

Kevin Donnigan anythinggraphic

☺️
Be the reason someone smiles today.
View GitHub Profile
@anythinggraphic
anythinggraphic / script.js
Last active November 17, 2016 22:11
When you click on an HTML5 video poster, play the video.
<script>var v = document.getElementById("movie");
v.onclick = function() {
v.paused ? v.play() : v.pause()
};</script>
@anythinggraphic
anythinggraphic / script.js
Last active November 17, 2016 22:12
When HTML5 video ends, show the poster.
<script>var video= jQuery("#hero-movie")[0];
var videoJ= jQuery("#hero-movie");
videoJ.on("ended",function(){
video.load();
});</script>
@anythinggraphic
anythinggraphic / css-jquery-responsive-mobile-navigation-menu.css
Last active November 22, 2016 23:58
Simple, Easy CSS & jQuery Responsive Mobile Navigation Menu
.responsive-nav-icon::before,
.responsive-nav-close::before {
color: #93a748;
content: "\f0c9";
font-family: FontAwesome;
font-size: 22px;
position: relative;
}
.responsive-nav-close::before {
@anythinggraphic
anythinggraphic / functions.php
Last active January 29, 2017 03:41
Change the WordPress admin login logo and image URL
<?php
/* @link https://anythinggraphic.net/change-wordpress-admin-login-logo-image-url/
/* Change login logo and link
----------------------------------------------------------------------------------------*/
add_filter('login_headerurl','ag_login_link');
function ag_login_link() {
return home_url();
}
@anythinggraphic
anythinggraphic / functions.php
Last active January 29, 2017 03:43
Change the link on the entry-title for each post to a custom one on Archives page
<?php
/* @link https://anythinggraphic.net/change-entry-title-post-links-archives-genesis/
/* Change the link on the entry-title for each post to a custom one on Archives page
----------------------------------------------------------------------------------------*/
add_filter( 'genesis_post_title_output', 'ag_custom_post_title_link' );
function ag_custom_post_title_link( $title ) {
if( is_archive() ) {
$post_title = get_the_title( get_the_ID() );
$title = '<h2 class="entry-title" itemprop="headline"><a href="' . get_field('link') . '" target="new">' . $post_title . '</a></h2>';
@anythinggraphic
anythinggraphic / functions.php
Last active January 29, 2017 03:44
Remove WordPress emojis without a plugin.
<?php
/* @link https://anythinggraphic.net/disable-emojis-in-wordpress-without-a-plugin
/* Remove emoji scripts and dns prefetch
----------------------------------------------------------------------------------------*/
add_action( 'init', 'ag_disable_wp_emojicons' );
function ag_disable_wp_emojicons() {
// all actions related to emojis
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
@anythinggraphic
anythinggraphic / functions.php
Last active January 29, 2017 03:45
Allow shortcodes in the Genesis Author Box for Users > Profile.
<?php
/* @link https://anythinggraphic.net/allow-shortcodes-in-author-box-for-genesis/
/* Allow shortcodes in the Author Box for users
----------------------------------------------------------------------------------------*/
add_filter( 'genesis_author_box', 'do_shortcode', 20 );
@anythinggraphic
anythinggraphic / genesis-conditional-layout.php
Last active January 29, 2017 03:53
Conditionally force full-width layout
<?php
/* Force full width conditionally
----------------------------------------------------------------------------------------*/
add_action( 'genesis_meta', 'bw_force_layout' );
function bw_force_layout() {
if ( is_front_page() ) {
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}
}
@anythinggraphic
anythinggraphic / functions.php
Created April 15, 2017 22:00
Paste As Text by default in the WordPress editor.
<?php
/* @link https://anythinggraphic.net/paste-as-text-by-default-in-wordpress
/* Use Paste As Text by default in the editor
----------------------------------------------------------------------------------------*/
add_filter('tiny_mce_before_init', 'ag_tinymce_paste_as_text');
function ag_tinymce_paste_as_text( $init ) {
$init['paste_as_text'] = true;
return $init;
}
@anythinggraphic
anythinggraphic / .htaccess
Last active May 10, 2017 23:23
GZip compression in .htaccess file.
# https://anythinggraphic.net/disable-emojis-in-wordpress-without-a-plugin
# BEGIN GZIP COMPRESSION
<IfModule mod_deflate.c>
# Compress HTML, CSS, JavaScript, Text, XML and fonts
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
AddOutputFilterByType DEFLATE application/x-font
AddOutputFilterByType DEFLATE application/x-font-opentype
AddOutputFilterByType DEFLATE application/x-font-otf