Php 从其他页面查询帖子
我正在为一个教堂建立一个网站,我只想在主页上的教职员工页面上显示一个教职员工档案。在员工页面上,我使用高级自定义字段添加员工档案。它有img、title、name和description字段 在代码的末尾。“home staff wrapper”是我想在员工页面中显示一个员工档案的地方。请帮忙 这是我的主页代码:Php 从其他页面查询帖子,php,wordpress,Php,Wordpress,我正在为一个教堂建立一个网站,我只想在主页上的教职员工页面上显示一个教职员工档案。在员工页面上,我使用高级自定义字段添加员工档案。它有img、title、name和description字段 在代码的末尾。“home staff wrapper”是我想在员工页面中显示一个员工档案的地方。请帮忙 这是我的主页代码: <?php /* page-homepage.php */ get_header(); ?> <div id="main-wrapper">
<?php
/* page-homepage.php */
get_header();
?>
<div id="main-wrapper">
<div id="home-slider-wrapper">
<?php if(function_exists('vslider')){ vslider('homepageslider'); }?>
<div id="home-church-intro">
<div id="home-intro-content"><?php the_field('church_intro'); ?></div>
</div>
</div>
<div id="home-left-content-wrapper">
<div id="home-worship-time-wrapper">
<div id="home-title">Worship Time</div>
<div id="home-worship-detail">
<?php if(have_posts()): while(have_posts()): the_post(); ?>
<?php the_content(); ?>
<?php endwhile; endif; ?>
</div>
</div>
<div id="home-announcement-wrapper">
<div id="home-title">Announcement</div>
<div id="home-announcement-detail"><?php the_field('announcement'); ?></div>
</div>
</div>
<div id="home-right-content-wrapper">
<div id="home-sermon-wrapper">
<div id="home-title">Sermon</div>
<?php $sermon_query = new WP_Query(array('posts_per_page' => 2)); ?>
<?php if($sermon_query -> have_posts()): while($sermon_query -> have_posts()): $sermon_query -> the_post(); ?>
<div id="home-sermon-detail">
<div id="home-sermon-thumbnail-wrapper">
<div id="home-sermon-thumbnail"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail(); ?></a></div>
</div>
<div id="home-sermon-title-and-date-wrapper">
<div id="home-sermon-title"><?php the_title(); ?></div>
<div id="home-sermon-date"><?php the_time('F j, Y'); ?></div>
</div>
</div>
<?php endwhile; wp_reset_postdata(); ?>
<?php endif; ?>
</div>
<div id="home-staff-wrapper">
<?php //$staff = new WP_Query('page_id = 273'); ?>
<?php //while($staff -> have_posts()): ?>
<?php //the_post(); ?>
<?php //the_content(); ?>
<?php //endwhile; wp_reset_postdata(); ?>
</div>
</div>
</div>
<?php get_footer(); ?>
礼拜时间
公告
布道
您想显示一个特定员工的个人资料还是随机的个人资料?我想显示一个特定员工的个人资料。您能让整个员工都显示在该部分吗?如果是这样的话,你能改一下写着the_post()的行吗代码>仅显示姓名?我无法在主页上显示员工页面。新的WP_查询应该获得该页面,但不知何故它不起作用代码>?