feature: Update version to 1.2.6, add registration link field, and enhance event templates

This commit is contained in:
Keith Solomon
2026-07-30 12:45:34 -05:00
parent 0fc424b035
commit d7f56b1fe9
7 changed files with 89 additions and 37 deletions
+1
View File
@@ -1,3 +1,4 @@
notes/
docs/
phpcs-results.txt
tests/
+2 -2
View File
@@ -3,7 +3,7 @@
* Plugin Name: AA Events
* Plugin URI: https://github.com/automattic/aa-events
* Description: An Events management plugin for WordPress, with accessible calendar (WCAG 2.2AA) and card grid views.
* Version: 1.2.5
* Version: 1.2.6
* Author: Keith Solomon
* Author URI: https://vincentdesign.ca
* License: GPL-2.0+
@@ -49,7 +49,7 @@ register_deactivation_hook( __FILE__, 'deactivate_aa_events' );
* Define Constants
*/
define( 'AA_EVENTS_PLUGIN_FILE', __FILE__ );
define( 'AA_EVENTS_VERSION', '1.2.1' );
define( 'AA_EVENTS_VERSION', '1.2.6' );
define( 'AA_EVENTS_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'AA_EVENTS_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
+15
View File
@@ -309,6 +309,21 @@ function events_register_acf_fields() {
'default_value' => '',
'placeholder' => '',
),
array(
'key' => 'field_aa_events_registration_link',
'label' => 'Registration Link',
'name' => 'registration_link',
'type' => 'link',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'return_format' => 'array',
),
),
'location' => array(
array(
+40
View File
@@ -26,6 +26,46 @@ function aa_events_contact_email_markup( $value ) {
return '<a href="' . esc_attr( 'mailto:' . $protected ) . '">' . wp_kses_post( $protected ) . '</a>';
}
/**
* Build safe registration-link markup for event templates.
*
* @param mixed $value Raw registration link value.
* @return string Escaped registration link, or an empty string for invalid input.
*/
function aa_events_registration_link_markup( $value ) {
if ( is_array( $value ) ) {
if ( ! isset( $value['url'] ) || ! is_string( $value['url'] ) ) {
return '';
}
$url = trim( $value['url'] );
$target = isset( $value['target'] ) && is_string( $value['target'] ) ? $value['target'] : '';
} elseif ( is_string( $value ) ) {
$url = trim( $value );
$target = '';
} else {
return '';
}
if ( '' === $url || false === filter_var( $url, FILTER_VALIDATE_URL ) ) {
return '';
}
$url_parts = wp_parse_url( $url );
if (
! is_array( $url_parts ) ||
empty( $url_parts['host'] ) ||
empty( $url_parts['scheme'] ) ||
! in_array( strtolower( $url_parts['scheme'] ), array( 'http', 'https' ), true )
) {
return '';
}
$target_attributes = '_blank' === $target ? ' target="_blank" rel="noopener noreferrer"' : '';
return '<a class="aa-event-registration-link button" href="' . esc_url( $url ) . '"' . $target_attributes . '>' . esc_html( __( 'Register', 'aa-events' ) ) . '</a>';
}
/**
* Load a template.
*
+24
View File
@@ -285,6 +285,30 @@
div { margin-bottom: 0.625rem; }
}
.aa-event-registration-link {
background: #005f73;
border: 2px solid #005f73;
border-radius: 0.25rem;
color: #fff;
display: inline-block;
font-weight: 700;
margin-top: 1.25rem;
padding: 0.625rem 1.25rem;
text-decoration: none;
}
.aa-event-registration-link:hover {
background: #003f4d;
border-color: #003f4d;
color: #fff;
text-decoration: underline;
}
.aa-event-registration-link:focus-visible {
outline: 3px solid #111;
outline-offset: 3px;
}
/* Events archive layout */
.aa-events-wrap .aa-events-grid {
display: grid;
-35
View File
@@ -112,41 +112,6 @@ $events = new WP_Query(
'no_found_rows' => true,
'update_post_meta_cache' => true,
'update_post_term_cache' => false,
'meta_query' => array(
'relation' => 'OR',
array(
'relation' => 'AND',
array(
'key' => '_aa_events_occurrence_index_version',
'value' => AA_EVENTS_VERSION,
'compare' => '=',
),
array(
'key' => '_aa_events_sort_start',
'value' => $month['month_end']->format( 'Y-m-d 23:59:59' ),
'compare' => '<=',
'type' => 'DATETIME',
),
array(
'key' => '_aa_events_sort_end',
'value' => $month['month_start']->format( 'Y-m-d 00:00:00' ),
'compare' => '>=',
'type' => 'DATETIME',
),
),
array(
'relation' => 'OR',
array(
'key' => '_aa_events_occurrence_index_version',
'compare' => 'NOT EXISTS',
),
array(
'key' => '_aa_events_occurrence_index_version',
'value' => AA_EVENTS_VERSION,
'compare' => '!=',
),
),
),
)
);
foreach ( $events->posts as $event_id ) {
+7
View File
@@ -93,6 +93,13 @@ get_header(); ?>
</div>
<?php } ?>
</div>
<?php $registration_link_markup = aa_events_registration_link_markup( get_field( 'registration_link' ) ); ?>
<?php if ( $registration_link_markup ) : ?>
<div class="aa-event-registration">
<?php echo wp_kses_post( $registration_link_markup ); ?>
</div>
<?php endif; ?>
</footer><!-- .entry-footer -->
</article><!-- #post-<?php the_ID(); ?> -->