以前的开发人员使用了这段代码,每次在自定义帖子类型上添加新条目时,我似乎都找不到问题所在。
您可以在此处进行检查:https://www.pninjurylaw.com/case-results/ 这应该显示为新条目:https://www.pninjurylaw.com/caseresults/1-95-million-settlement-for-a-29-year-old-rear-ended-by-a-will-county-sheriff/(忽略此处未显示的全部内容)
代码如下:
<?php
//get children of page 241 and display with custom fields
$args=array(
'post_type' => 'caseresults',
'posts_per_page' => 9999,
'meta_key' => 'case_award',
'orderby' => 'meta_value_num',
'order' => 'DESC'
);
$my_query = null;
$my_query = new WP_Query($args);
if( $my_query->have_posts() ) {
while ($my_query->have_posts()) : $my_query->the_post(); ?>
<div class="entry-content">
<div class="entry-content clear"><div class="verdict-onethird"><?php the_field('case_verdict'); ?>:
<span class="money"><?php the_field('amount'); ?></span>
<?php // the_field('case_completion');?></div>
<div class="verdict-twothird"><div class="singlepostcasedata">
<span class="header-verdict"><?php the_excerpt(); ?></span>
<?php echo get_the_term_list( $post->ID, 'practicetype', '<span class="singlecatmeta">', '', '</span>' ); ?>
</div><!-- end singlepostcasedata -->
<?php the_field('case_summary'); ?>
</div>
<?php the_content(); ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
</div>
</div><!-- .entry-content -->
<?php endwhile; } ?>
<?php wp_reset_query(); // Restore global post data stomped by the_post().?>