Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Last active January 17, 2018 20:35
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 mgibbs189/7fd4403945678929734f82504c9eabc7 to your computer and use it in GitHub Desktop.
Save mgibbs189/7fd4403945678929734f82504c9eabc7 to your computer and use it in GitHub Desktop.
FacetWP - stick custom data into FWP_JSON
<?php
add_filter( 'facetwp_assets', function( $assets ) {
// Populate "FWP_JSON.neighborhood_data"
FWP()->display->json['neighborhood_data'] = array(
'academy' => array(
'title' => 'Academy',
'description' => 'This is the description',
'image' => 'http://image.url',
),
'airport' => array(
'title' => 'Airport',
'description' => 'This is the description',
'image' => 'http://image.url',
)
);
// Return the same thing (since we're hijacking this hook)
return $assets;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment