【发布时间】:2021-10-19 21:11:59
【问题描述】:
我有我的主页,然后我有一份翻译成法语的副本。两个页面的代码是相同的,但由于某种原因,最新的帖子部分只显示在英文版上,而不是法文版上。我指的区域大约在页面的中间,而在法语版本中,它只是一个白色的盒子,里面有“博客”这个词。
英文:https://dvat.artrageousdemo.com/ 法语:https://dvat.artrageousdemo.com/fr/
这是用于提取最新帖子的代码。它适用于 2 个页面中的 1 个页面,即使它在两个页面上。
<?php
$loop = new WP_Query( array(
'post_type' => 'post',
'posts_per_page' => 2,
'order' => 'ASC'
) );
if ( $loop->have_posts() ) :
while ( $loop->have_posts() ) : $loop->the_post();
?>
<span><?php the_time( 'jS F, Y' ); ?></span>
<h6><?php the_title(); ?></h6>
<p><?php the_excerpt(); ?></p>
<a href='<?php the_permalink(); ?>' class='learn-btn'>Learn More <img src='<?php echo get_template_directory_uri(); ?>/images/a2.png' alt=''></a>
<?php endwhile; endif;
wp_reset_postdata(); ?>
感谢任何帮助。
【问题讨论】:
-
Learn more不可翻译。你说的是这个吗?
标签: php wordpress templates post