Automatic URL conversion

To add links to table cells, you’ll in general need to manually enter the HTML code for a link (something like <a href="http://www.example.com">My Link</a>) into a cell or use the “Insert Link” button, that will ask you for the URL and the link text and then generates the necessary HTML code for you. This is the recommended way and for most needs it works fine. It also allows for the most flexibility, because you have all freedom to alter or extend that HTML code as you like, e.g. by adding further attributes or a different link text.
Unfortunately it an be a real hassle and a lot of work, if all you want to achieve is, to make URLs you enter “clickable”, i.e. to make them valid HTML links. That can for example be the case when you import a table from a file, because in most cases URLs are not exported as HTML links by a program but simply as the plain URL in text form.

And this is were this Extension kicks in. When a table is shown in a post or page, the Extension will check if there’s an URL (for www, ftp or an email address) somewhere. And if it finds one, it will replace the URL with a complete HTML link to that URL that can be clicked by the visitor. The good thing: If there already was a complete HTML link, it will be left intact.

Here’s an example:
A cell with the content

http://www.example.com

will automatically be converted to a clickable link:

<a href="http://www.example.com">http://www.example.com</a>

To use this, just install and activate the Extension like a regular WordPress plugin and change your table’s Shortcode from something like

[table id=123 /]

to

[table id=123 automatic_url_conversion=true /]

to activate the automatic URL conversion for this table.

Additionally, some people might want to have links open in a new browser window or tab automatically (Note that this is not recommended by web experts, as it takes away the user’s freedom. Personally, I totally agree with them, I hate when a site does this.). If you also want to that, just extend your Shortcode with another parameter, to

[table id=123 automatic_url_conversion=true automatic_url_conversion_new_window=true /]

The automatic_url_conversion_new_window will add the HTML target="_blank" attribute to the link HTML, which tells the browser to open the link in a new window or tab.

If you want links to have the rel="nofollow" attribute set, just add the automatic_url_conversion_rel_nofollow parameter to the Shortcode:

[table id=123 automatic_url_conversion=true automatic_url_conversion_rel_nofollow=true /]

If this Extension is helpful for you, please consider supporting further TablePress development with a donation. Thank you!

Top