Title: One Folder Gallery for OneDrive
Author: robindecroock
Published: <strong>September 20, 2026</strong>
Last modified: September 20, 2026

---

Search plugins

![](https://ps.w.org/one-folder-gallery-for-onedrive/assets/banner-772x250.png?rev
=3704640)

![](https://ps.w.org/one-folder-gallery-for-onedrive/assets/icon-256x256.png?rev
=3704640)

# One Folder Gallery for OneDrive

 By [robindecroock](https://profiles.wordpress.org/robindecroock/)

[Download](https://downloads.wordpress.org/plugin/one-folder-gallery-for-onedrive.0.1.2.zip)

 * [Details](https://wordpress.org/plugins/one-folder-gallery-for-onedrive/#description)
 * [Reviews](https://wordpress.org/plugins/one-folder-gallery-for-onedrive/#reviews)
 *  [Installation](https://wordpress.org/plugins/one-folder-gallery-for-onedrive/#installation)
 * [Development](https://wordpress.org/plugins/one-folder-gallery-for-onedrive/#developers)

 [Support](https://wordpress.org/support/plugin/one-folder-gallery-for-onedrive/)

## Description

One Folder Gallery for OneDrive shows the photos from a single, isolated folder 
in your Microsoft OneDrive on your WordPress site.

What matters here is what the plugin _cannot_ do. Microsoft gives it a key to one
folder, the one it makes for this plugin, and to nothing else. Your documents and
your other photos stay out of reach, and a mistake in my code cannot widen that.
You do not have to take my word for it either: Microsoft lists on the sign-in screen
exactly what it is handing over, before you agree to anything.

#### How it works

Your photos stay in your own OneDrive, in one folder Microsoft makes for this plugin
and keeps apart from everything else. Every subfolder in it is an album. The subfolder’s
name is the title your visitors see:

    ```
    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

 * **Albums** are listed by name.
 * **Photos** are listed by the date they were taken. Screenshots, logos and anything
   else that never came out of a camera have no such date, so those fall back to
   the file name.

Numbers count as numbers, so `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`.

The classic editor has a **Choose OneDrive folder** button that browses your albums
and inserts the shortcode for you.

#### Layouts

Three layouts ship with the plugin. Pick one in the block sidebar, or with the `
layout` attribute on the shortcode. None of them uses JavaScript to position anything,
so the gallery does not shift around while the photos load.

 * **Grid**: equal tiles in a fixed number of columns. Photos are cropped to the
   same shape. This is the default.
 * **Justified rows**: rows of equal height in which every photo keeps its own proportions,
   the way a contact sheet reads. There is no column count: how many photos fit 
   in a row depends on their shapes and the width available.
 * **Masonry**: columns of uneven photos that slot together, and nothing is cropped
   at all. One thing to know: the photos fill each column downwards, so they are
   read from top to bottom in the first column, then top to bottom in the second,
   rather than left to right across the page. If the order of your photos means 
   something, as in a before-and-after, choose grid or justified rows instead.

Justified rows and masonry only come into their own when your photos have different
shapes. If everything in the album is the same size, all three layouts look much
the same.

The height of a justified row is 220 pixels by default, and 150 on a phone. You 
can change that with `--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:

 * **The publisher is not verified.** Microsoft warns about this on the sign-in 
   screen. Some organisations refuse such applications outright.
 * **Approval is required.** Many organisations let only an administrator approve
   a new application. It is approved once, then everyone can use it.
 * **Code sign-in is blocked.** Some organisations do not allow this way of signing
   in at all.

Two ways out, whichever it is. Ask your administrator to approve the application.
Or make your own app in Microsoft Entra with public client flows enabled, and paste
its Application (client) ID under Advanced in the settings. Neither needs a client
secret.

#### How this plugin was made

This plugin and this readme were made with AI help. I read it all, tested it, and
decided what shipped, so the mistakes are mine. Tell me about them on the support
forum.

### External services

This plugin connects to the **Microsoft Graph API**, operated by Microsoft, to sign
you in and to read the contents of one OneDrive folder. Without this connection 
the plugin has nothing to show.

**What is sent, and when:**

 * **When an administrator connects an account:** the plugin’s application id and
   the requested permissions are sent to `login.microsoftonline.com` to start the
   sign-in, and again to obtain and later renew the access token. This happens when
   the administrator clicks Connect, and afterwards roughly twice a day in the background
   to keep the connection alive.
 * **When a gallery page is viewed:** the plugin asks `graph.microsoft.com` for 
   the names of the folders and for the file names and thumbnail links inside the
   folder being shown, using the stored access token. Results are cached for a few
   minutes, so this does not happen on every page view.
 * **When a visitor loads a page with a gallery:** the visitor’s own browser requests
   the image files directly from Microsoft’s servers. Microsoft therefore receives
   the visitor’s IP address, the time of the request, and technical details such
   as the browser being used. This is a direct request from the visitor to Microsoft;
   it does not pass through this website.

No photos, visitor details, page content or site data are sent to any other third
party, and the plugin author does not operate any server involved in this.

Microsoft’s terms and privacy policy apply to this data:

 * Microsoft Services Agreement: https://www.microsoft.com/servicesagreement
 * Microsoft Privacy Statement: https://privacy.microsoft.com/privacystatement

### Privacy

The plugin stores an access token and a refresh token for the connected Microsoft
account. They are scrambled before they are stored in the WordPress database, with
a key made from your site’s own secret keys, so reading the database alone gets 
you nothing. The scrambling is done by sodium, the encryption library built into
PHP. They are never sent to the browser and never leave your server except to Microsoft,
to renew the connection.

The plugin sets no cookies and stores nothing about visitors.

Because visitors load images straight from Microsoft, their IP addresses reach Microsoft.
If your site serves visitors in a jurisdiction with disclosure requirements, mention
this in your privacy policy. The plugin adds suggested wording to **Settings  Privacy
Privacy Policy Guide** that you can copy.

If you use the application bundled with the plugin rather than your own, the plugin
author is the owner of that Azure application registration and can see sign-in telemetry
for it in the Azure portal: which accounts signed in and when. The author cannot
see your files, your photos or your site’s visitors.

Deleting the plugin removes the stored tokens, settings and cached data from your
database. Disconnecting removes the token and clears the cache but keeps your settings.

## Screenshots

[⌊Albums appear as tiles with a cover and a photo count. Clicking one loads its 
photos below.⌉⌊Albums appear as tiles with a cover and a photo count. Clicking one
loads its photos below.⌉[

Albums appear as tiles with a cover and a photo count. Clicking one loads its photos
below.

[⌊The same album in all three layouts: grid crops every photo to one shape, justified
rows keep each photo's proportions at an equal row height, and masonry crops nothing
at all.⌉⌊The same album in all three layouts: grid crops every photo to one shape,
justified rows keep each photo's proportions at an equal row height, and masonry
crops nothing at all.⌉[

The same album in all three layouts: grid crops every photo to one shape, justified
rows keep each photo’s proportions at an equal row height, and masonry crops nothing
at all.

[⌊Clicking a photo opens it in a lightbox, with its name and position in the album.⌉⌊
Clicking a photo opens it in a lightbox, with its name and position in the album
.⌉[

Clicking a photo opens it in a lightbox, with its name and position in the album.

[⌊The block in the editor. Its sidebar lists the albums in your OneDrive folder,
so there is no folder id to copy anywhere.⌉⌊The block in the editor. Its sidebar
lists the albums in your OneDrive folder, so there is no folder id to copy anywhere
.⌉[

The block in the editor. Its sidebar lists the albums in your OneDrive folder, so
there is no folder id to copy anywhere.

[⌊Connecting an account: type the code on Microsoft's own sign-in page. No app registration,
no client secret.⌉⌊Connecting an account: type the code on Microsoft's own sign-
in page. No app registration, no client secret.⌉[

Connecting an account: type the code on Microsoft’s own sign-in page. No app registration,
no client secret.

[⌊The settings screen, with the shortcodes listed for use outside the block editor.⌉⌊
The settings screen, with the shortcodes listed for use outside the block editor
.⌉[

The settings screen, with the shortcodes listed for use outside the block editor.

## Blocks

This plugin provides 1 block.

 *   One Folder Gallery Show the albums from your OneDrive app folder, or the photos
   of one album.

## Installation

 1. Install and activate the plugin.
 2. Go to **Settings  One Folder Gallery for OneDrive**.
 3. Click **Connect to OneDrive** and follow the code shown on screen.
 4. Click **Check / create app folder**. Microsoft creates `Apps/One Folder Gallery`
    in your OneDrive.
 5. Add a subfolder per album in OneDrive and upload your photos. The subfolder’s name
    is the album title on your site.
 6. Add the **One Folder Gallery** block to a page and pick your album in its sidebar.
    In the classic editor, use the **Choose OneDrive folder** button instead.

Your web host needs PHP’s sodium extension, which has been standard since PHP 8.0,
so almost every host has it. Without it I let the plugin refuse the connection outright,
rather than leave your sign-in lying around unprotected.

## FAQ

### Can the plugin see the rest of my 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.

### Do I need to create an app registration in Azure?

No. You sign in with a code, the way you would on a smart TV.

### My photos do not appear after uploading them

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.

### Microsoft says the publisher is unverified. Is that a problem?

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.

### Are the albums password protected?

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.

### How many photos can one album hold?

Up to 4000. I stop there.

## Reviews

There are no reviews for this plugin.

## Contributors & Developers

“One Folder Gallery for OneDrive” is open source software. The following people 
have contributed to this plugin.

Contributors

 *   [ robindecroock ](https://profiles.wordpress.org/robindecroock/)

[Translate “One Folder Gallery for OneDrive” into your language.](https://translate.wordpress.org/projects/wp-plugins/one-folder-gallery-for-onedrive)

### Interested in development?

[Browse the code](https://plugins.trac.wordpress.org/browser/one-folder-gallery-for-onedrive/),
check out the [SVN repository](https://plugins.svn.wordpress.org/one-folder-gallery-for-onedrive/),
or subscribe to the [development log](https://plugins.trac.wordpress.org/log/one-folder-gallery-for-onedrive/)
by [RSS](https://plugins.trac.wordpress.org/log/one-folder-gallery-for-onedrive/?limit=100&mode=stop_on_copy&format=rss).

## Changelog

#### 0.1.2

The readme only. Plain language, shorter answers, and a folder tree instead of four
steps.
 The plugin itself is unchanged.

#### 0.1.1

First release in the plugin directory.

 * A block for the editor, with an album picker, so there is no need to copy a folder
   id anywhere.
 * Three layouts: grid, justified rows and masonry.
 * The whole gallery can be restyled with CSS custom properties, without overriding
   the plugin’s own rules.
 * The gallery respects the visitor’s reduce motion setting.
 * Sign-in is a short code on Microsoft’s own page. No Azure app registration and
   no client secret.
 * Tokens are encrypted at rest and a scheduled task keeps the connection from expiring.
 * Folder and photo listings are cached, and rate limiting from Microsoft is handled
   by serving cached data.
 * Albums hold up to 4000 photos.
 * The interface is in English and can be translated.

## Meta

 *  Version **0.1.2**
 *  Last updated **3 days ago**
 *  Active installations **Fewer than 10**
 *  WordPress version ** 6.3 or higher **
 *  Tested up to **7.1.2**
 *  PHP version ** 8.1 or higher **
 * Tags
 * [gallery](https://wordpress.org/plugins/tags/gallery/)[lightbox](https://wordpress.org/plugins/tags/lightbox/)
   [microsoft](https://wordpress.org/plugins/tags/microsoft/)[OneDrive](https://wordpress.org/plugins/tags/onedrive/)
   [photos](https://wordpress.org/plugins/tags/photos/)
 *  [Advanced View](https://wordpress.org/plugins/one-folder-gallery-for-onedrive/advanced/)

## Ratings

No reviews have been submitted yet.

[Your review](https://wordpress.org/support/plugin/one-folder-gallery-for-onedrive/reviews/#new-post)

[See all reviews](https://wordpress.org/support/plugin/one-folder-gallery-for-onedrive/reviews/)

## Contributors

 *   [ robindecroock ](https://profiles.wordpress.org/robindecroock/)

## Support

Got something to say? Need help?

 [View support forum](https://wordpress.org/support/plugin/one-folder-gallery-for-onedrive/)

## Donate

Would you like to support the advancement of this plugin?

 [ Donate to this plugin ](https://ko-fi.com/robindecroock)