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
// fix custom permalinks | |
// useful for when importing posts using WP All Import as it doesn't set the custom permalink meta key | |
add_action( 'admin_footer', 'td_fix_custom_permalinks' ); | |
function td_fix_custom_permalinks() { | |
$post_type = 'resource'; | |
$args = array( | |
'post_type' => $post_type, | |
'posts_per_page' => -1, | |
); | |
$query = new WP_Query( $args ); |
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 | |
if(!function_exists('wc_get_products')) { | |
return; | |
} | |
$paged = (get_query_var('paged')) ? absint(get_query_var('paged')) : 1; | |
$ordering = WC()->query->get_catalog_ordering_args(); | |
$ordering['orderby'] = array_shift(explode(' ', $ordering['orderby'])); | |
$ordering['orderby'] = stristr($ordering['orderby'], 'price') ? 'meta_value_num' : $ordering['orderby']; |
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
var Spiderman = (function() { | |
var _firstName = "Peter"; | |
var _middleName = "Benjamin"; | |
var _lastName = "Parker"; | |
var _secret = "Spidey Senses"; | |
function _getName() { | |
return _firstName + ' ' + _middleName + ' ' + _lastName; | |
} |
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
// file is in wp-content/themes/your-theme/assets/images/svg-logo.php | |
<?php get_template_part( 'assets/images/svg', 'logo' ); ?> |
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 | |
add_filter( 'gform_field_css_class', 'chronos_add_custom_field_class', 10, 3 ); | |
function chronos_add_custom_field_class( $classes, $field, $form ) | |
{ | |
$classes .= ' chronos-' . $field->type . '-field'; | |
return $classes; | |
} |
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
find -E . -iregex '.*-([0-9])+x+([0-9])+.(jpg|png|gif)' -delete |
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 | |
function tower_do_single_product_variation_preview_images() | |
{ | |
global $post; | |
$variations = get_field( 'product_variation' ); | |
?> | |
<div id="productVariationDotsContainer"> |
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
$('form[role="search"]').on('submit', function(ev) { | |
var query = $(this).find('input[type="search"]').val(); | |
if ( query.length <= 1 ) { | |
ev.preventDefault(); | |
} | |
}); |