Metallex Theme modifies links after saving them

admin2025-06-03  4

The Problem

The theme I'm using allows one, in its options, to enter some contact info to be put in the header. The demo content has an empty link like this: <a href="#">Random Shit</a>.

What I'm trying to do is to put a mailto in it, such as:

<a href= "mailto:[email protected]">[email protected]</a>

but the theme adds double quotes around href's content corrupts it to something like this in the front-end:

<a href=""mailto:[email protected]"">[email protected]</a>

So when a user clicks it, they're redirected to example/currentpage/"mailto:[email protected]"

Possible solutions:

  1. Look for the code that handles the options (takes too long, the code is badly written)
  2. ?

If you have stumbled upon a similar problem please share your experience, whether you found the solution or not.

The Problem

The theme I'm using allows one, in its options, to enter some contact info to be put in the header. The demo content has an empty link like this: <a href="#">Random Shit</a>.

What I'm trying to do is to put a mailto in it, such as:

<a href= "mailto:[email protected]">[email protected]</a>

but the theme adds double quotes around href's content corrupts it to something like this in the front-end:

<a href=""mailto:[email protected]"">[email protected]</a>

So when a user clicks it, they're redirected to example/currentpage/"mailto:[email protected]"

Possible solutions:

  1. Look for the code that handles the options (takes too long, the code is badly written)
  2. ?

If you have stumbled upon a similar problem please share your experience, whether you found the solution or not.

Share Improve this question asked Jan 29, 2019 at 15:59 Salim MahboubiSalim Mahboubi 1012 bronze badges 3
  • there are 2 other options... Ask the theme developer to address this issue OR change themes – rudtek Commented Jan 29, 2019 at 16:11
  • Those were the two options I considered first, but sadly, the theme developer asks for access to our website's administration and I can't do that. And management won't approve of changing themes because it looks good, and we don't have time to work on another one. Thanks @rudtek – Salim Mahboubi Commented Jan 29, 2019 at 16:15
  • Fair enough, but I would stress to your management that this type of error in coding could very well be indicative of further problems and will cost more in the long run. – rudtek Commented Jan 29, 2019 at 16:22
Add a comment  | 

1 Answer 1

Reset to default 0

Just after posting the question I tried to remove the quotes from the href in the theme options and it worked.

<a href=mailto:[email protected]>[email protected]</a>

Another solution I considered was to use .htaccess redirects in a way such it redirects to whaterver the theme decided to point to a mailto:

Redirect 301 /[path-to-wherever-metallex-points-to] mailto:[email protected] -solution 2 source-

So if you find yourself in a similar situation, you have the choice between two solutions.

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1748964705a315212.html

最新回复(0)