WordPress.org

Forums

Facebook Album
[resolved] Sample Code - one facebook album (2 posts)

  1. mrsburnside
    Member
    Posted 10 months ago #

    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

  2. mglaman
    Member
    Plugin Author

    Posted 7 months ago #

    This plugin is meant to display one album per shortcode, not multiple. So not sure what this is?

Reply

You must log in to post.

About this Plugin

About this Topic

Tags

No tags yet.