Skip to content

Instantly share code, notes, and snippets.

View macgraphic's full-sized avatar
💣

Mark Smallman macgraphic

💣
View GitHub Profile
@macgraphic
macgraphic / ACF-Event-Date
Created August 17, 2019 10:04
template output for ACF date
<p class="event-date-time">
<?php esc_url( svg_icon( 'calendar' ) ); ?>
<?php
$date = get_field( 'event_date' );
if ( $date ) : ?>
<?php echo esc_html( $date ); ?>,
<?php endif; ?>
<?php
$starttime = get_field( 'event_start_time' );
// Theme colour palette
function xyz_setup_theme_supported_features() {
add_theme_support( 'editor-color-palette', array(
array(
'name' => __( 'Navy', 'xyz' ),
'slug' => 'navy',
'color' => '#032f3c',
),
array(
'name' => __( 'Orange', 'xyz' ),
(function($) {
var infoWindows = new Array();
/*
* render_map
*
* This function will render a Google Map onto the selected jQuery element
* This version includes the auto-close infowindow - requires the var from line 2 above.
*
* @type function
// Add class to BODY if cart has items
function onze_cart_has_items( $classes ) {
if ( WC()->cart->get_cart_contents_count() >= 1 ) {
$classes[] = 'itemsInCart';
}
return $classes;
}
add_filter( 'body_class','onze_cart_has_items' );
// By using class, we replace specified text with the formatted date.
add_filter( 'render_block', function( $edited_date, $block ) {
$field_name = 'latestupdate'; // ACF field name
$postId = false;
$format = 'F jS, Y'; // date format
$class = 'displayDateUpdated'; // Additional CSS Class on block to find
$string = 'LastUpdated'; // string of text to replace with date
$date = get_field( $field_name , $postId, $format );
if (
!is_admin()