Format Custom Field Block
-
I know others have asked if you can wrap a custom field in a href tag, which would indeed be great, I am actually curios if there is a PHP filter I can use with custom fields to re format a date field. This solution could also work with links I think.
Example: I have a deadline-date field that returns YYYY-MM-DD and I would like to display Month DD, YYYY (e.g. October 7, 2022)
If I can filter on field name, I could rewrite how ever I need, something like this…
if ( ('deadline-date' === $field_name ) && ($content != '')) { return '<strong>Deadline:</strong> ' . date( get_option('date_format'), strtotime( $content ) ); } if ( ('email' === $field_name ) && ($content != '')) { return '<a href="mailto:'.$content.'">'.$content.'</a>'; }
`
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Format Custom Field Block’ is closed to new replies.