Can I add links, downloads, icons or buttons in Posts Table Pro?
You can use Posts Table Pro to display custom links in the table – either as clickable text or as buttons, icons or images. These links can link to any URL, for example another page on your site, an external URL or a link to download a file (such as a PDF) in the Media Library.
You can add links to any text-based fields that you’re displaying such as the content, excerpt or custom fields.
Please note – links from the ID, title, image, categories, tags or any taxonomy columns are created automatically by the plugin, and controlled via the links option.
Links in the content or excerpt columns
Links and other HTML in the main content are normally removed by Posts Table Pro. This is because the content is truncated using the
content_length option. If the HTML wasn’t removed, the content could be split incorrectly and missing the necessary closing HTML tags such as
To preserve the HTML formatting, including links, you would need to set the content to display in full. You do this by setting
content_length=-1 in your shortcode, or in the plugin settings.
The same applies to the excerpt column. If you wish to display links within the excerpt, you will need to set the
Links in custom fields
Step 1: Create a custom field for storing the links
First, you need to create the custom field that you will use to add the links. You will then display this as a column in the table using Posts Table Pro.
Posts Table Pro works with any custom fields plugin. We particularly recommend Advanced Custom Fields (free). By using a custom fields plugin, you can create more advanced links without writing any HTML code.
Use your chosen custom fields plugin to create a Visual Editor (WYSIWYG) custom field. Use this field to add the links that you wish to display in Posts Table Pro. Use the ‘Insert/edit link’ toolbar button to hyperlink the text.
In the following example, we have added the following links to a post:
- ‘Button’ custom field (this is a ‘Visual Editor’ custom field type) – This field contains 2 links: A normal link with the anchor text “This is a normal text link”, and a shortcode created using the free Better Font Awesome plugin which allowed us to insert an icon and make it clickable.
- ‘Text’ custom field (this is a ‘Text’ custom field type) – This field contains a URL – https://barn2.co.uk – which will appear as a clickable link in Posts Table Pro.
Step 2: Add the custom field as a column in the table
To display your custom field, you need to add this to the columns option. Do this in the plugin settings page (Settings → Posts Table Pro), or in your shortcode. The column name will be
cf: followed by the custom field you just added. In our example above, the custom field name was
button, so our column name would be
cf:button. In the shortcode this would be:
Please see the columns article for more information on adding custom fields to your table.
How to add clickable buttons, icons, and other types of link
The following video tutorial shows some examples of creating custom links, adding buttons and icons and displaying them in your posts table. You can see an example of how this might look in our WordPress document library demo.
If you want to create a button or icon, use a custom field to store the code or shortcode for your button/icon. The exact method for adding the button or icon will depend on your theme.
For example, your theme may provide a shortcode for buttons or icons. If you don’t know how to do this, ask your theme developer. If your theme doesn’t have the styles you need, you can use a plugin such as Shortcodes Ultimate to create buttons, or Better Font Awesome to create icons.
Note: If you are adding shortcodes to any of the columns displayed in Posts Table Pro, then you must enable the shortcodes option. This tells Posts Table Pro to display them correctly.
If you’re adding shortcodes then you will also need to go to the Posts Table Pro settings page (Settings → Posts Table Pro) and tick the ‘Shortcodes’ option. This tells Posts Table Pro to display the links as clickable links instead of plain text.
Can I link the title column to an external URL or document download?
Yes! You can do this by using Posts Table Pro with the free Page Links To WordPress plugin. This plugin lets you add a URL to any page, post or custom post (e.g. to a PDF in your Media Library or a page on an external website). When someone clicks on a link to view the page/post/custom post, they will be taken to this URL instead.
For example, a lot of Posts Table Pro users find this helpful when creating a WordPress document library with downloadable document links in the table.