Reputation: 55293
This is the code:
<?php if ( $current_language == es-ES ) : ?>
<?php next_post_link( '%link', 'Proyecto Siguiente ' . _x( '', 'next post link', 'twentyten' ) . '' ); ?>
<?php elseif($current_language == zh-TW) : ?>
<?php next_post_link( '%link', '下一個項目 ' . _x( '', 'next post link', 'twentyten' ) . '' ); ?>
<?php elseif($current_language == zh-CN) : ?>
<?php next_post_link( '%link', '下一个项目 ' . _x( '', 'next post link', 'twentyten' ) . '' ); ?>
<?php else : ?>
<?php next_post_link( '%link', 'Next Project ' . _x( '', 'next post link', 'twentyten' ) . '' ); ?>
<?php endif; ?>
For some reason, I'm still getting 'Proyecto Siguiente" even if the lang is set to zh-TW (Chinese Traditional).
Any suggestion?
Upvotes: 1
Views: 73
Reputation: 10645
Why do you use all those php open/close tags? Why don't you use quotes around strings? anyway this is your code cleaned up and it should work:
<?php
if ( $current_language == 'es-ES' ) {
next_post_link( '%link', 'Proyecto Siguiente ' . _x( '', 'next post link', 'twentyten' ) . '' );
} elseif( $current_language == 'zh-TW' ) {
next_post_link( '%link', '下一個項目 ' . _x( '', 'next post link', 'twentyten' ) . '' );
} elseif( $current_language == 'zh-CN' ) {
next_post_link( '%link', '下一个项目 ' . _x( '', 'next post link', 'twentyten' ) . '' );
} else {
next_post_link( '%link', 'Next Project ' . _x( '', 'next post link', 'twentyten' ) . '' );
}
?>
Upvotes: 0
Reputation: 342675
You are not quoting the strings agains which you are comparing, so PHP is taking them to be constants (which do not exist). It will still work because PHP first looks for a constant named es-ES and will throw an error of level E_NOTICE (undefined constant). Try:
if ( $current_language == 'es-ES' )
and so on.
Upvotes: 2
Reputation: 1010
Does $current_language
correspond to string? If so then the right hand side of your expressions need to be quoted because currently PHP thinks they are constants.
Ditching shorthand PHP would also be a good idea but I don't want to start an argument.
<?php if ( $current_language == "es-ES" ){...
Upvotes: 1