Skip to content

Instantly share code, notes, and snippets.

@Chillifish
Chillifish / acme_mod_date.php
Last active Jul 31, 2018
Show post date modification
View acme_mod_date.php
// 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 {
@Chillifish
Chillifish / scriptCheck.php
Last active Jun 12, 2018
Script check method
View scriptCheck.php
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) {