Skip to content

Instantly share code, notes, and snippets.

@tripflex
Last active July 24, 2017 23:13
Show Gist options
  • Save tripflex/e167902de01d21d6a0a852b921f87624 to your computer and use it in GitHub Desktop.
Save tripflex/e167902de01d21d6a0a852b921f87624 to your computer and use it in GitHub Desktop.
Set custom map icon for featured listings in Listify WordPress theme (for WP Job Manager)
<?php
add_filter( 'listify_listing_data', 'smyles_custom_featured_listing_map_icon', 50, 2 );
function smyles_custom_featured_listing_map_icon( $data, $post ){
// Make sure passed $post is WP_Post object
if( $post instanceof WP_Post ){
// If listing is featured listing, change icon
if( ! empty( $post->_featured ) ){
// Set the icon to use below (@see http://ionicons.com/)
$data['icon'] = 'ion-thumbsup';
// Set to "smyles-featured" to use custom CSS (see comments below)
$data['term'] = 'smyles-featured';
}
}
return $data;
}
@tripflex
Copy link
Author

tripflex commented Dec 27, 2016

To customize the color of the icons, add this CSS code to your child theme's CSS and customize to your color of choice:

/* icon color */
.map-marker.type-smyles-featured i:before {
	color: red;
}

/* Marker color */
.map-marker.type-smyles-featured i:after { 
	background-color: red; 
}

/* Marker color */
.map-marker.type-smyles-featured:after { 
	border-top-color: red;
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment