![]() |
|
Picture feed on Wordpress homepage - Printable Version +- ZenphotoCMS Forum (https://forum.zenphoto.org) +-- Forum: Support (https://forum.zenphoto.org/forum-1.html) +--- Forum: General support (https://forum.zenphoto.org/forum-4.html) +--- Thread: Picture feed on Wordpress homepage (/thread-6659.html) |
Picture feed on Wordpress homepage - jennyj - 2010-02-27 In reading through old forum posts it seems like it's no longer possible to pass a group of random images from Zenphoto to my Wordpress website homepage. I used to be able to do it but not anymore. Are there any alternatives, like using an RSS feed of the most recent images to display on a Wordpress homepage? Or has anyone worked out how to solve this problem some other way? It seems like such a great way to get people from the home page of a Wordpress site to the galleries in Zenphoto deeper in the site. Picture feed on Wordpress homepage - howler358 - 2010-02-27 I'm sure a better programmer would come up with a more elegant solution, but I've been using this bit of php for a while to get random photos from specified directories and display thumbs on a WordPress blog. `<?php` `$link2ID = mysql_connect("database.vista.howlingpoint.net", "userid", "password");` `mysql_select_db("database", $link2ID);` `$result2ID = mysql_query("SELECT albumid, filename, title,`desc`FROM zp_images WHERE (albumid = '3' OR albumid = '21') ORDER BY RAND() LIMIT 1", $link2ID);` `while (list($albumid, $filename, $title2, $zen_caption) =` `mysql_fetch_array($result2ID))` `{` `$result3ID = mysql_query("SELECT folder FROM zp_albums WHERE id='$albumid'", $link2ID);` `list($folder) = mysql_fetch_array($result3ID);` `$folder2 = urlencode($folder);` `print "<a href=\"http://vista.howlingpoint.net/z/$folder/$filename.php\" title=\"$title2: $zen_caption\" target=\"_blank\"><img src=\"http://vista.howlingpoint.net/z/zp-core/i.php?a=$folder2&i=$filename&w=140&q=80\" alt=\"$title2: $zen_caption\" border=\"1\"></a>";` `}` `mysql_close($link2ID);` `?>` Examples in action are howlingpoint.net/life and beachlaw.info. Note for my server the query for the desc element had to be in backticks to avoid an error. Picture feed on Wordpress homepage - jennyj - 2010-02-27 I will try to play around with that a little bit. Anyone else have any ideas? |