説明
カレンダーのイベント HTML をフィルターします。
使い方
add_filter( 'xo_event_calendar_event_title', 'my_xo_event_calendar_event_title', 10, 3 );
パラメータ
- $event_html
- (文字列) イベント HTML
- $event_post
- (配列) イベント情報の配列
-
- ‘post’ (イベント投稿)
- ‘title’ (タイトル)
- ‘short_title’ (ショートタイトル)
- ‘start_date’ (イベント開始日時)
- ‘end_date’ (イベント終了日時)
- ‘bg_color’ (背景色)
- ‘permalink’ (イベント投稿の URL)
- $options
- (配列) オプション設定の配列
-
- ‘disable_event_link’ (イベントのリンクを無効にするかどうかを示す値)
用例
function my_xo_event_calendar_event_title( $event_html, $event, $options ) {
$short_title = ( $event['short_title'] ) ? $event['short_title'] : $event['title'];
$event_html = "<span class=\"month-event-title\" style=\"color: #eee; background-color: {$event['bg_color']};\">{$short_title}</span>";
if ( ! isset( $options['disable_event_link'] ) || ! $options['disable_event_link'] ) {
$event_html = "<a href=\"{$event['permalink']}\" title=\"{$event['title']}\">{$event_html}</a>";
}
return $event_html;
}
add_filter( 'xo_event_calendar_event_title', 'my_xo_event_calendar_event_title', 10, 3 );