You would like WP/LR Sync to automatically create pages/posts for you with your collections/galleries (check Sync with Pages or Posts). Or you installed a beautiful photography theme and you would like to synchronize your folders and collections in Lightroom to it (go to Sync with a Photography Theme). The Post Types extension should be able to help you do this right away. Note that you can ask the developers of your theme to look at the current page and they should be able to help you.
This tutorial contains 3 parts :
- Sync with Pages or Posts
- Sync with a Photography Theme
- Ordering images (within a collection)
Another piece of advice. Go for a simple gallery system, not a gallery system with too many options, you will probably always regret it (even though it might look interesting at the beginning). You will never be able to move away from it. Whatever gallery system you are using, make sure it uses the standard WP Gallery made naturally by WordPress. I also made a gallery system that is called Meow Gallery that works this way, clean and simple.
1. Sync with Pages or Posts
The theory is very simple, and you need to get the Post Types extension as shown below. You can pick either Post or Pages, but Pages are more “static”, as Posts are for news, blogging, etc. This is a usual configuration.
Then, on Lightroom, you can start creating folders and collections, they will be also created on your WordPress accordingly.
Important note: don’t forget about Smart Collections in Lightroom 🙂 Many photographers want to make a website with one page for the latest photos, and pages that show photos based on specific tags/keywords, locations, or else. You just need to create a Smart Collection in Lightroom and it will be sync to your WordPress.
2. Sync with a Photography Theme
You need to know how your theme operates. There are 3 mains things you should know: the post type, the taxonomy and how the data, about your collection of images, is stored. Note that the taxonomy is not optional.
There is also 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
The most important thing to know is to which post type in WordPress you need and want to link your collections in Lightroom. In WordPress, the default post types are the Posts and Pages. If you see any Galleries, Portfolios, Albums or anything similar, they have been added by your theme or a plugin.
For example, by installing the Tripod theme (CosmoThemes), I can notice that this Galleries menu was created. This is a post type. By clicking on Galleries, I can see that the URL is /wp-admin/edit.php?post_type=gallery. The real name of this post type is therefore gallery.
Above, we can also see Category and Tags. Those are taxonomies. It’s up to you to use this or not, this is not mandatory, but if you use folders for your collections in Lightroom, you might want to use those taxonomies as your folders. Here, Category makes more sense. By clicking it, you can see that the URL is /wp-admin/edit-tags.php?taxonomy=gallery-category&post_type=gallery. You got your taxonomy! It is gallery-category.
At this point, it is important to note that you could simply use your Posts are your post type (post) and Categories (category) as your taxonomy.
How is it stored?
You need to find out how the collections of images are stored by your WordPress. This part is a bit technical, so you can try to find it, you can hire me to do it for you (it is part of the Support for WP/LR Sync) or ask your developer. As of today, the Post Types extension can handle four methods: WP Gallery, Array in Post Meta, Array in Post Meta (Imploded) and Array of (ID -> FullSize) in Post Meta.
1. WP Gallery
In the standard Posts, you probably noticed that you can create/insert a gallery. It’s simple and works very well. This is a WP Gallery. Many themes are using this. Here is an example of how a WP Gallery looks in the editor.
In my opinion, this is the cleanest way to create galleries in WordPress because it is standard and will always work. Anytime you like, you can change your theme and the galleries will look different, but the way they are created and handled (technically-speaking) are the same.
2. Array in Post Meta
Sometimes, it happens that themes (or plugins) 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.
For this, 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.
For instance, it is used by the Tripod Theme.
3. 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.
4. 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 in 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 is 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.
3. Ordering images
This is supported by WP/LR Sync 3.x and above. You need to choose custom order in LR, 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).