This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function ( $ ) { //inline jQuery plugin to match height of elements | |
| $.fn.match_height = function(userOptions, callback) { | |
| var defaults = { | |
| mode:'maximum' | |
| }; | |
| var options = $.extend({}, defaults, userOptions); | |
| if(options.mode == 'maximum') { | |
| var height=0; | |
| } else { | |
| var height = this.first().height(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| wp_enqueue_style('slug', get_template_directory_uri().'/css/slug.css', array(), filemtime(get_template_directory().'/css/slug.css')); | |
| wp_enqueue_script('slug', get_template_directory_uri().'/js/slug.js', array(), filemtime(get_template_directory().'/js/slug.js')); | |
| //Note the second argument is URL based while the last argument is a file path. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php //https://bitbucket.org/webspec/webspec-post-type-descriptions | |
| //As of WP 4.1 | |
| echo get_the_archive_description(); | |
| //Pre WP 4.1 | |
| $obj = get_queried_object(); | |
| echo stripslashes(html_entity_decode($obj->description)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $('svg.foo').click(function() { | |
| this.classList.toggle('selected'); | |
| }); | |
| //classList supports add(), remove(), toggle() and contains() | |
| //No IE9 support - shim here - https://developer.mozilla.org/en-US/docs/Web/API/Element.classList |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('the_post', 'remove_share_buttons'); | |
| function remove_share_buttons() { | |
| if(get_post_type() == 'staff_members') { | |
| remove_action('the_content', array('ShareaholicPublic', 'draw_canvases')); | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| '.source.php': | |
| 'The Loop': | |
| 'prefix': 'theloop' | |
| 'body': "if($1->have_posts()): while($1->have_posts()): $1->the_post();" | |
| 'New WP_Query': | |
| 'prefix': 'wpquery' | |
| 'body': """ | |
| $1 = new WP_Query(['post_type'=>$2, 'posts_per_page'=>-1, 'orderby'=>'menu_order', 'order'=>'ASC']); | |
| if($1->have_posts()): while($1->have_posts()): $1->the_post(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (function ( $ ) { | |
| $.fn.oneChecked = function() { | |
| var checked = false; | |
| this.each(function() { | |
| if($(this).is(':checked')) { | |
| checked = true; | |
| } | |
| }); | |
| return checked; | |
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| add_action('pre_get_posts', 'meta_query_key_compare'); | |
| function meta_query_key_compare($query) { | |
| $meta_query = $query->get('meta_query'); | |
| if(empty($meta_query)) { | |
| return; | |
| } | |
| $marker = '__tmp_marker__'; | |
| $rx = []; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| window.jQuery.fn.extend({ | |
| animateCss: function (animationName, delay, offset) { | |
| var offset = typeof offset !== 'undefined' ? offset : '70%'; | |
| var delay = typeof delay !== 'undefined' ? delay : 0; | |
| var $this = $(this); | |
| $this.css('visibility', 'hidden'); | |
| new Waypoint({ | |
| element:this[0], | |
| handler:function(direction) { | |
| setTimeout(function() { |