Plugin Author
Steven
(@shazahm1hotmailcom)
There is no click it and set it feature to accomplish this, but it might be possible to accomplish. I’ll see if this can be accomplished with an easy-to-implement filter and get back to your asap.
Thank you so much! I would really appreciate it!
Plugin Author
Steven
(@shazahm1hotmailcom)
Apologies for the delay in my reply!!!
I’ve worked out a solution.
First install and activate the Code Snippets plugin. Here’s the link:
Copy-paste the following code into a new code snippet. Save it and then activate it. Here’s the code:
add_filter(
'cn_output_date',
static function( $html, $date, $entry, $atts ) {
$search = array( '%label%', '%date%', '%separator%' );
$replace = array();
if ( false === $date->date ) {
return $html;
}
$classNames = array(
'vevent',
'cn-date',
);
if ( $date->preferred ) {
$classNames[] = 'cn-preferred';
$classNames[] = 'cn-date-preferred';
}
if ( 'DOH' === $date->name ) {
$atts['date_format'] = 'F jS Y';
}
$html = '<span class="' . \Connections_Directory\Utility\_escape::classNames( $classNames ) . '">';
// Hidden elements are to maintain hCalendar spec compatibility.
$replace[] = empty( $date->name ) ? '' : '<span class="date-name">' . esc_html( $date->name ) . '</span>';
$replace[] = empty( $date->date ) ? '' : '<abbr class="dtstart" title="' . esc_attr( $date->date->format( 'Ymd' ) ) . '">' . date_i18n( $atts['date_format'], $date->date->getTimestamp(), false ) . '</abbr>
<span class="summary" style="display:none">' . esc_html( $date->name ) . ' - ' . $entry->getName( array( 'format' => $atts['name_format'] ) ) . '</span>
<span class="uid" style="display:none">' . esc_html( $date->date->format( 'YmdHis' ) ) . '</span>';
$replace[] = '<span class="cn-separator">' . esc_html( $atts['separator'] ) . '</span>';
$html .= str_ireplace(
$search,
$replace,
empty( $atts['format'] ) ? ( empty( $defaults['format'] ) ? '%label%%separator% %date%' : $defaults['format'] ) : $atts['format']
);
$html .= '</span>';
return $html;
},
10,
4
);
I hope this helps; please let me know. Thanks!
That worked like a charm! Thank you so much for working on that. I’m so excited to be able to show their anniversary year in their profiles and I really appreciate your help on this!
Plugin Author
Steven
(@shazahm1hotmailcom)
No problem; happy to help!
I would genuinely appreciate a review if you have a moment, as they really make a difference.
https://ww.wp.xz.cn/plugins/connections/
Thanks in advance for your time!