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 | |
| $attachment_ids = (array) $attachment_ids; | |
| $wp_upload_dir = wp_upload_dir(); | |
| $attachments = array(); | |
| // THIS WILL NOT WORK > WPv3.8.1 | |
| foreach( $attachment_ids as $attachment_id ){ | |
| $attachment = wp_get_attachment_metadata( $attachment_id ); | |
| if( !empty( $attachment['file'] ) ){ | |
| $attachments[] = trailingslashit( $wp_upload_dir['basedir'] ) . $attachment['file']; |
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
| // This is now managed officially here: https://github.com/codearachnid/knockout.extend | |
| // custom binding attrIf which will check the value of a specific observable boolean before add or not the attributes | |
| ko.bindingHandlers.attrIf = { | |
| update: function (element, valueAccessor, allBindingsAccessor) { | |
| var h = ko.utils.unwrapObservable(valueAccessor()); | |
| var ifShow = ko.utils.unwrapObservable(h._if); | |
| if (ifShow) { | |
| ko.bindingHandlers.attr.update(element, valueAccessor, allBindingsAccessor); | |
| } else { | |
| for (var k in h) { |
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 | |
| // if product is already in global space | |
| global $product; | |
| // or fetch product attributes by ID | |
| if( empty( $product->id ) ){ | |
| $wc_pf = new WC_Product_Factory(); | |
| $product = $wc_pf->get_product($id); | |
| } |
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 | |
| /** | |
| * Reset the slugs on a particular post type to use the default sanitized slugs | |
| * @param string $post_type filter by post type | |
| * @param int $offset set the paginated post to start | |
| * @param boolean $force_guid_update * WARNING * never enable this | |
| * | |
| * @example add the following code into your theme's functions.php file, ensure |
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
| /* | |
| * jQuery Highlight Word | |
| * | |
| * hat tip to Johann Burkard's highlighting plugin | |
| * @link <http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html> | |
| * @link <https://github.com/tankchintan/highlight-js> | |
| */ | |
| !function($) { | |
| $.fn.highlightWord = function(pat, className) { | |
| function innerHighlightWord(node, pat, className) { |
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
| /** | |
| * Date.prototype.addDays | |
| * | |
| */ | |
| Date.prototype.addDays = function( days ) { | |
| var element = new Date( this.valueOf() ); | |
| element.setDate( element.getDate() + days ); | |
| return element; | |
| } | |
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 | |
| /** | |
| * update ~line 26 to include 2 argument params as such: | |
| */ | |
| add_filter( 'posts_orderby', array( __CLASS__, 'events_search_orderby' ), 10, 2 ); | |
| /** | |
| * update static function `events_search_orderby` (replace with the following method starting at ~line 159) | |
| */ |
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 | |
| /* | |
| * Fix Advanced Custom Field dynamic key filter for repeater entries | |
| * @link http://www.advancedcustomfields.com/resources/how-to/how-to-query-posts-filtered-by-custom-field-values/ | |
| */ | |
| add_filter( 'posts_where', 'acf_repeater_dynamic_where', 10, 2 ); | |
| function acf_repeater_dynamic_where( $where, &$wp_query ){ | |
| if( !empty( $wp_query->meta_query->queries ) ){ | |
| $keys = wp_list_pluck( $wp_query->meta_query->queries, "key" ); |
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 | |
| /* | |
| Plugin Name: First Login Popup | |
| Plugin URI: | |
| Description: Anytime a user logs in popup a message | |
| Version: 1.0 | |
| Author: Timothy Wood @codearachnid | |
| Author URI: http://www.codearachnid.com | |
| License: GPLv2 | |
| */ |
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 | |
| /** | |
| * customize your event categogy labels. Make sure that 'tribe_event_category' has the | |
| * label set to null so the default title of "Event Category" is shown | |
| */ | |
| add_action('tribe_events_before_view','custom_label'); | |
| function custom_label(){ | |
| tribe_set_meta_label( 'tribe_event_category', 'New Category Label' ); | |
| } |