Jump to content

Recommended Posts

I'm trying to display distance on my posts using facetwp plugin in my listify theme.

 

CODE

 

https://facetwp.com/proximity-facet-show-post-distance/

https://gist.github.com/mgibbs189/9492fcd44f135b10e92bc59e0958431c

 

Listify format for using hooks ver 2.x

 

http://listify.astoundify.com/article/545-add-additional-information-to-the-listing-grid

 

I tried this code in my function.php but getting no result.

add_filter( 'listify_get_listing_to_array', function( $data, $listing ) {
$distance = facetwp_get_distance();
if ( '' !== $distance ) {
$data['distance'] = $distance;
}
return $data;
}, 10, 2 );
add_action( 'listify_content_job_listing_meta', function() {
// Check if available.
echo '<# if ( data.distance ) { #>';

echo '<div class="fwp-distance">{{data.distance}}</div>';

echo '<# } #>';
} );

add_filter( 'facetwp_proximity_store_distance', '__return_true' );

Any suggestions will be highly appreciated :)

 

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.