As reported in https://www.reddit.com/r/kde/comments/4yqv68/webp_as_wallpaper/ and thanks for seeking the proper code snippets.
Created a test folder with a few .jpg and .webp files and some other junk as well as two sub folders with images in them.
Slideshow would pick up the .jpg and .webp images as well as the images from the subdirectories but not the other junk files.