Sample Code – one facebook album
-
The directions I saw were geared to the person who wants to display multiple albums. I wanted to show one album. Here is my code for anyone else who wants to use it:
function fbalbum_func() { $list = facebook_page_albums_get_photo_list('your-facebook-photo-album-number'); ?><script> function showCaption(fbpic) { document.getElementById(fbpic).style.visibility = "visible"; } function hideCap(fbpic) { var tfbpic = "fbpic" + fbpic; document.getElementById(tfbpic).style.visibility = "hidden"; } </script> <ul class="album-list" style="list-style: none; "> <?php $fbpic = 1; foreach ($list as $item) : ?> <li class="album" > <div style="position: relative;" onmouseover="showCaption('fbpic<? echo $fbpic;?>')" ><a href="<? echo $item['source']; ?>" rel="lightbox[fbpic]"><? echo "<img src='".$item['source']."' style='max-width:250px; max-height: 250px'>"; ?><br> <? echo "<p id='fbpic$fbpic' style='background-color:#999; color: white; visibility: hidden;position: absolute; bottom:-5;' "; echo 'onMouseOut="hideCap('.$fbpic.')"'; echo"'>".$item['name']."</p>"; ?></a></div> <div class="fbpic" style="position: relative; display: none;" > <? echo "<img src='".$item['source']."' "; ?> </div> </li> <?php $fbpic++; endforeach;?> </ul> <? } add_shortcode('fbalbum', 'fbalbum_func'); ?>Here is some sample CSS for the class .album:
.album {float: left; margin: 10px; height: 270px; width: 270px; text-align: center; background-color: #ccc; padding: 5px;vertical-align: middle;}Enjoy!
mrsburnside
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
The topic ‘Sample Code – one facebook album’ is closed to new replies.