Support » Fixing WordPress » php_e in 404.php

  • 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="">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

Viewing 2 replies - 1 through 2 (of 2 total)
  • 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="">to go</a>', 'bonestheme'); ?></p>

    Or the other way around:

    <p><?php _e("Text to explain where <a href=''>to go</a>", "bonestheme"); ?></p>

    Or escape characters:

    <p><?php _e("Text to explain where <a href=\"\">to go</a>", "bonestheme"); ?></p>

    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>


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘php_e in 404.php’ is closed to new replies.