我最终创建了两个循环并使用了锚。我不确定这是否是最有效的做事方式,然而,它是有效的。
add_action( \'genesis_post_content\', \'child_do_content\' ); // Adds your custom page code/content
function child_do_content() {?>
<ul class="multicol">
<?php
$custom_query = new WP_Query(array(\'orderby\' => \'title\', \'order\' => \'ASC\',\'cat=5\'));
while($custom_query->have_posts()) : $custom_query->the_post();?>
<li><a href="#<?php the_title(); ?>"><?php the_title(); ?></a></li>
<?php endwhile;
wp_reset_postdata();?>
</ul>
<?php }
function add_services() {?>
<div style="clear:both"></div>
<?php
$custom_query = new WP_Query(array(\'orderby\' => \'title\', \'order\' => \'ASC\',\'cat=5\'));
while($custom_query->have_posts()) : $custom_query->the_post();?>
<hr />
<a name="<?php the_title(); ?>"></a>
<h2><?php the_title(); ?></h2>
<?php the_content(); ?>
<?php endwhile;
wp_reset_postdata(); ?>
<?php }
add_action( \'genesis_after_content\', \'add_services\' );
正如在行动中看到的那样
here