Advertisement
Guest User

Untitled

a guest
Jan 20th, 2017
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. function my_relationship_result( $title, $post, $field, $post_id ) {
  2. // load a custom field from this $object and show it in the $result
  3. $page_views = get_field('page_views', $post->ID);
  4.  
  5. // append to title
  6. $title .= ' [' . $page_views . ']';
  7.  
  8. // return
  9. return $title;
  10. }
  11.  
  12. // filter for every field
  13. add_filter('acf/fields/relationship/result', 'my_relationship_result', 10, 4);
  14.  
  15. // filter for a specific field based on it's name
  16. //add_filter('acf/fields/relationship/result/name=my_relationship', 'my_relationship_result', 10, 4);
  17.  
  18. // filter for a specific field based on it's key
  19. //add_filter('acf/fields/relationship/result/key=field_508a263b40457', 'my_relationship_result', 10, 4);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement