$conf, $runtime; function_exists('chdir') AND chdir(APP_PATH); $r = 'mysql' == $conf['cache']['type'] ? website_set('runtime', $runtime) : cache_set('runtime', $runtime); } function runtime_truncate() { global $conf; 'mysql' == $conf['cache']['type'] ? website_set('runtime', '') : cache_delete('runtime'); } register_shutdown_function('runtime_save'); ?>Metallex Theme modifies links after saving them|Programmer puzzle solving
最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

Metallex Theme modifies links after saving them

matteradmin9PV0评论

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.

Articles related to this article

Post a comment

comment list (0)

  1. No comments so far