The goal is to show the 3 most recent posts from a company page on our website, I created the graph url with the information:
https://graph.facebook.com/{pagenamehere}/posts?fields=full_picture,picture,link,message&limit=3&access_token={accesstoken|secret}
This pulls in everything correctly in the following JSON format:
data:
0:
full_picture: "content here"
picture: "content here"
link: "content here"
message: "content here"
id: "content here"
1:
full_picture: "content here"
picture: "content here"
link: "content here"
message: "content here"
id: "content here"
2:
full_picture: "content here"
picture: "content here"
link: "content here"
message: "content here"
id: "content here"
Tried pulling it in with the following code:
<?php
query_posts('&showposts=-1&order=ASC');
while (have_posts()) : the_post();
$json = file_get_contents( 'https://graph.facebook.com/{pagenamehere}/posts?fields=full_picture,picture,link,message&limit=3&access_token={accesstoken|secret}');
$json_data = json_decode($json, false);
echo $json_data->data[0]->total_count;
echo '<br>';
endwhile;
?>
I need to be able to loop through this and put them in three different divs in the format below in order to apply custom css to the posts:
<div class="col-sm-4">
<div class="stay-connected-inner">
<div class="stay-connected-info">
<div class="stay-connected-left"><i class="fa fa-facebook"></i></div>
<div class="stay-connected-right">
<h5>Page Title</h5>
<p>Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur.</p>
</div>
</div>
<div class="stay-connected-fig">
<img src="" alt="">
</div>
</div>
</div>
<div class="col-sm-4">
<div class="stay-connected-inner">
<div class="stay-connected-info">
<div class="stay-connected-left"><i class="fa fa-facebook"></i></div>
<div class="stay-connected-right">
<h5>Page Title</h5>
<p>Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur.</p>
</div>
</div>
<div class="stay-connected-fig">
<img src="" alt="">
</div>
</div>
</div>
<div class="col-sm-4">
<div class="stay-connected-inner">
<div class="stay-connected-info">
<div class="stay-connected-left"><i class="fa fa-facebook"></i></div>
<div class="stay-connected-right">
<h5>Page Title</h5>
<p>Aenean massa. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur.</p>
</div>
</div>
<div class="stay-connected-fig">
<img src="" alt="">
</div>
</div>
</div>
Referenced tutorial here: How to embed a Facebook page's feed into my website
My site is in WordPress and am not familiar with asp.net.