Do you have a WordPress website to share knowledge, documentation, product information files, portfolios, etc.? It’s convenient to allow visitors to have two options: read the preview or download the PDF file. Therefore, creating download and preview buttons on an e-book page can be a useful topic for you. Today, let’s do it using Meta Box and Kadence.
Take a look through the e-book page with two buttons that I created as an example:
Video Version
Before Getting Started
The archive page shows detailed information about the books along with two buttons. The Download button is to save the PDF file to your device. And, the Preview button allows you to view it online.
Each e-book will be a post of a custom post type. The basic information of the e-book such as image, name, and description are respectively featured images, title, and description of the post. To store the PDF file, we'll use a custom field provided by Meta Box.
So, to get started, we need the Meta Box core plugin to have the framework for creating the custom post type and custom fields. You can download it directly from wordpress.org.
Besides, we’ll need some Meta Box extensions for the advanced features:
- MB Custom Post Type: to create a custom post type for the e-book;
- Meta Box Builder: to have a UI on the back end to create a custom field for storing the PDF files.
You can install them individually or use Meta Box AIO to have them all.
And, the last one is the pro version of Kadence with some extra types of blocks to build the page.
Create a Custom Post Type
Go to Meta Box > Post Types > Add New to create a new one for the e-book.
After publishing, the created custom post type will be displayed in the admin dashboard.
Create Custom Fields
Go to Meta Box > Custom Fields to create a new field group as usual.
In this practice, I’ll create only one custom field to store the PDF file for the e-book. So, add the File Advanced field.
I keep this field as default without special settings. In the real case, you may want to have some advanced settings for this field or add more custom fields for extra information. But I skip them to make this practice simpler.
After that, move to the Settings tab. Then, set the Location as Post type, and select E-book to apply the field to this post type.
Go to the post editor, you will see the created custom field.
Just fill in the information. And, click on the + Add Media button to upload a file.
These are some posts I’ve added.
Display E-books on the Archive Page
As I mentioned, e-books will be displayed on the archive page. So, we need to create the page first.
Go to Pages > Add New to create a new one as usual.
Next, we will get and display e-books on this page.
We have multiple e-books, so I’ll create a query loop to get them all. To do it, add the Advanced Query Loop block. It is provided by Kadence.
In the Post Types option, choose the post type we used for the e-books.
There are some default layouts you can choose for the e-book. Choose one of them.
After that, all of the e-books are displayed with the chosen layout.
You can adjust it as you want.
Next, we will add the download and preview buttons for each e-book into this query loop.
First, for the download button, add an Advanced Buttons block.
Then, add a label for the button.
To connect the button to the PDF file, click on the Link icon to add a dynamic link to the button.
The documentation file was saved in the custom field created with Meta Box. So, set the Link as Post Custom Field.
At the same time, select the field that we used to store the PDF file.
To set the download function for this button, open the Advanced section of the button, and enable the Download option.
That’s done.
For the preview button, do the same.
Also use the Advanced Buttons block to add the preview button.
Set the dynamic link for it as the field we used.
However, after that, there is no need to add advanced settings to the button since previewing the attached file is the default function of the button. It means that when visitors click on it, the uploaded file will be shown automatically.
Then, go to the page on the front end, you will see the buttons work well.
Next, it seems like we should style the page a little bit to have a better appearance.
Style the Page
Back to the page editor with Kadence. Just change some parameters and settings in the Style and Advanced tab on the right sidebar of each block.
Then, we will have the page with a better look.
Last Words
As you can see, with the help of Meta Box and Kadence, adding download and preview buttons to your website is quite easy. If you use other page builders or just use Meta Box, you can refer to others posts in this series.
In the case that you just want to display the download button on your site, the article on creating a download button using custom fields can be helpful for you.
Enjoy them and share your application with us. As well as, keep track of our blog for more exciting tutorials. Thanks for reading!
- How to Create Download and Preview Buttons - P1 - Using Meta Box and Bricks
- How to Create Download and Preview Buttons - P2 - Using Meta Box and Oxygen
- How to Create Download and Preview Buttons - P3 - Using MB Views
- How to Create Download and Preview Buttons - P4 - Using Meta Box and Kadence
Other case studies you might be interested in
- Create A Dynamic Landing Page in WordPress Using Custom Field
- Create a Filter to Find Hotels by Location
- Create an OTA Website Like Booking.com with Meta Box Plugin - P1: Create a Page to Introduce Hotel Rooms
- Create an OTA Website Like Booking.com with Meta Box Plugin - P2: Create Filters on the Archive Page
- Create an OTA Website Like Booking.com with Meta Box Plugin - P3: Create Filters for Single Hotel Pages
- Create Dynamic Favicon in WordPress using Meta Box plugin
- Create Posts Series in WordPress Using Meta Box
- Display The Latest Products Section - P2 - Using Meta Box and Elementor
- Display The Latest Products Section - P3 - Using Meta Box And Oxygen
- How to Add Custom Fields for WooCommerce - P2 - Using MB Views
- How to Add Custom Fields to Display Banners using Meta Box Plugin
- How to Add Guest Authors and Guest Posts - Using Meta Box
- How to Add Related Posts - Using Custom Fields
- How to Build a Hotel Booking Website Using Meta Box - P1
- How to Build a Hotel Booking Website Using Meta Box - P2 - Booking Page in Backend
- How to Build a Hotel Booking Website Using Meta Box - P4 - Booking Management Page
- How to Build a Hotel Booking Website Using Meta Box – P3 – Booking Page for Customer
- How to Create a Classified Ads Website using Meta Box
- How to Create a Custom 404 Page in WordPress - P1 - Using Meta Box and Elementor
- How to create a FAQs page - P5 - Using Meta Box and Breakdance
- How to Create a Product Page - P2 - Using Meta Box and Oxygen
- How to Create a Product Page - P3 - Using Meta Box and Bricks
- How to Create a Product Page - P4 - Using Meta Box and Elementor
- How to Create a Product Page - P5 - Using Meta Box and Gutenberg
- How to Create a Product Page - P6 -Using Meta Box and Breakdance
- How to Create a Product Page - P7 - Using Meta Box + Kadence
- How to Create a Product Page - P8 - Using Meta Box and Brizy
- How to Create a Product Page - P9 - Using Meta Box and Divi
- How to Create a Product Page using Meta Box Plugin
- How to Create a Reading Progress Bar in WordPress Posts - P1 - Using MB Views
- How to Create a Recipe - P2 - Using Meta Box and Oxygen
- How to Create a Recipe - P3 - Using Meta Box and Elementor
- How to Create a Recipe - P4 - Using Meta Box and Bricks
- How to Create a Recipe - P5 - Using Meta Box and Zion
- How to Create a Recipe - P6 - Using Meta Box and Brizy
- How to Create a Recipe - P7 - Using Meta Box and Breakdance
- How to Create a Recipe - P8 - Using Meta Box and Kadence
- How to Create a Recipe - P9 - Using Meta Box and Divi
- How to Create a Recipe with Meta Box Plugin
- How to Create a Simple Listing - P2 - Using Meta Box and Bricks
- How to Create a Simple Listing - P3 - Using Meta Box and Breakdance
- How to Create a Simple Listing - P4 - Using Meta Box and Elementor
- How to Create a Simple Listing - P5 - Using Meta Box and Kadence
- How to Create a Team Members Page - P1- Using Meta Box and Elementor
- How to Create a Team Members Page - P2 - Using Meta Box and Oxygen
- How to Create a Team Members Page - P3 - Using Meta Box and Bricks
- How to Create a Team Members Page - P4 - Just Meta Box
- How to Create a Team Members Page - P6 - using Meta Box and Breakdance
- How to Create a Team Members Page - P7 - Using Meta Box and Kadence
- How to Create a Video Gallery Page - P2 - Using Meta Box + Bricks
- How to Create a Video Gallery Page - P3 - Using Meta Box and Breakdance
- How to Create a Video Gallery Page - P4 - Using Meta Box + Elementor
- How to Create a Video Gallery Page - P5 - Using MB Views
- How to Create a Video Gallery Page - P6 - Using Meta Box and Zion
- How to Create a Video Gallery Page - P7 - Using Meta Box and Kadence
- How to Create a Video Gallery Page Using Meta Box + Oxygen
- How to Create ACF Flexible Content Field with Meta Box
- How to Create an Auto-Updated Cheat Sheet in WordPress
- How to Create an FAQs Page - P1 - Using Meta Box and Elementor
- How to create an FAQs page - P2 - Using Meta Box and Oxygen
- How to create an FAQs page - P4 - Using Meta Box and Bricks
- How to Create an FAQs Page - P6 - Using MB Views
- How to Create an FAQs Page - P7 - Using Meta Box and Divi
- How to Create an FAQs Page - P8 - Using Meta Box and Kadence
- How to Create an FAQs Page - P9 - Using MB Blocks
- How to Create an FAQs Page -P3- Using Meta Box
- How to Create Buttons with Dynamic Link using Custom Fields
- How to Create Category Thumbnails & Featured Images Using Custom Fields
- How to Create Download and Preview Buttons - P1 - Using Meta Box and Bricks
- How to Create Download and Preview Buttons - P2 - Using Meta Box and Oxygen
- How to Create Download and Preview Buttons - P3 - Using MB Views
- How to Create Download and Preview Buttons - P4 - Using Meta Box and Kadence
- How to Create Download Buttons in WordPress - Using Custom Fields
- How to Create Dynamic Landing Page in WordPress - P1 - Using Meta Box and Elementor
- How to Create Dynamic Landing Page in WordPress - P2 - Using Meta Box and Bricks
- How to Create Menus for Restaurants - P1 - Using Meta Box and Elementor
- How to Create Menus for Restaurants - P2- Using Meta Box and Bricks
- How to Create Notification Using Custom HTML Field
- How to Create Online Admission Form for School or University
- How to Create Online Reservation Form for Restaurants using Meta Box
- How to Create Reading Time to Your WordPress Posts - Using MB Views
- How to Create Relationships - P1 - Using Meta Box and Oxygen
- How to Create Relationships - P2 - Using Meta Box and Bricks
- How to Create Relationships - P3 - Using MB Views
- How to Create Relationships - P4 - Using Meta Box and Breakdance
- How to Create Taxonomy Thumbnails & Featured Images - P2 - Using Meta Box and Oxygen
- How to Create Taxonomy Thumbnails & Featured Images - P3 - Using Meta Box and Bricks
- How to Create Taxonomy Thumbnails & Featured Images - P4 - Using MB Views
- How to Create YouTube Video Timestamps on WordPress Website - P1 - Using MB Views
- How to Display a Video Playlist - P1- Using MB Views
- How To Display All Listings On A Map With Meta Box
- How to Display Author Bio in WordPress - P1 - Using Meta Box and Bricks
- How to Display Author Bio in WordPress - P2 - Using MB Views
- How to Display Dynamic Banners in WordPress - P3 - Using MB Views
- How to Display Images from Cloneable Fields - P1 - with Gutenberg
- How to Display Images from Cloneable Fields - P2 - Using Meta Box and Oxygen
- How to Display Images from Cloneable Fields - P3 - with Elementor
- How to Display Images from Cloneable Fields - P4 - with Bricks
- How to Display Opening Hours for Restaurants - P1 - Using Meta Box + Gutenberg