/* Social Wall */
function custom_facebook_script_in_header() {
?>
<script async defer crossorigin="anonymous" src="https://connect.facebook.net/en_US/sdk.js"></script>
<script>
window.fbAsyncInit = function() {
FB.init({
appId : 'your-app-id',
xfbml : true,
version : 'v18.0'
});
FB.api(
'/me',
'GET',
{"fields":"posts", "access_token": "your_access_token"},
function(response) {
const posts = response.posts.data;
const postsContainer = document.getElementById('facebook-posts-container');
posts.forEach(post => {
const postElement = document.createElement('div');
postElement.innerHTML = `
<div>
<strong>Created Time:</strong> ${post.created_time}
</div>
<div>
<strong>Message:</strong> ${post.message}
</div>
<hr>
`;
postsContainer.appendChild(postElement);
});
}
);
}
</script>
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.