Skip to content

Instantly share code, notes, and snippets.

@mgibbs189
Created March 5, 2020 15:01
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/1e5b641b4e7c4df7b3e1d5a321113403 to your computer and use it in GitHub Desktop.
Save mgibbs189/1e5b641b4e7c4df7b3e1d5a321113403 to your computer and use it in GitHub Desktop.
FacetWP - Layout Builder - display "User Profile Picture"
<?php
/**
* This pulls the avatar (profile photo) from the "User Profile Picture" plugin
* Add a layout builder item (named "avatar") and using the data source of "User ID"
*/
add_filter( 'facetwp_builder_item_value', function( $value, $item ) {
if ( 'avatar' == $item['settings']['name'] ) {
$value = get_avatar( $value );
}
return $value;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment