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 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 / 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 / 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 / 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 / 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
Last active March 12, 2017 14:25
Find out the current capabilities of the contributor user role (NB. the ddd() function requires Kint to be installed)
<?php
add_action( 'init', 'check_contributor_capabilities', 0 );
function check_contributor_capabilities() {
ddd( get_role( 'contributor' ) );
}
@nickdavis
nickdavis / selling-benefits.html
Created March 13, 2017 19:47
Sample content for the 'Selling Benefits' text widget used in Home Row #6 of the Kickstart Pro theme demo (https://demo.leanthemes.co/kickstart/)
<p>Chris Guillebeau in "The $100 Startup" writes that people really care about<br/>having more of: <strong>Love</strong>, <strong>Money</strong>, <strong>Acceptance</strong> and <strong>Free Time</strong>.</p>
<ul class="featured">
<li>Saves you time</li>
<li>Makes you feel part of the community</li>
<li>Saves you money</li>
</ul>
<nav itemscope="" itemtype="http://schema.org/SiteNavigationElement" aria-label="Main navigation">
<ul class="menu">
<li class="menu-item"><a href="#" itemprop="url"><span itemprop="name">Left Item #1</span></a></li>
<li class="menu-item"><a href="#" itemprop="url"><span itemprop="name">Left Item #2</span></a></li>
<li class="menu-item"><a href="#" itemprop="url"><span itemprop="name">Left Item #3</span></a></li>
<li class="menu-item"><a href="#" itemprop="url"><span itemprop="name">Left Item #4</span></a></li>
<li class="menu-item"><a href="#" itemprop="url"><span itemprop="name">Left Item #5</span></a></li>
<li class="menu-item right"><a href="#" itemprop="url"><span itemprop="name">Right Item #1</span></a></li>
<li class="menu-item right"><a href="#" itemprop="url"><span itemprop="name">Right Item #1</span></a></li>
</ul>
@nickdavis
nickdavis / .gitignore
Created April 17, 2017 05:42
Starter .gitignore for new WordPress projects (based on https://www.billerickson.net/code/sample-gitignore/)
# Ignore everything #
**
!vendor/
vendor/**
!wp-content/
wp-content/**
!wp-content/themes/
!wp-content/plugins/
wp-content/themes/**
wp-content/plugins/**
@nickdavis
nickdavis / .gitmodules
Last active April 17, 2017 05:49
Sample .gitmodules file (tested and working with WP Engine git push, as long as .gitmodules is included in .gitignore)
[submodule "vendor/library-name"]
path = vendor/library-name
url = https://github.com/nickdavis/library-name
[submodule "vendor/library-name-2"]
path = vendor/library-name-2
url = https://github.com/nickdavis/library-name-2