这是我的模板 archive-gallery.php 中的代码
<?php
/*
Template Name: Gallery
*/
remove_action( 'genesis_loop', 'genesis_do_loop' );
add_action( 'genesis_loop', 'bm_custom_loop' );
function bm_custom_loop() {
$gallery = new WP_Query( array( 'post_type' => 'gallery','posts_per_page' => 7) );
if ( $gallery -> have_posts() ){
?>
<h1> Behind the scene photo gallery </h1>
<br>
<?php
while ( $gallery -> have_posts() ){
$gallery -> the_post();
?>
<?php $images = get_field('image');
if( $images ): ?>
<?php foreach( $images as $image ):?>
<div id="box"> <img class="galimg" src="<?php echo $image['url']; ?>">
<a href="<?php echo $image['url']; ?>"><div id="over">
<span id="plus"><i class="fa fa-2x fa-camera"></i></span>
</div></a>
</div>
<?php endforeach; ?>
<?php endif; ?><?php
} // End IF
} // End While
} //End Loop
add_shortcode( 'behind', 'bm_custom_loop' );
genesis();
我使用这个简码 [behind] 来调用简码
使用页面属性选择页面模板时工作正常,但使用简码时,结果是简码 [后面]