1. Making the CPT
I used to use wp-hasty, but after ACF added the feature, I’ve found myself just using ACF for it.
A couple of things to keep in mind, if you’re going to have an archive page, make sure you allow it in the ACF settings.
Also, “hierarchical” means they work like pages (because pages have child pages) and since you’d usually be looking at CPTs that work like blog posts, non-hierarchical is what you’d be looking for.
Lastly, if you need them to work with categories and/or tags, remember: hierarchical taxonomy means like categories, and non-hierarchical taxonomy means like tags.
2. Add the fields
Assign the ACF field group to the CPT posts. Of course, you can use ACF image fields for the ones that display in the lightbox. I only used the featured image because that’s the WP default, and I tend to stick with them when it’s an easy choice.
3. Make the global block
This is where things become fun.
The global block will need to be wrapped with a link wrapper. If you forgot to start with a link wrapper, you can always add it later with a right click > wrap in

BaguetteBox.js looks at the children of the selector in an anchor tag (<a>
) that uses an image in the href attribute and lightboxes them. So you’ll need to set it up to have the image in the link reference.
You can add titles and text inside it, but since it’s not good to have links inside links, don’t link the titles to anything.
Extra note: In the global block, you don’t need to set up the image to be full size, but since the lightbox will need to show the full image, just make sure the link wrapper is linked to the full image, and the image element inside the card is just a smaller version (for better loads).

If you’d like a way for the user to view the content of the CPT on a single post page, add a button outside the link wrapper and link the button to the post permalink.

The lightbox script uses data attributes to populate the text in the caption, so if you want the captions to have all/some ACF fields displaying in the lightbox, you can add them by going to the link wrapper element > advanced > attributes. The name is ‘data-‘ and the content will need to be populated by the Breakdance ACF shortcodes.
Note: this is a Breakdance 2.3 feature, so you need to make sure you’re updated
To get the shortcodes, you can assign the field, then click on the field name to open the advanced window. There’s a little clipboard icon near the upper right corner.

Click on that to copy the shortcode into the clipboard.
Then paste it into a text editor so you can get it to look the way you need it. Here’s what it will look like when you build the content in a text editor.

Now that will all go into the caption attribute (in this case).

Quick tip: You can use ACF’s export tool to get the full list of field keys. This can be helpful when working with multiple fields.
4. Adding the js and css
We can add the js and css easily via cdn. The git has a couple of cdn links, and you can go there and get the links. Of course, if you’re using this method, you can click on the copy code button from the code section (in the right sidebar)
Alternately, you can download the zip file of the git and upload it into the plugin directly so it’s all onsite.
5. Making the loop
Let’s use the post loop builder element to make a quick banner grid of the CPT. Useful for things like ‘recent posts’ and whatnot.
Load up the post loop builder, adjust the query to show what you need.
Now for the last and most important part of the whole loop building process.
We need to add the code to make the js+css load and to get it to work with the loop we just created. In order to do that, we’re going to add a custom class to the loop builder element.
The git just uses .gallery
which works for webpages you code yourself from scratch because there aren’t any other selectors floating around, but when we’re building on WordPress, it’s always a good idea to prefix it.

The sample code provided has the prefix mn because of my agency MajorNeon, but you can/should change it to fit your brand. Just make sure the classes match between the one in the code and the one you add to the post loop element.
So ultimately, it will look like .your-class-gallery .ee-posts
(don’t forget the space, and don’t forget to make the ee-post plural) inside the JavaScript you’re adding.
Once you do that, just drop the code in a code block next to the post loop builder element and you are done! (Of course you can add things globally, but that’s only for when you really want to have the lightbox thingie on every page)
Additional notes
The client ended up not wanting the lightbox any more because they made some changes to the content, but I got to make a nice tutorial out of it, and it’s great for portfolio pieces and other similar approaches to showcasing content.
So there you have it. I hope this helped and I hope it have you some cool ideas and a great new feature of breakdance 2.3. I have a lot of cool projects coming up, so please stay tuned, like and subscribe and I’ll see you in another video.