custom function
-
hello
I need to build a function where I can extract all the events as “event_start_date + post_title” but it won’t work…. why?function events_as_options( $posts, $select_text = ” ) {
if ( !is_array( $posts ) ) return;
$posts = array_map( function( $item ) {
return $item->event_start_date . ‘|’ . $item->post_title
}, $posts );
return ( $select_text ? $select_text . ‘|’ . PHP_EOL : ” ) . implode( PHP_EOL, $posts );
}
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘custom function’ is closed to new replies.