WP/LR Theme Assistant is an extension for WP/LR Sync that allows you to create mappings between the WP/LR Sync API and the technical structure of your theme in order to automate content creation. Typically, it is used to create a page containing a gallery for each of your collection in Lightroom. Thanks to the WP/LR Sync API, everything will be also kept synchronized. Let’s study a simple example first, and then, let’s dig deeper.
WP/LR Theme Assistant is a free extension for WP/LR Sync. You can download it here. You can clone it, adapt it to your needs or even improve it. However, free support cannot be provided for it. You will need to hire a developer or try to understand how it works. If you have any questions, please use the WordPress Forums.
If you are using a specific theme, or specific gallery systems, we recommend you to contact the developers of those with a link to this current page. They know their themes/plugins and will be able to provide information on how to set up the Theme Assistant, or better, they might even add support for WP/LR Sync (without even requiring this plugin).
Introduction: Pages or Posts
You will be able to do this on a very simple install of WordPress. By default, Pages and Posts are always available. Let’s automate the creation of those depending on your Lightroom content. You can pick either Post or Pages, but Pages are usually static (not dated), as Posts are for blogging, updates, etc. Here is a usual configuration.
You can start creating folders and collections in your WP/LR Sync Publish Service in Lightroom and they will be also created on your WordPress accordingly. Folders will be Category, and Collection will be Posts. They will be published right away. Inside those posts, you will find a WP Gallery (which is the standard WordPress Gallery).
Note: Don’t forget about thee Smart Collections in Lightroom. Photographers usually like to have pages featuring their latest photos, or photos based on specific tags, keywords, locations, etc. You simply need to create a Smart Collection in the WP/LR Sync Publish Service and that will work.
Sync with your Theme
There are three WordPress technical elements you need to understand: Post Type, Taxonomy and how the data is stored.
There is a shared Google Document keeping track of themes and the settings for the Post Types extension here: WP/LR Sync & Themes (Post Type Settings).
Post Type and Taxonomy
Page and Posts are the two standard Post Type shipped with WordPress. However, you might be using another Post Type created by your theme, or by a plugin. They often called Collections, Galleries, or even Products. We call them Custom Post Type (CPT) but don’t worry! Technically, they
For example, by installing the Tripod Theme, we notice that this Galleries menu was created. This is a CPT. By clicking on Galleries, I can see that the URL is /wp-admin/edit.php?post_type=gallery. The real technical name of this CPT is therefore gallery.
The Taxonomy is optional with the Theme Assistant, but you might want to check it. It is usually called Category, Tags but also Folder, Set, etc.
In the screenshot above, we can see Category and Tags. Those are taxonomies. By clicking on Category, you can see that the URL is /wp-admin/edit-tags.php?taxonomy=gallery-category&post_type=gallery. We got our taxonomy! It is gallery-category and it is indeed used by the CPT gallery we discovered earlier.
Of course, we could choose to work with Posts instead of the CPT created by the theme. That is totally up to you.
Mode: How is it stored
You now need to find out how the collections of images are stored by your WordPress. Do you wonder what it means? In the Introduction, we linked our Lightroom to Post and Pages, and we choose the WP Gallery method. The effect of this is that for each page created, a gallery (actually a WordPress shortcode which gets transformed into HTML) is written into it. But your theme might require that you pick images in a special field, and that can be stored and managed completely differently from one theme to another. I personally wished they all use the native gallery, but they don’t.
This part is a bit technical, so you can try to understand and find it, ask your developer, or get information from the developer of the theme itself. I am really able to help on this subject as I would need to study every single theme out there.
As of today, the Theme Assistant can handle four modes (methods):
- WP Gallery
- Block for Meow Gallery
- Shortcode Block for Gallery
- Array in Post Meta
- Array in Post Meta (Imploded)
- Array of (ID -> FullSize) in Post Meta
This is straightforward: it simply creates a standard WP Gallery (using the shortcode). Here is an example of how a WP Gallery looks in the editor.
Note that it is made using the Classic Editor and not the Gutenberg Editor. However, if you decide to edit it with Gutenberg, it will still work (it will be considered as a Shortcode Block for Gallery).
This is the simplest way to create galleries in general as it is standard and will always work, whatever your theme is.
Block for Meow Gallery
If you are using Gutenberg, this is the recommended way. You will need to install the Meow Gallery plugin, and automatically the block for it will be created and kept up to date.
Shortcode Block for Gallery
This is the Gutenberg equivalent of the WP Gallery mode. It will create the gallery using the shortcode block.
You might wonder why isn’t there a Block for Gutenberg Gallery mode. This is because it is impossible to manage/update a block from the server-side. Changes can only be made through the Gutenberg editor, by a human being. This is a poor decision of the WordPress team (they probably didn’t realize this even though I contacted them about it), but that’s the way it is. However, I implemented the Meow Gallery Block differently to make this possible, which is why there is a Block for Meow Gallery mode.
Array in Post Meta
Unfortunately for us, themes (or plugins) often prefer to use their own way of storing data. In that case, they normally use an Array of Media IDs (that represents your collection) in a Post Meta, also known as a Custom Field (more about it here: https://codex.wordpress.org/Custom_Fields). Now, you need to find out what is the name of this custom field.
There are a few ways. The first is to edit your post type (gallery, post or anything else), open the Screen Options at the very top and enable the Custom Fields. This will display the fields (post meta) used by the current post type you are editing. If it’s not displayed, you are out of luck.
It’s better to ask your theme for guidance at this point, and you can tell them the URL of the current page, they will understand your issue. If you want to look by yourself a bit more, you can check your database, more specifically the postmeta table. This is difficult, so I guess you know a minimum about database if you want to do this. In this table, the post_id corresponds to your post type, so you can filter this table by the post you are looking for. You might already see an interesting meta_key. In meta_value, if you have something looking like an array of Media IDs, there is a big chance that it might be it. In the case of the Tripod Theme, I can clearly see that _post_image_gallery is used. That’s it.
Array in Post Meta (Imploded)
Similar to Array in Post Meta except that the data will be stored as a string instead of a pure array. For instance, it is used by Kinetika Theme.
Array of (ID -> FullSize) in Post Meta
Similar to Array in Post Meta but the way data is stored it a bit different. It will not be an array of Media IDs but it will be an indexed array that uses Media IDs as indexes, and the URL to the Media as values. For instance, it is used by Photography Portfolio.
Setting up Post Types
Make sure Post Types is enabled in the WP/LR Sync > Extensions. Then you have access to the WP/LR Sync > Post Types menu. With all the information you got before, you should be able to set up everything accordingly. Start with the Post Type, the Mode, and the Post Meta if required. Save. Then you will be able to link a folder to your taxonomy. Save. Then you are all set. You can try to create a collection in LR. Check if the taxonomy (category or else) is created. In LR, drop an image in it, and Publish. Check your post type in WordPress, the image should have been added.
WP/LR Sync stored all the folders/collections you have created before so you can go in Extensions and click on Resync with Extensions. This will re-create everything. When you switch your theme to another one, you can Reset with Extensions, that will clean your current database from this, switch to the new theme, set everything up again and Resync with Extensions. That’s all, WP/LR Sync keeps all your hierarchy clean and nice on your WordPress.
This is supported by WP/LR Sync 3.x and above. You need to choose custom order in Lightroom and order your photos. If you add a new photo, everything will be re-ordered on the corresponding gallery/collection in WP. If don’t add any photo to add, right-click on any photo in this collection and mark it as to be republished, then publish. This will force LR to trigger the re-ordering.
If you want me to help you with finding the right settings or adding support specific to your theme, it, unfortunately, takes a lot of time. Consider hiring me for this (or, of course, another developer, preferably close to you).