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 wpse49871_shortcode_query_filter( $where ) | |
{ | |
global $wpdb; | |
// Lets be on the safe side, escape and such. | |
$new_where = $wpdb->prepare( | |
"%s AND %s LIKE %s" | |
,$where | |
,"{$wpdb->posts}.post_content" | |
// If you know the exact ID, then just insert it in here. |
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
/*** | |
* Gravity Forms: Validate to ensure date fields are not the same or todays date | |
* | |
* This will validate the fields on form submission and return a validation error on the fields in question. | |
* In this case it validates an Arrival and Departure date against each other and today's date. | |
* | |
* Code goes in your theme's functions.php file. | |
***/ | |
add_filter('gform_field_validation','validate_dates',10,4); |
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 | |
/* | |
* Converts CSV to JSON | |
* Example uses Google Spreadsheet CSV feed | |
* csvToArray function I think I found on php.net | |
*/ | |
header('Content-type: application/json'); | |
// Set your CSV feed |
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
/* START Make the cart table responsive */ | |
/* http://css-tricks.com/responsive-data-tables/ */ | |
@media screen and (max-width: 600px) { | |
/* Force table to not be like tables anymore */ | |
.woocommerce-page table.shop_table, | |
.woocommerce-page table.shop_table thead, | |
.woocommerce-page table.shop_table tbody, | |
.woocommerce-page table.shop_table th, |
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 will make the search return results ordered by date rather than relevance. | |
add_filter( 'searchwp_return_orderby_date', '__return_true' ); |
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
$_POST['post_status'] == 'publish' && $_POST['original_post_status'] != 'publish' |
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 catch_youtube_url() { | |
global $post, $posts; | |
ob_start(); | |
ob_end_clean(); | |
$youtube_url = '/https?:\/\/(?:www\.)?youtu(?:\.be|be\.com)\/watch(?:\?(.*?)&|\?)v=([a-zA-Z0-9_\-]+)(\S*)/i'; | |
$url = preg_match($youtube_url, $post->post_content, $matches); |
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 | |
/** | |
* On an early action hook, check if the hook is scheduled - if not, schedule it. | |
*/ | |
function prefix_setup_schedule() { | |
if ( ! wp_next_scheduled( 'prefix_hourly_event' ) ) { | |
wp_schedule_event( time(), 'hourly', 'prefix_hourly_event'); | |
} | |
} |
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 | |
/** | |
* Theme Default Search Box | |
*/ | |
?> | |
<form role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> | |
<div id="searchsubmit" class="dashicons dashicons-search" /></div> | |
<input type="search" value="" name="s" id="s" placeholder="Search"/> | |
<input type="submit" id="submitsearch" value=""/> | |
<script> |
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
p:first-child:first-letter { float: left; color: #903; font-size: 75px; line-height: 60px; padding-top: 4px; padding-right: 8px; padding-left: 3px; font-family: Georgia; } |