Title: wppa_get_thumbs &#8211; undefined function
Last modified: August 8, 2022

---

# wppa_get_thumbs – undefined function

 *  Resolved [pfm](https://wordpress.org/support/users/pfm/)
 * (@pfm)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/)
 * Hi,
 * I did use some special code you provided me years ago. The idea is to list all
   picture thumbnails that fit to the TAG on the tag page.
 * Today I recognized this no longer works (maybe due to updates):
 *     ```
       Fatal error: Uncaught Error: Call to undefined function wppa_get_thumbs() in ...
   
       I commented the line with the call of wppa_get_thumbs. This solves the issue but sure does not show any pictures. Is there a new function or another solution I can use?
   
       Thank you!
   
       The original code was:
   
       <code></code><?php if ( function_exists( 'wppa_albums' ) ) {
   
       				// Init
       				global $wppa;
       				global $thumbs;
       				global $photo_count;
   
       				// Find the tag
       				$my_tag = single_tag_title( '', false );
       				$my_tag = str_replace( '&', '&', $my_tag );
       				$my_tag = wppa_sanitize_tags( $my_tag );
       				// echo 'Debug:Tag='.$my_tag;
   
       				// Find the count of photos
       				$wppa['is_tag'] = $my_tag;
       				wppa_get_thumbs();
       				$photo_count = is_array( $thumbs ) ? count( $thumbs ) : 0;
   
       				// If photos, show them
       				if ( $photo_count ) {
       					echo '<h2 class="entry-title"><b>Galerie-Fotos</b> - passend zu dem Artikel-Schlagwort</h2>';
       					echo '</br>';
   
       					//echo do_shortcode( '[wppa type="slide" album="#tags,'.$my_tag.' size="auto" align="center"][/wppa]' );
       					echo wppa_insert_shortcode_output( do_shortcode( '[wppa type="thumbs" album="#tags,'.$my_tag.'" size="auto" align="center"][/wppa]' ) );
       				}
   
       				// If no photos, say it and clean up !
       				else {
       					//echo 'Es gibt leider keine passenden Fotos mit dem Schlagwort <b>'.$my_tag.'</b>';
       					wppa_reset_occurrance();
       				}
       				echo '</br>';
       			} ?><code></code>
       ```
   
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Fwppa_get_thumbs-undefined-function%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 11 replies - 1 through 11 (of 11 total)

 *  Plugin Author [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/)
 * (@opajaap)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15899669)
 * wppa_get_thumbs() is now wppa_get_photos()
    Functionally the same
 *  Thread Starter [pfm](https://wordpress.org/support/users/pfm/)
 * (@pfm)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15902235)
 * Dear Jacob,
 * thank you. I replaced the function and now there is no error – but it does not
   show me the pictures… the calculation seems to return 0
 *     ```
       wppa_get_thumbs();
       				$photo_count = is_array( $thumbs ) ? count( $thumbs ) : 0;
   
       				// If photos, show them
       				if ( $photo_count ) {
       ```
   
 * e.g. [https://fosm.de/tag/talisker/](https://fosm.de/tag/talisker/)
 *  Thread Starter [pfm](https://wordpress.org/support/users/pfm/)
 * (@pfm)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15902243)
 * I replaced wppa_get_thumbs() with wppa_get_photos()
 *  Plugin Author [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/)
 * (@opajaap)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15903815)
 * `wppa_insert_shortcode_output()` is obsolete, so change:
 *     ```
       //echo do_shortcode( '[wppa type="slide" album="#tags,'.$my_tag.' size="auto" align="center"][/wppa]' );
       echo wppa_insert_shortcode_output( do_shortcode( '[wppa type="thumbs" album="#tags,'.$my_tag.'" size="auto" align="center"][/wppa]' ) );
       ```
   
 * into:
 *     ```
       echo do_shortcode( '[wppa type="slide" album="#tags,'.$my_tag.' size="auto" align="center"]' );
       ```
   
 * ([/wppa] is also no longer needed but does no harm when it is there)
 * I think it will work now, but keep also in mind that the rules whether a photo
   is visible for the current user is more strictly maintained, e.g. a photo with
   status ‘private’ will show up to loggedin visitors only etc.
    -  This reply was modified 3 years, 9 months ago by [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/).
 *  Thread Starter [pfm](https://wordpress.org/support/users/pfm/)
 * (@pfm)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15908214)
 * I did change the line and check the pictures. The counter is still 0 and I do
   not get any pictures displayed.
 * I checked:
    – the album has 18 pics – each pic is “published” (not private) –
   each pic has the tag “Talisker” (might this be a case sensitive issue? nothing
   changed on this side) – I removed the if clause and it returned “no pics found”
   in a box – I did insert the debug line `echo 'Debug:Tag='.$my_tag;` => **Debug:
   Tag=,Talisker,** so there seem to be added commas….
 * Anything else I can do?
 * Thank you!
 *  Plugin Author [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/)
 * (@opajaap)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15908390)
 * The comma’s should not spoil it.
 * Try this:
 *     ```
       // If photos, show them
       				if ( $photo_count ) {
       ```
   
 * Change into
 *     ```
       // If photos, show them
       				if ( true ) {
       ```
   
 * This will always print the <h2> tag, but then you can see if the shortcode works.
 * If so, find the number of photos by this code:
 *     ```
       global $wpdb;
       $photo_count = $wpdb->get_var( "SELECT COUNT(*) FROM $wpdb->wppa_photos WHERE tags LIKE '%$my_tag%'" );
       ```
   
 * The comma’s are assumend to be in $my_tag. Tags are stored this way:
    ‘,Tag1,
   Tag2,Tag3,’
 * This is to prevent finding ‘Tag1extra’ when searching for ‘Tag1’
    -  This reply was modified 3 years, 9 months ago by [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/).
 *  Plugin Author [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/)
 * (@opajaap)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15910578)
 * AHA, got it after some testing!
 * The result of wppa_get_photos is no longer stored in `global $thumbs`, so you
   have to find the count as follows if you want to stay using `wppa_get_photos()`
 *     ```
       $photos = wppa_get_photos();
       $photo_count = is_array( $photos ) ? count( $photos ) : '0';
       ```
   
 *  Thread Starter [pfm](https://wordpress.org/support/users/pfm/)
 * (@pfm)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15913254)
 * First part solved. The counter returns me the correct/expected 19. It goes inside
   the loop to show the pics, but the WPPA shortcode seems not to work as it returns
   still the above message in the box saying (translated): no pictures found that
   fits search criteria.
 * `echo do_shortcode( '[wppa type="slide" album="#tags,'.$my_tag.' size="auto" 
   align="center"]' );`
 * the $my_tag:
 *     ```
       $my_tag = single_tag_title( '', false );
       $my_tag = str_replace( '&', '&', $my_tag );
       $my_tag = wppa_sanitize_tags( $my_tag );
       $wppa['is_tag'] = $my_tag;
       ```
   
 * Any other mistake in the above you can see?
 * Thank you!
 *  Plugin Author [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/)
 * (@opajaap)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15913287)
 *     ```
       echo do_shortcode( '[wppa type="slide" album="#tags,'.$my_tag.' size="auto" align="center"]' );
       ```
   
 *  contains an error, you miss a ”
 *     ```
       echo do_shortcode( '[wppa type="slide" album="#tags,'.$my_tag.'" size="auto" align="center"]' );
       ```
   
    -  This reply was modified 3 years, 9 months ago by [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/).
 *  Thread Starter [pfm](https://wordpress.org/support/users/pfm/)
 * (@pfm)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15913419)
 * That’s it. Thank you!
 *  Plugin Author [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/)
 * (@opajaap)
 * [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15913587)
 * Thanx for your donation!

Viewing 11 replies - 1 through 11 (of 11 total)

The topic ‘wppa_get_thumbs – undefined function’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-photo-album-plus.svg)
 * [WP Photo Album Plus](https://wordpress.org/plugins/wp-photo-album-plus/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-photo-album-plus/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-photo-album-plus/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-photo-album-plus/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-photo-album-plus/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-photo-album-plus/reviews/)

## Tags

 * [undefined function](https://wordpress.org/support/topic-tag/undefined-function/)

 * 11 replies
 * 2 participants
 * Last reply from: [Jacob N. Breetvelt](https://wordpress.org/support/users/opajaap/)
 * Last activity: [3 years, 9 months ago](https://wordpress.org/support/topic/wppa_get_thumbs-undefined-function/#post-15913587)
 * Status: resolved