Hi,
I need to add custom fields to ICAL content for further export to Google Calendar including these fields.
I created the following function and filter:
function wpa_content_filter( $content ) {
global $post;
$post_id = $post->ID;
$meta_by = get_post_meta( $post_id, 'by_lector', true);
$meta_place = get_post_meta( $post_id, 'location', true);
$meta_from = get_post_meta( $post_id, 'from', true);
if( $meta_by || $meta_place || $meta_from ) {
$meta_by_html = '<div class="by"><label>By:</label>' .$meta_by. '</div>';
$meta_place_html = '<div class="location"><label>Where:</label>' .$meta_place. '</div>';
$meta_from_html = '<div class="from"><label>From:</label>' .$meta_from. '</div>';
return $post_id. $meta_by_html .$meta_from_html . $meta_place_html . $content ;
}
return $content;
wp_reset_postdata();
}
add_filter( 'the_content', 'wpa_content_filter', 1);
This works fine in any loop of the site, except ICAL. ICAL file displays the content and fields of the last event (BY id) for all events.
Is there any solution for the case?
I’m a PRO user, if that’s matter.
Thank you.