0
A
回答
0
我认为这可以帮助你http://wpml.org/faq/how-to-translate-custom-types/
假设你设置好的您的自定义类型后,根据WPML:如果您使用的是翻译管理模块,去WPML->翻译管理并单击多语言内容设置选项卡。否则,如果没有翻译管理模块,您可以在WPML->翻译选项下找到这些选项。
编辑:
<?php
// set up or arguments for our custom query
$paged = (get_query_var('page')) ? get_query_var('page') : 1;
$query_args = array(
'post_type' => 'tutorials',
'posts_per_page' => 5,
'paged' => $paged
);
// create a new instance of WP_Query
$the_query = new WP_Query($query_args);
?>
<?php if ($the_query->have_posts()) : while ($the_query->have_posts()) : $the_query->the_post(); // run the loop
//I try to access to the translated object, where ICL_LANGUAGE_CODE specify the language
$translated = icl_object_id($post->ID,'tutorials',ICL_LANGUAGE_CODE);
?>
<article>
<h1><?php echo get_the_title($translated->ID); ?></h1>
<div class="excerpt">
<?php echo get_the_excerpt($translated->ID); ?>
</div>
</article>
<?php endwhile; ?>
<?php if ($the_query->max_num_pages > 1) { // check if the max number of pages is greater than 1 ?>
<nav class="prev-next-posts">
<div class="prev-posts-link">
<?php echo get_next_posts_link('Older Entries', $the_query->max_num_pages); // display older posts link ?>
</div>
<div class="next-posts-link">
<?php echo get_previous_posts_link('Newer Entries'); // display newer posts link ?>
</div>
</nav>
<?php } ?>
<?php else: ?>
<article>
<h1>Sorry...</h1>
<p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
</article>
<?php endif; ?>
相关问题
- 1. WordPress的自定义帖子
- 2. WordPress的WPML - 语言代码存在
- 3. 自定义帖子上的WordPress定制
- 4. wordpress wpml插件 - 语言切换问题
- 5. wpml多语言cms插件问题(wordpress)
- 6. WPML翻译选项不显示自定义帖子类型
- 7. WordPress的自定义帖子类型
- 8. Wordpress在magento上的自定义帖子
- 9. WordPress的自定义帖子类型
- 10. WordPress的自定义帖子类型
- 11. WordPress的空帖子自定义字段
- 12. WordPress的 - 访问自定义帖子类型的帖子
- 13. WordPress的 - 自定义帖子类型的帖子不使用single.php
- 14. WordPress的自定义帖子类型 - 无效的帖子类型?
- 15. WordPress按自定义分类标准显示自定义帖子类型帖子
- 16. 多个wordpress自定义帖子元值
- 17. 排除帖子自定义字段wordpress
- 18. WordPress自定义帖子部分
- 19. Wordpress选择自定义帖子由metabox
- 20. 自定义帖子类型wordpress
- 21. 自定义帖子类型wordpress
- 22. WordPress自定义帖子类型
- 23. Wordpress DISTINCT查询自定义帖子
- 24. WordPress自定义帖子标题
- 25. 自定义WordPress评论帖子查询
- 26. 表格帖子自定义文章 - WordPress
- 27. WordPress的自定义帖子粘滞帖子
- 28. Wordpress,为每个帖子设置语言?
- 29. 如何使用WPML插件以不同语言显示自定义帖子类型列表?
- 30. 自定义帖子类型的Wordpress自定义字段
我的内容是翻译了。我想调用所有在php中使用法语的自定义文章。 – 2014-10-02 17:51:59
我添加了一些代码,我认为它可以帮助你 – EmaOnTheBlock 2014-10-03 19:00:51