Skip to content

Instantly share code, notes, and snippets.

@zackkatz
Last active August 29, 2015 14:14
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 zackkatz/ca5d903449390c1dd0ea to your computer and use it in GitHub Desktop.
Save zackkatz/ca5d903449390c1dd0ea to your computer and use it in GitHub Desktop.
Add code inside listing wrapper to achieve http://codepen.io/anon/pen/pvPaaW
<?php
/*
* Plugin Name: IDX+ - Insert Ribbon HTML Into Listings
* Description: Print the ribbon HTML inside the listing wrapper for search results
* Version: 1.0
* Author: Katz Web Services, Inc.
* Author URI: http://www.idxplus.net
*/
// Available since IDX+ 2.4
add_action('idx_plus_results_before_listing', 'skyvillage_add_ribbon_to_listing' );
/**
* Print the ribbon HTML inside the listing wrapper
*
* @param array $listing Array of listing data, like price, lot size, etc.
*/
function skyvillage_add_ribbon_to_listing( $listing = array() ) {
// Not sold
if( !isset( $listing['status'] ) || strtolower( $listing['status'] ) !== 'sold' ) {
return;
}
// The rest is sold
?>
<!-- You can insert HTML code here -->
<div class="corner-ribbon top-left sticky red">Sold</div>
<!-- /end new code -->
<?php
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment