Adding a button column to the posts table
How to add a button linking to the single post page
To create a button column, add
button to the columns option, either on the plugin settings page or directly in the shortcode. For example:
This will automatically add a button for each post, linking to the single post page.
How to change the button text
The text for the button defaults to "Show details". You can change the text for the button on the plugin settings page, or directly in the shortcode using the
button_text option. For example:
[posts_table columns="title,content,button" button_text="Download"]
How to link the button to other URL's and file downloads
If you don't want people to be able to access the single post page - for example because you are listing downloadable documents in the table - then you can use the free Page Links To plugin to override these links.
This allows you to add a URL which the user will be taken to when they click on a link to the post (including the buttons in Posts Table Pro). For example, if you have uploaded a document to your WordPress Media Library then you can add its URL to the post using Page Links To. When someone clicks on the post title or the button in the table, then they will download the file instead of accessing the single post page.
Can I add other types of button?
It's also possible to add other types of link or button to the product table. For example, you might want to add icons linking to downloadable files, or a button linking to an enquiry form.
You can achieve this by adding the buttons within a custom field and displaying it in the table. Please see our article about how to do this.