| 开发者 | robindecroock |
|---|---|
| 更新时间 | 2026年9月21日 06:19 |
| 捐献地址: | 去捐款 |
| PHP版本: | 8.1 及以上 |
| WordPress版本: | 7.1 |
| 版权: | GPLv2 or later |
| 版权网址: | 版权信息 |
Apps/One Folder Gallery/ Trip to Lisbon/ <- an album DSC_0001.jpg DSC_0002.jpg The garden in June/ <- another album rose.jpg loose-photo.jpg <- not shown, it is not in an album
So you run your galleries from OneDrive. New subfolder, new album. Rename it and the title follows. New photos show up within a few minutes, or at once if you press Refresh now.
In WordPress there are two moments. Once, you connect your account by typing a short code on Microsoft's sign-in page. After that you drop the gallery block on a page and pick an album. No app registration, no client secret.
Step by step: see Installation below.
Order
photo 2 comes before photo 10. No need to pad names with zeroes.
Block editor
Add the One Folder Gallery block (under Media, or search for "onedrive"). Its sidebar lists the albums in your OneDrive folder, so you can pick one without copying an id from anywhere, and set the layout and the number of columns. Choose All albums to let visitors pick an album themselves.
The block previews the real gallery while you edit, and the editor's own Advanced panel, alignment and spacing controls apply to it like to any other block. An existing [one_folder_gallery] shortcode can be converted into the block.
Shortcodes
The shortcode stays available for the classic editor, widgets and page builders.
[one_folder_gallery] lists every album. The photos load when a visitor clicks one.[one_folder_gallery folder_id="..."] shows the photos of one album.[one_folder_gallery folder_id="..." cols="4"] sets the number of columns, 1 to 6.[one_folder_gallery class="before-after"] adds your own class, so you can style this one gallery on its own.[one_folder_gallery layout="justified"] picks a layout: grid, justified or masonry.layout attribute on the shortcode. None of them uses JavaScript to position anything, so the gallery does not shift around while the photos load.
--onefg-row-height; see Matching your theme below.
Matching your theme
This part is for whoever writes the CSS on your site; hand it to them if that is not you. The gallery ships deliberately plain and takes its colours, fonts, shapes and spacing from CSS custom properties, so it can be made to match your site without fighting the plugin's own styling. Set the properties you want in your theme's custom CSS, on :root for every gallery on the site, or on a class you gave one gallery:
:root { --onefg-album-min: 240px; --onefg-album-gap: 24px; --onefg-album-radius: 20px; --onefg-album-ratio: 4 / 3; --onefg-album-card-bg: #fff; --onefg-album-card-padding: 12px; --onefg-album-card-radius: 20px; --onefg-album-card-shadow: 0 2px 12px rgba(0, 0, 0, .08); --onefg-album-name-family: "Anton", sans-serif; --onefg-photo-radius: 12px; --onefg-gap: 16px; --onefg-row-height: 260px; --onefg-spinner-color: #c1614a; }
There are around fifty of these, covering the album tiles, the photo grid, the loading spinner, the messages and the lightbox. I wrote the full list with every default into the comment at the top of assets/style.css, so it cannot drift from the code.
Two are worth knowing about up front: --onefg-photo-ratio and --onefg-album-ratio take any shape, so your photos do not have to be square, and --onefg-photo-fit: contain shows whole photos instead of cropping them to fill the tile.
One exception. I build the lightbox once and hang it at the end of the page, never inside the photo grid, so that reloading the grid cannot break it. The cost is that its properties, such as --onefg-lightbox-bg, only work site-wide and not on one gallery's class.
The gallery also respects the visitor's reduce motion setting: the hover zoom and the loading shimmer stop, and the spinner slows down.
Developers who want to add a layout of their own to the block's Layout dropdown will find the one filter the plugin offers documented in the source repository.
Important: everything in the app folder can become public
[one_folder_gallery] without a folder lists every album in the app folder, and anyone visiting that page can open them. Only put photos in the app folder that you are comfortable showing publicly. The plugin does not add password protection or per-album access control.
Photos stay in OneDrive
Nothing is copied to your web server. Visitors' browsers load the images directly from Microsoft's servers, which is also why Microsoft sees your visitors' IP addresses. See the Privacy section below.
Work and school accounts
Personal Microsoft accounts work out of the box. For a Microsoft 365 work or school account it depends on how your organisation is configured. Three things can get in the way:
Apps/One Folder Gallery in your OneDrive.No. It asks for Files.ReadWrite.AppFolder, which Microsoft limits to the one folder it makes for this plugin. Watch for Files.Read.All or Files.ReadWrite.All on that sign-in screen, for any plugin: those mean your whole drive.
No. You sign in with a code, the way you would on a smart TV.
Listings are cached for a few minutes, so your site stays fast and Microsoft does not throttle it. Refresh now on the settings page clears that at once.
It means Microsoft has not confirmed who is behind the application. It changes nothing about what the plugin can reach. If your organisation only accepts verified publishers, an administrator has to approve it, or you use your own application under Advanced in the settings.
No. Whoever can open the page can see the photos. Use WordPress' own page visibility for that, and keep private photos out of the folder.
Up to 4000. I stop there.