首页 > 解决方案 > 如何使用带有自定义字段标题的 wp_list_pages() 函数从自定义帖子类型中列出帖子?

问题描述

问题

我想使用wp_list_pages()函数列出来自自定义帖子类型的帖子。另外,我想使用自定义字段来代替帖子的标题。

目前,我正在使用以下代码来执行此操作,但它不包含 current_post 类。

    $posts_list = new WP_Query($args);  

    while($posts_list->have_posts()){

        $posts_list -> the_post(); 

        the_field('custom_field_title');

            wp_reset_query();

    //currently there is no endwhile, yet loop is working

请建议我一个合适的解决方案。谢谢。这是页面链接:页面链接

标签: phpwordpresswordpress-theming

解决方案


推荐阅读