Last active
August 21, 2018 11:06
-
-
Save andrasguseo/a791306e1591c7638e088a4a36c71b8d to your computer and use it in GitHub Desktop.
For Monique - template override for showing values of additional fields in separate lines vs. comma separated list
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Single Event Meta (Additional Fields) Template Override | |
* for showing values of additional fields in separate lines | |
* vs. comma separated list | |
* | |
* Copy this template in your own theme by creating a file at: | |
* [your-theme]/tribe-events/pro/modules/meta/additional-fields.php | |
* | |
* @package TribeEventsCalendarPro | |
* @version 3.1 | |
* @author Andras Guseo | |
*/ | |
if ( ! isset( $fields ) || empty( $fields ) || ! is_array( $fields ) ) { | |
return; | |
} | |
?> | |
<div class="tribe-events-meta-group tribe-events-meta-group-other"> | |
<h3 class="tribe-events-single-section-title"> <?php esc_html_e( 'Other', 'tribe-events-calendar-pro' ) ?> </h3> | |
<dl> | |
<?php foreach ( $fields as $name => $value ): ?> | |
<dt> <?php echo esc_html( $name ); ?> </dt> | |
<dd class="tribe-meta-value"> | |
<?php | |
// ADD IN THE BELOW ARRAY THE TITLES OF THE ADDITIONAL FIELDS YOU WANT TO INFLUENCE. | |
// Remove the ones you don't need. | |
// The function is case sensitive and will check for exact match! | |
$title_of_fields = array( | |
"Sticky?", | |
"Compentencias a desarrollar", | |
); | |
// Check if field name is in the above array. If yes, then replace comma with line break | |
if ( in_array( $name, $title_of_fields ) ) { | |
$value = str_replace( ',', '<br/>', $value ); | |
} | |
// This can hold HTML. The values are cleansed upstream | |
echo $value; | |
?> | |
</dd> | |
<?php endforeach ?> | |
</dl> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment