Skip to content

Instantly share code, notes, and snippets.

View nickdavis's full-sized avatar

Nick Davis nickdavis

View GitHub Profile
@nickdavis
nickdavis / functions.php
Created March 12, 2017 13:34
Allow subscribers to be set as authors in WordPress
<?php
add_filter( 'wp_dropdown_users_args', 'add_subscribers_to_dropdown', 10, 2 );
/**
* Allow subscribers to be set as authors
*
* @link http://wordpress.stackexchange.com/a/216117
*
* @since 1.0.0
*
@nickdavis
nickdavis / functions.php
Created February 28, 2017 10:29
Add 'no-js' class to <html> tag in WordPress in order to work with Modernizr
<?php
add_filter( 'language_attributes', 'add_no_js_class_to_html_tag', 10, 2 );
/**
* Add 'no-js' class to <html> tag in order to work with Modernizr.
*
* (Modernizr will change class to 'js' if JavaScript is supported).
*
* @since 1.0.0
*
@nickdavis
nickdavis / style.css
Created February 26, 2017 22:11
Kickstart Pro: remove transparent effect on site description text on tablet and mobile screen sizes (should be around line 3128, but may vary depending on the version of the theme you're using or if you've done any other modifications to it)
@media only screen and (max-width: 900px) {
.site-description {
color: #fff;
opacity: 0.5; /* Remove or comment out this line */
padding: 0 0 9px;
}
}
@nickdavis
nickdavis / orders-link.php
Created February 16, 2017 10:39
Check if user is already registered for event in The Events Calendar / Event Tickets, in this example the check is included in the orders-link.php template file which you can override by including it in a tribe-events/tickets folder in your theme
@nickdavis
nickdavis / functions.php
Created January 29, 2017 16:32
Add Advanced Custom Fields PRO licence key programatically (via: https://gist.github.com/mattradford/6d5b8f3cd11ce1f62480#gistcomment-1933361)
<?php
class AutoActivator {
const ACTIVATION_KEY = 'youractivationkeyhere';
/**
* AutoActivator constructor.
* This will update the license field option on acf
* Works only on backend to not attack performance on frontend
*/
@nickdavis
nickdavis / jquery.plugin.js
Created January 17, 2017 08:47
Starting jQuery file structure from KnowTheCode.io
;(function($, window, document, undefined){
'use strict';
var init = function() {
}
/**
* Strictly not necessary because you're already loading this script in the
* footer, but sometimes there will be other scripts that didn't fire yet
@nickdavis
nickdavis / x-disable-wpe-sec.php
Created January 15, 2017 20:46
Disable WP Engine 'forced' https (SSL) redirection / AJAX breaking on non https site (WP Engine Support said it is a known issue happening on a few random installs). To install place in your mu-plugins folder (and, of course, remove when you want SSL in future)
<?php
add_action( 'widgets_init', 'wpe_remove_encourage_tls', 0 );
function wpe_remove_encourage_tls() {
remove_action( 'init', 'wpesec_encourage_tls' );
}
@nickdavis
nickdavis / style.css
Last active January 12, 2017 16:18
How to right align the Kickstart Pro slider excerpt box
/* Find the following section in your theme's style.css file (should be around line 2353) and add the line below */
.home-top .widget,
html > body div.slide-excerpt-border {
background-color: #fff;
bottom: 50px;
font-size: 36px;
position: absolute;
right: 0; /* Add this line */
width: 40%;
@nickdavis
nickdavis / settings.txt
Created January 3, 2017 19:52
HTML Post-Processing to fix mixed content CDN warning on WP Engine with Let's Encrypt SSL (goes in WP Engine > General Settings) in WordPress admin
#https?://mydomain.com.com/wp-(content|includes)# => https://mydomain.com/wp-$1
#https?://mydomain.com.com/blog/# => https://mydomain.com/wp-$1
#http://installname-wpengine\.netdna-ssl\.com# => https://installname-wpengine.netdna-ssl.com
@nickdavis
nickdavis / style.css
Created December 30, 2016 21:50
Add a comma after the testimonial name displayed by the Testimonials by WooThemes widget
.testimonials span[itemprop="name"]::after {
content: ",";
}