Plugin:
Tutorial:
This tutorial will guide you on how to create a WordPress gallery from an XML file using the Wonder Gallery plugin.
Step 1 - Create an XML file
Using XML allows you to define a playlist of images and videos directly from URLs. For example, if your image and video files are hosted on Amazon S3, you can use an XML file to define the image and video URLs and display them in the gallery.
An XML file is simply a text file that can be edited using a text editor or an XML editor, such as Microsoft's free and open-source XML Notepad.
The format of the XML file for the Wonder Gallery plugin is as follows:
<playlist> <slide> <file>https://www.wonderplugin.com/xmlgallery/Zebra.jpg</file> <thumbnail>https://www.wonderplugin.com/xmlgallery/Zebra.jpg</thumbnail> <title>Zebra</title> <alt>Zebra</alt> <description>Zebra</description> <link><![CDATA[https://www.wonderplugin.com]]></link> <linktarget>_blank</linktarget> </slide> <slide> <file>https://www.wonderplugin.com/xmlgallery/Carousel.mp4</file> <thumbnail>https://www.wonderplugin.com/xmlgallery/Carousel-poster.jpg</thumbnail> <title>Wonder Carousel</title> <alt>Wonder Carousel</alt> <description>Wonder Carousel Video</description> </slide> <slide> <file>https://www.youtube.com/embed/c9-gOVGjHvQ</file> <thumbnail>https://img.youtube.com/vi/c9-gOVGjHvQ/0.jpg</thumbnail> <title>YouTube</title> <alt>YouTube Video</alt> <description>YouTube Video</description> </slide> </playlist>
The above XML adds three items to the gallery: one image, one MP4 video, and one YouTube video. The available XML keys are as follows:
Key | Description |
---|---|
file | The image or video URL |
thumbnail | The thumbnail image URL |
title | The title text |
description | The description text |
alt | The alt text |
link | The URL address of the link. Since there are special characters in a URL address, you need to use <![CDATA[ and ]]> to wrap it. |
linktarget | The target of the web link. The value _blank will open the weblink in a new tab or page. |
Step 2 - Upload the XML file to your web server and add the XML file to the plugin
After you have created the XML file, upload it to your web server using FTP or another method, and get the URL address.
Please note that while the images and videos can be hosted on a third-party website, the XML file must be uploaded to your own WordPress website.
You can open the XML file URL in your web browser to ensure the URL is working and the XML output is correct.
Once you have confirmed that the URL is correct, in the Wonder Gallery plugin, edit an existing gallery or create a new one. Navigate to Step 3 Options tab, then to the Advanced Options tab, and add the following code into the Data Options input box:
data-xml="https://www.wonderplugin.com/xmlgallery/wondergallery.xml"
Please make sure to replace the XML URL with your own. And as mentioned above, the XML file must be uploaded to your own WordPress website.
An online demo created with the above XML file is as follows: