why don’t you use plugin ?
Thread Starter
umsuka
(@umsuka)
I have to pull photos based on albums and I thought having custom fields would be a good idea; the user will only enter the album id and the magic will happen in the background.
I got it working now, the only problem now is showing a blank space when the custom field is empty and not render an error.
<?php
require_once("phpFlickr.php");
$f = new phpFlickr("xxxxxxxxxxxxxxxxxxxxxxx");
$api_secret = "xxxxxxxxxxxxxxxxxxxxxe";
$photoset_id = get_post_meta($post->ID, 'tham_fr', true);
$photos = $f->photosets_getPhotos($photoset_id);
$user_id = "xxxxxxxxxxxxxxxxx";
if ($f->getErrorCode())
{
echo "<pre>";
echo $f->getErrorCode().":".$f->getErrorMsg(). "\n";
print_r($photos);
print_r($f);
echo "</pre>";
}
foreach ($photos['photoset']['photo'] as $photo) {
$html .= "<a href='".$f->buildPhotoURL($photo, "large")."' title='".$photo['title']."' ></a>";
$html .= "<img border='0' alt='$photo[description]' src='".$f->buildPhotoURL($photo, "Square")."' id='photo_".$photo['id']."'></a>";
}
echo $html;
?>