How to get a quote-sign (') in a theme php-function (5 posts)

  1. Yost
    Posted 9 years ago #

    Hello, I am trying to translate the WordPress default theme into Dutch. For this, I need to translate the "Pages" header in the side bar to "Pagina's". Did you notice the quote sign before the "s" in this word? That is what I cannot get right.

    The code from the theme looks like:
    <?php wp_list_pages('title_li=<h2>Pagina\'s</h2>' ); ?>

    I am not accustomed to php, but in C I would escape the quote sign (\') to get it displayed. In this case the final output is just what is typed in the code: "Pagina\'s". And that is not what I want. If I remove the "\", I get a syntax error on the side bar. I also tried html &-character codes, but this is also not properly processed.

    Any help will be appreciated.

  2. David Yeiser
    Posted 9 years ago #

    Try using double quotes instead of single quotes, although I can't remember if this works or not. Let me know if it does.

    <?php wp_list_pages("title_li=<h2>Pagina\'s</h2>"); ?>
  3. David Yeiser
    Posted 9 years ago #

    But without the \', just '

  4. Yost
    Posted 9 years ago #

    Sorry, the suggestions above do not work.

    <?php wp_list_pages("title_li=<h2>Pagina\'s</h2>" ); ?> produces "Pagina\\\'s".

    <?php wp_list_pages("title_li=<h2>Pagina's</h2>" ); ?> produces "Pagina\'s".

    Without the "s, of course

  5. Yost
    Posted 9 years ago #

    Just a little kick to get this item back "on top". I still have no clue to how to solve this problem.

    \' does not do the trick. A simple ' gives a syntax error. ampersand#39; or \ampersand#39; does not work (I mean the ampersand sign, but if I use that in this post, I wouldn't show). Mixing single a double quotes has an effect, but not the effect I want.

Topic Closed

This topic has been closed to new replies.

About this Topic