Created
March 5, 2020 15:01
-
-
Save mgibbs189/1e5b641b4e7c4df7b3e1d5a321113403 to your computer and use it in GitHub Desktop.
FacetWP - Layout Builder - display "User Profile Picture"
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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