1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
function epl_button_mini_web() {
$keys = apply_filters( 'epl_mini_web_keys', array( 'property_com_mini_web', 'property_com_mini_web_2', 'property_com_mini_web_3' ) );
foreach ( $keys as $key ) {
$link = get_post_meta( get_the_ID(), $key, true );
$count = 'property_com_mini_web' === $key ? '' : substr( $key, -1 );
$meta_label = __( 'Mini Web ', 'easy-property-listings' ) . $count;
$count = empty( $count ) ? '1' : $count;
if ( ! empty( $link ) && apply_filters( 'epl_show_' . $key, true ) ) { ?>
<button type="button" class="epl-button epl-mini-web-link <?php echo 'epl-mini-web-link-' . esc_attr( $count ); ?>" onclick="window.open('<?php echo esc_url( $link ); ?>')">
<?php
if ( has_filter( 'epl_button_label_' . $key ) ) {
$label = apply_filters( 'epl_button_label_' . $key, $meta_label );
} else {
$label = apply_filters( 'epl_button_label_mini_web', $meta_label );
}
?>
<?php echo esc_html( $label ); ?>
</button>
<?php
}
}
}
add_action( 'epl_buttons_single_property', 'epl_button_mini_web' );