Spec Sheets Test (file system)
This page is a demo of getting all the spec sheets from the file system directly. It does not require the WP-Filebase plugin to be activated. This demo has been shelved because a better way has been discovered using a shortcode to list files by category that can be used in the Block Editor just like we use the WP-Filebase shortcode now to display spec sheets by category.
List of all Spec Sheets – (unordered, ungrouped). Direct from file system of website. Scans 4 levels into the “wp-content/uploads/filebase” folder. Category relationships are stored in database entries in the “wp_wpfb_files” table. Should be able to get the categories and related files and paths from the database, but they are not Posts. Custom table.
- This page found 409 total files
- WP-Filebase reports 410 total files (so we are only missing one)
“wp_wpfb_files” table (partial list of fields)
- file_id (INT)
- file_path i.e.: ( /wp-content/uploads/filebase/bath_accessories/soma-bath/3400.pdf )
- file_category (INT)
RED = missing, GREEN = included portion
- list_files() – used to list files, sets a transient called “files_transient” which is used as the input to the $files foreach loop. slight performance boost.