Jump to content


Photo

Display distance on my posts using facetwp plugin


  • Please log in to reply
1 reply to this topic

#1 mohit131

mohit131
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 09 August 2017 - 08:12 AM

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

 

CODE

 

https://facetwp.com/...-post-distance/

https://gist.github....92bc59e0958431c

 

Listify format for using hooks ver 2.x

 

http://listify.astou...he-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 :)

 



#2 cyberRobot

cyberRobot
  • Moderators
  • Much to Learn
  • 2,764 posts

Posted 09 August 2017 - 02:40 PM

EDIT: I changed the topic title; it was "PHP expert please Help!"






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users