Take the 2-minute tour ×

I've been playing around with the FB SDK and some examples that exist for displaying FB photo albums, but the examples are much more complex than what I want to do. All I want to do is set the album id for a single album and pull in the contents. That's it, I can style everything after that, I just need to be able to view the contents of one album and pull in the caption for each photo.

I'm trying to create a WordPress album that does this; I can easily create the base of the widget, but I'm lost when it comes to API's.

Are there any examples out there that I've overlooked?

Does anyone know how to accomplish this?

share|improve this question

1 Answer 1

up vote 0 down vote accepted

hopefully this gives you a hint ;)


if (empty($_GET['album'])) {

//get all albums of page
    $graph_url = "https://graph.facebook.com/PressPlayPrague/albums?       fields=id,link,name,cover_photo&limit=500";
    $albums = json_decode(file_get_contents($graph_url));
        $counted = sizeof ($albums->data); // get the number of albums for later use

//output all albums of given page
for($c=0; $c<$counted; $c++){
    echo ("<div class='wrapper' <a href='?album=".$albums->data[$c]->id."'><div class='stack'><div style='width:180px; height:120px; display:inline-block; background-image:url(https://graph.facebook.com/".$albums->data[$c]->id."/picture?width=300&height=200); background-repeat:no-repeat;'>  </div></div><div class='caption'>".$albums->data[$c]->name."</div></a></div>");


        //get the album pictures replace the $_GET[album] with specific ID and remove the if clause to get only one album
    $pic_url = "https://graph.facebook.com/".$_GET[album]."/photos?fields=picture&limit=500";
    $pictures = json_decode(file_get_contents($pic_url));
    $countpic= sizeof ($pictures->data); // get the number of pics for later use
for($p=0; $p<$countpic; $p++){
echo ("<img style='width:250px; max-height:167px;' src='https://graph.facebook.com/".$pictures->data[$p]->id."/picture' alt='".$pictures->data[$p]->id."'>");



share|improve this answer
Thank you so much, I didn't think it could be so simple! –  Austin Biggs Apr 12 '13 at 13:44

Your Answer


