Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Jacob N. Breetvelt

    (@opajaap)

    There is no fuction reference, but i am very willing to help you.

    try this:

    global $wpdb, $wppa;
    $cover_image_urls = false;
    if (is_array($wppa)) { // wppa active
     $albums = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".WPPA_ALBUMS." ORDER BY timestamp DESC LIMIT 8"));
     if ($albums) { // Yes found some
      foreach ($albums as $album) {
       $cover_image_urls[] = wppa_get_thumb_url_by_id(wppa_get_coverphoto_id($album['id']));
    }}}

    Now you have an array $cover_image_urls with the urls to the thumbnails of the most recently added albums.
    If you want the fullsize images, filter the urls with: str_replace('/thumb/', '/', $url) where $url is an url from the array.

    Plugin Author Jacob N. Breetvelt

    (@opajaap)

    Sorry, made an error in the code above.

    $albums = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".WPPA_ALBUMS." ORDER BY timestamp DESC LIMIT 8"));

    should read:

    $albums = $wpdb->get_results($wpdb->prepare("SELECT * FROM ".WPPA_ALBUMS." ORDER BY timestamp DESC LIMIT 8"), 'ARRAY_A');

    forgot the , ARRAY_A’

    Thread Starter aalokdhond

    (@aalokdhond)

    thanks 🙂

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Plugin: WP Photo Album Plus] get cover images for 8 latest albums’ is closed to new replies.