Thread Starter
kaostc
(@kaostc)
Thanks a lot, I am testing it…
Thread Starter
kaostc
(@kaostc)
Thanks a lot for pointing to this plugin.
It creates an event in fediverse. What about if I am interested in creating an status from events? I can disable the plugin and let ActivityPub handle Events CPT as regular posts, so it will result in statuses on fediverse, but I still wanting to show start time, date an venue.
Any shortcodes to show custom fields at large? It would supose a good solution for me.
Thanks.
There is no “generic” shortcode to do that, but the plugin supports any kind of shortcode. If your event plugin supports shortcodes, you can reuse these.
Thread Starter
kaostc
(@kaostc)
I just created the shortcode :). I share it in case anyone need it. It works with the events calendar and extract data for Date, Time and Venue.
add_shortcode( 'evento_tec', 'evento_tec' );
function evento_tec( $atts ) {
// Attributes
extract( shortcode_atts(
array(
'field' => '',
), $atts
));
switch ( $field ) {
case '_EventStartDate':
if ( $field ) {
$display_time = false;
return "π " . tribe_format_date( get_post_meta( get_the_ID(), $field, true ), $display_time, "j \d\\e F \d\\e Y" ) . "<br/>π" . tribe_format_date( get_post_meta( get_the_ID(), $field, true ), $display_time, "G:i" );
}
case '_EventVenueID':
if ( $field) {
return "π " . tribe_get_venue($field);
}
}
return $value;
}
Thanks for your help!
-
This reply was modified 9 months, 1 week ago by
kaostc.
-
This reply was modified 9 months, 1 week ago by
kaostc.
Thanks a lot for sharing your solution! π
Thread Starter
kaostc
(@kaostc)
The above version had some errors, now I share a fixed one:
<?php
add_shortcode( 'evento_tec', 'evento_tec' );
function evento_tec( $atts ) {
// Attributes
extract( shortcode_atts(
array(
'field' => '',
), $atts
));
switch ( $field ) {
case '_EventStartDate':
if ( get_post_type( get_the_ID() ) == 'tribe_events' ) {
$display_time = false;
return "📆 " . tribe_format_date( get_post_meta( get_the_ID(), $field, true ), $display_time, "j \d\\e F \d\\e Y" ) . "<br/>🕑 " . tribe_format_date( get_post_meta( get_the_ID(), $field, true ), $display_time, "G:i" );
}
break;
case '_EventVenueID':
if ( get_post_type( get_the_ID() ) == 'tribe_events' ) {
return "📍 " . tribe_get_venue();
}
break;
}
}