php_e in 404.php (3 posts)

  1. bobrock4
    Posted 2 years ago #

    I would like to put a link to the home page in 404 page.

    I have tried to change this code

    <section class="entry-content">
    <p><?php _e("Text to explain where to go", "bonestheme"); ?></p>

    Inserting html code in this way

    <section class="entry-content">
    <p><?php _e("Text to explain where <a href="http://www.domain.com">to go</a>", "bonestheme"); ?></p></section>

    It seems it doesn't take html code in this function.

    How could I to insert a link there?

    Thanks and ciao

  2. Mark Senff
    Posted 2 years ago #

    It's because you're using double quotes in a string that's encapsulated in double quotes already. Use single quotes in the text, like this:

    <p><?php _e('Text to explain where <a href="http://www.domain.com">to go</a>', 'bonestheme'); ?></p>

    Or the other way around:

    <p><?php _e("Text to explain where <a href='http://www.domain.com'>to go</a>", "bonestheme"); ?></p>

    Or escape characters:

    <p><?php _e("Text to explain where <a href=\"http://www.domain.com\">to go</a>", "bonestheme"); ?></p>
  3. bobrock4
    Posted 2 years ago #

    Many thanks Senff. It works now! :-)

    Do you also know how to change language to this search box in the same 404.php page? It's in English while all my pages are in my language

    <section class="search">
    <p><?php get_search_form(); ?></p>


Topic Closed

This topic has been closed to new replies.

About this Topic