- 単語「次」のために:Wordpress関数PHP echo inside echo?私はWPMLの翻訳者のためのリンクアンカーの翻訳を取得しようとしています
function getPrevNext(){
$pagelist = get_pages('sort_column=menu_order&sort_order=asc');
$pages = array();
foreach ($pagelist as $page) {
$pages[] += $page->ID;
}
$current = array_search(get_the_ID(), $pages);
$prevID = $pages[$current-1];
$nextID = $pages[$current+1];
echo '<div class="prev-next-page-bottom-navigation">';
if (!empty($prevID)) {
echo '<div class="prevpage-bottom-navi">';
echo '<a href="';
echo get_permalink($prevID);
echo '"';
echo 'title="';
echo get_the_title($prevID);
echo'">Previous</a>';
echo "</div>";
}
if (!empty($nextID)) {
echo '<div class="nextpage-bottom-navi">';
echo '<a href="';
echo get_permalink($nextID);
echo '"';
echo 'title="';
echo get_the_title($nextID);
echo'">Next</a>';
echo "</div>";
}
}
私はあることをecho'">Next</a>';
の次の行を変更する必要があります。
<?php echo __('Next','my_wp_theme');?>
:内部のエコーエコーPHPエラー
ソリューションとなり変更echo'">Next</a>';
とecho'">'.__('Next','my_wp_theme').'</a>';
でこれを簡素化することができます。" '; – iSZ
2番目の行は正常に動作するはずです – Shawn
@twelvell PHP内でエコー機能を実際にネストすることはできません – iSZ