• I sincerely apologize for this post but I couldn’t find a solution for it.

    I created a Theme that I use for a couple of WordPress sites. In all but one, the language is set for Enlish. Spanish is the lonely one. What I want to do is:

                if (current langguage is 'es') {
                  echo '---haz algo---'
                } else {
                  echo '---do something---'
                }
              ?>

    [Moderator note: code fixed. Please wrap code in the backtick character or use the code button.]

    Any help appreciated. Thanks!

    • This topic was modified 7 years, 6 months ago by bdbrown.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    The function get_locale will tell you what WP knows about the locale.

    https://codex.www.ads-software.com/Function_Reference/get_locale

    Thread Starter mrcangrejero

    (@mrcangrejero)

    Thanks, Steve. Sorry I took so long to apologize.

    UI changed my code to the following:

                        <?php>
                        if ( is_page_template( 'page-templates/page-blog.php' ) ) {
                            <h4>Blog</h4>
                        } elseif ( is_page_template( 'page-templates/page-news.php' ) ) {
                            <h4>Blog</h4>
                        } else {
                        <h4><?php the_title(); ?></h4>
                        }
                        ?>

    However, my site freezes when I use it. Maybe you can help me with that. I’d appreciate it very much. The best to you and yours!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display Some Content Based On Site Language’ is closed to new replies.