Skip to content

Instantly share code, notes, and snippets.

@turtlepod
Created August 23, 2017 03:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save turtlepod/e89010bb689ec9be10c3e38757bdd7d3 to your computer and use it in GitHub Desktop.
Save turtlepod/e89010bb689ec9be10c3e38757bdd7d3 to your computer and use it in GitHub Desktop.
Change Listify Map Marker Popup to Company Logo
<?php
// Change the data of a listing to add logo.
add_filter( 'listify_get_listing_to_array', function( $data, $listing ) {
$data['myLogoURL'] = esc_url( $listing->get_company_logo() );
return $data;
}, 10, 2 );
<?php
/**
* Map marker pin popup.
*
* @since unknown
* @version 2.2.0
*
* @package Listify
* @category Template
* @author Astoundify
*/
if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
}
?>
<script id="tmpl-infoBubbleTemplate" type="text/template">
<# if ( data.myLogoURL ) { #>
<span style="background-image: url({{data.myLogoURL}})" class="list-cover has-image"></span>
<# } #>
<# if ( data.title ) { #>
<h3>
<a href="{{data.permalink}}" target="{{data.mapMarker.target}}">
{{{data.title}}}
</a>
</h3>
<# } #>
<# if ( data.cardDisplay.rating && data.reviews ) { #>
<div class="listing-stars">
<# if ( data.reviews ) { #>
<# for ( var i = 1; i <= data.reviews.stars.full; i++ ) { #>
<span class="listing-star listing-star--full"></span>
<# } for ( var i = 1; i <= data.reviews.stars.half; i++ ) { #>
<span class="listing-star listing-star--half"></span>
<# } for ( var i = 1; i <= data.reviews.stars.empty; i++ ) { #>
<span class="listing-star listing-star--empty"></span>
<# } #>
<# } #>
</div>
<# } #>
<# if ( data.status.businessHours ) { #>
<# if ( data.status.businessIsOpen ) { #>
<div class="listing-business-hour-status" data-status="open">
<?php esc_html_e( 'Now Open', 'listify' ); ?>
</div>
<# } else { #>
<div class="listing-business-hour-status" data-status="closed">
<?php esc_html_e( 'Closed', 'listify' ); ?>
</div>
<# } #>
<# } #>
<# if ( data.location.raw ) { #>
<span class="address">{{{data.location.raw}}}</span>
<# } #>
<# if ( data.permalink ) { #>
<a href="{{data.permalink}}" class="job_listing-clickbox"></a>
<# } #>
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment