Skip to content

Instantly share code, notes, and snippets.

@Chillifish
Chillifish / scriptCheck.php
Last active June 12, 2018 15:15
Script check method
public function scriptCheck() {
global $wpdb;
$wnumber = $this->getWNumber();
$booking_status = $wpdb->get_results("SELECT completed FROM " . $wpdb->prefix . "ch_bookings WHERE booking = " . $wnumber, ARRAY_A);
if (is_array($booking_status)) {
if ($booking_status[0]["completed"] == 1) {
@Chillifish
Chillifish / acme_mod_date.php
Last active July 31, 2018 12:30
Show post date modification
// Get last posted or modified date
function acme_mod_date( $postId ) {
$posted = get_the_time( 'U', $postId );
$modified = get_the_modified_time( 'U', $postId );
if ( $modified >= ( $posted + 7890000 ) ) { // 3 months
return '<time class="updated" datetime="' . get_the_modified_time( 'Y-m-d', $postId ) . '"> Updated on ' . get_the_modified_time( get_option( 'date_format' ), $postId ) . '</time>';
}
else {