在 WordPress 卡片中显示页面

我会尽力解释一下。


我有医生页面,并且有一个自定义模板,因此他们可以创建一个页面并向其添加数据,它将显示在模板页面中。


但现在我需要一份所有医生的名单。所以我需要获取医生的所有页面并排除网站页面。


我尝试了这个,但我只得到当前页面的标题。


            <?php 

            if ( have_posts() ) {

                while ( have_posts() ) {

                    the_post(); 

                    //

                    the_title();

                    the_content();

                    //

                } // end while

            } // end if

            ?>

这可能吗?如果是的话,又是怎样的呢?


胡说叔叔
浏览 126回答 2
2回答

慕勒3428872

这是您最后一条评论的答案:(未经测试)<?php $args = array('role' => 'subscriber',//&nbsp; &nbsp; &nbsp; If custom role exist, replace "subscriber" by custom role//&nbsp; &nbsp; &nbsp; More on roles @: https://wordpress.org/support/article/roles-and-capabilities/#roles'order' => 'ASC');$users = get_users( $args );echo '<ul>';foreach ( $users as $user ) {echo '<li>' . esc_html( $user->display_name ) . '</li>';}echo '</ul>'; ?>

红糖糍粑

我将调用所有医生的用户列表,然后链接他们的页面。感谢所有提供帮助的人!
打开App,查看更多内容
随时随地看视频慕课网APP