htmlwordpressescapingfont-awesomehref

Font-awesome and hyperlinks in tables


I've added the Font-Awesome plugin to my Wordpress site.

The desired behaviour is to have a table where there is a column of links to home pages, represented by the FA "home" icon.

Each icon would be a link to the home page of the business in the row, with no additional text.

I have the plugin installed, so the house icon is generated by the [icon="house"] shortcode.

In the table, WP is parsing the hyperlink as text, not as a link, giving me this result:

enter image description here

The desired outcome is just the icon of the house, linking to https://example.com.

Can this be achieved with font-awesome icons and a URL link in a table in WordPress?


Solution

  • It is weird that the house's HTML is rendered where as the link tags are escaped. Something escapes the text it echo. This makes html appear as text. Instead, enter the html directly: <a href="something"><span class="fa fa-home"></span></a>

    Or possibly : <a href="something"><i class="fa-solid fa-house"></i></a> depending on the version of Font Awesome that is used. You can view the source of page to get a hint.

    Or I think that the best is to use this code: <a href="something">[icon="house"]</a> if you can inject some HTML into the table.