This file contains 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
//Return the attachment ID of an image | |
function get_attachment_id_from_src ($image_src) { | |
global $wpdb; | |
$query = "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'"; | |
$id = $wpdb->get_var($query); | |
return $id; | |
} |
This file contains 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 | |
/** | |
* Infinite next and previous post looping in WordPress | |
*/ | |
$next_post = get_next_post(); | |
$previous_post = get_previous_post(); | |
$current_id = get_the_ID(); | |
// Get ID's of posts |
This file contains 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 | |
//this loop returns all movies separated by genres they belong to | |
$post_type = 'brand'; | |
$tax = 'division'; | |
$tax_terms = get_terms($tax); | |
if ($tax_terms) { | |
foreach ($tax_terms as $tax_term) { | |
$args=array( |
This file contains 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
/** | |
* Example use: | |
* $('div:icontains("Text in page")'); | |
* Will return jQuery object containing any/all of the following: | |
* <div>text in page</div> | |
* <div>TEXT in PAGE</div> | |
* <div>Text in page</div> | |
*/ | |
$.expr[':'].icontains = $.expr.createPseudo(function(text) { | |
return function(e) { |
This file contains 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 | |
/** | |
* ----------------------------------------------------------------------------------------- | |
* Based on `https://github.com/mecha-cms/mecha-cms/blob/master/system/kernel/converter.php` | |
* ----------------------------------------------------------------------------------------- | |
*/ | |
// HTML Minifier | |
function minify_html($input) { |
This file contains 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
/* | |
* Load More for Masonry modification | |
* | |
* Full post: | |
* http://www.billerickson.net/infinite-scroll-in-wordpress/ | |
* | |
*/ | |
jQuery(function($){ |
This file contains 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 generate_options_css($newdata) { | |
/** Define some vars **/ | |
$data = $newdata; | |
$uploads = wp_upload_dir(); | |
$css_dir = get_template_directory() . '/css/'; // Shorten code, save 1 call | |
/** Save on different directory if on multisite **/ | |
if(is_multisite()) { | |
$aq_uploads_dir = trailingslashit($uploads['basedir']); |