I've got the following code (this is WordPress function) (example of wrong structure):
<?php paginate_comments_links('prev_text=← Older&next_text=Newer →'); ?>
Example of correct structure:
<?php paginate_comments_links('prev_text=Older&next_text=Newer'); ?>
As you can see I'm trying to add preceding arrow + space (←
) to 'Older' word and space + arrow ( →
) to 'Newer' word. The problem is that there is a conflict between & that separates 2 function arguments and & that is the beginning of HTML character.
How should correct structure look like?
In order to pass a parameter with ampersands (&), you need to encode it.
use
urlencode()
Source : http://php.net/manual/en/function.urlencode.php
To decode it afterward, use:
urldecode()
Source : http://php.net/manual/en/function.urldecode.php