我正在使用高级自定义字段、HTML、CSS 和 PHP。我最近使用了 php query_posts,它删除了我网站的下一部分。
我有一个关于案例研究的 query_posts,下面消失的下一部分是推荐。我只能想象这个问题来自案例研究部分
<!-- Case Study -->
<div class="wrapper">
<section id="case-study">
<div class="grid-case-study">
<?php query_posts('category_name=Case Study&post_type=caseStudy') ?>
<?php if ( have_posts() ) : while ( have_posts () ) : the_post();?>
<?php if ( have_rows( 'display_on_home_page' ) ) : ?>
<?php while ( have_rows( 'display_on_home_page' ) ) : the_row(); ?>
<div class="card">
<h2><?php the_sub_field( 'case_study_header' ); ?></h2>
<?php $case_study_image = get_sub_field( 'case_study_image' ); ?>
<?php if ( $case_study_image ) : ?>
<img src="<?php echo esc_url( $case_study_image['url'] ); ?>"
alt="<?php echo esc_attr( $case_study_image['alt'] ); ?>" />
<?php endif; ?>
<p><?php the_sub_field( 'case_study_description' ); ?></p>
<?php $case_study_link = get_sub_field( 'case_study_link' ); ?>
<?php if ( $case_study_link ) : ?>
<a href="<?php echo esc_url( $case_study_link['url'] ); ?>"
aria-label="<?php the_sub_field( 'case_study_aria_label' ); ?>"
target="<?php echo esc_attr( $case_study_link['target'] ); ?>"><?php echo esc_html( $case_study_link['title'] ); ?></a>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
</div> <!-- Card Close -->
<?php
endwhile;
endif;
?>
</div> <!-- Grid Case Study Close -->
</section>
</div>
<!-- End of Case Study -->
<!-- Testimonials -->
<div class="wrapper">
<section id="testimonials">
<?php if ( have_rows( 'testimonials' ) ) : ?>
<?php while ( have_rows( 'testimonials' ) ) : the_row(); ?>
<h1><?php the_sub_field( 'testimonial_header' ); ?></h1>
<?php if ( have_rows( 'testimonial_section' ) ) : ?>
<!-- case study carousel -->
<div class="grid-testimonials">
<?php while ( have_rows( 'testimonial_section' ) ) : the_row(); ?>
<div class="card-two">
<blockquote><?php the_sub_field( 'testimonial' ); ?></blockquote>
<cite><?php the_sub_field( 'testimonial_from' ); ?>,<?php the_sub_field( 'cited_by' ); ?></cite>
</div>
<!--- close card -->
<?php endwhile; ?>
<?php else : ?>
</div>
<!--- Carousel two -->
<?php // no rows found ?>
<?php endif; ?>
<?php endwhile; ?>
<?php endif; ?>
</section>
</div>
<!-- End of Testimonials -->