12% off of LTD using this coupon: TWELVEPERCENTOFF. Promo ends on 2 Dec midnight UTC.
Published on Mar 5, 2021

Post Info Lightboxes in Oxygen using OxyExtras

Sridhar Katakam

This tutorial provides the steps to set up post content lightboxes in Oxygen using the Lightbox component of OxyExtras.

We shall set up a grid of six recent posts showing the featured image and title for each – which when clicked will show post’s title, excerpt, read more button and the image in a lightbox.

A Repeater component will be used – meaning you can show any data that is attached to posts for example, custom field values.

https://srikat.wistia.com/medias/weyult9wz9?embedType=async&videoFoam=true&videoWidth=640

Step 1

Install and activate OxyExtras.

Tick Lightbox in OxyExtras’ settings to enable the component.

Step 2

Let us register a custom image size for our images.

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: Custom image sizes

Code:

add_image_size( 'latest-post', 320, 210, true );

Set the snippet to run everywhere. Save changes and activate.

Regenerate thumbnails if needed.

Step 3

Manual setup instructions follow. 1-click paste Hydrogen code is provided at the end.

In the Oxygen editor add a Repeater inside a Section.

In this example we shall set the WP Query to this manual query:

post_type=post&posts_per_page=6&no_found_rows=true

Repeater > Grid Layout > Enable Grid.

Tick “Auto-Fit Columns”.

Min Width: 300px
Gap: 60px (for both columns and rows)

Select the Repeater’s Div and add a Div inside. This will be the container for the elements that are shown for each post. You may want to add a featured image and post title.

To specify the custom image size for the image, select one of the default sizes like medium and replace that with latest-post in the generated shortcode.

At Advanced > Custom CSS, add:

cursor: pointer;

To specify that lightbox (to be added next) be opened on clicking this Div, add a class of open-lightbox to this Div.

Select the Repeater’s Div and add a Lightbox component.

Lightbox content: Inline (elements on current page)
Inline content: Display elements inside lightbox

Lightbox styles > Width: 85%

Add a Columns component (60 – 40).

Change the width of left Div to 70% and add post title, excerpt and a button that links to the permalink.

To add the excerpt, add a Text component > double click the text (and delete, if using Safari) > Insert Data button in the top toolbar > PHP Function Return value.

Function Name:
get_the_excerpt

Click INSERT.

In the right column Div, add the featured image.

Save and check on the front end.

If there are no further changes to be done you could set In-builder visibility for the Lightbox to Hidden.

To navigate from one post to another inside the lightbox, set Group into slides to Group.

That’s it!

If you would like to paste the entire Section using Hydrogen Pack or Hydrogen Paste, here’s the code:

eyJzb3VyY2UiOiJodHRwczovL294eWdlbi5sb2NhbCIsImNvbXBvbmVudCI6W3siaWQiOjIsIm5hbWUiOiJjdF9zZWN0aW9uIiwib3B0aW9ucyI6eyJjdF9pZCI6MiwiY3RfcGFyZW50IjoxMDAwMDIsInNlbGVjdG9yIjoic2VjdGlvbi0yLTIiLCJvcmlnaW5hbCI6eyJnbG9iYWxjb25kaXRpb25zIjpbXX19LCJjaGlsZHJlbiI6W3siaWQiOjIxLCJuYW1lIjoiY3RfaGVhZGxpbmUiLCJvcHRpb25zIjp7ImN0X2lkIjoyMSwiY3RfcGFyZW50IjoyLCJzZWxlY3RvciI6ImhlYWRsaW5lLTIxLTIiLCJvcmlnaW5hbCI6eyJmb250LXdlaWdodCI6IjUwMCIsImZvbnQtc2l6ZSI6IjQwIn0sImFjdGl2ZXNlbGVjdG9yIjpmYWxzZSwiY3RfY29udGVudCI6IkxhdGVzdCBQb3N0cyJ9LCJkZXB0aCI6MX0seyJpZCI6MjMsIm5hbWUiOiJveHlfZHluYW1pY19saXN0Iiwib3B0aW9ucyI6eyJjdF9pZCI6MjMsImN0X3BhcmVudCI6Miwic2VsZWN0b3IiOiJfZHluYW1pY19saXN0LTIzLTIiLCJvcmlnaW5hbCI6eyJ1c2VfYWNmX3JlcGVhdGVyIjoiZmFsc2UiLCJhY2ZfcmVwZWF0ZXIiOiJmaWVsZF82MDNkZjAzNDgyMDMzIiwiZGlzcGxheSI6ImdyaWQiLCJncmlkLWNvbHVtbnMtYXV0by1maXQiOiJ0cnVlIiwiZ3JpZC1jb2x1bW4tZ2FwIjoiNjAiLCJncmlkLXJvdy1nYXAiOiI2MCIsIndwX3F1ZXJ5IjoibWFudWFsIiwicXVlcnlfcG9zdF90eXBlcyI6W10sInF1ZXJ5X2FyZ3MiOiJwb3N0X3R5cGU9cG9zdCZwb3N0c19wZXJfcGFnZ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