Wordpress single.php是否在引导模式中?请告诉我这是不是浪费时间 if(have_posts()):while(have_posts()):the_post(); $args=数组( “numberposts”=>1, “订单”=>“描述”, “post_mime_type”=>“image”, 'post_parent'=>$post->ID, “post_类型”=>“附件” ); $get\u children\u array=get\u children($args,array\u A)//返回数组([$image\u ID]。。。 $rekeyed\u array=数组值($get\u children\u array); $child_image=$rekeyed_数组[0]; ?>

Wordpress single.php是否在引导模式中?请告诉我这是不是浪费时间 if(have_posts()):while(have_posts()):the_post(); $args=数组( “numberposts”=>1, “订单”=>“描述”, “post_mime_type”=>“image”, 'post_parent'=>$post->ID, “post_类型”=>“附件” ); $get\u children\u array=get\u children($args,array\u A)//返回数组([$image\u ID]。。。 $rekeyed\u array=数组值($get\u children\u array); $child_image=$rekeyed_数组[0]; ?>,php,html,wordpress,twitter-bootstrap,bootstrap-modal,Php,Html,Wordpress,Twitter Bootstrap,Bootstrap Modal,我假设您正在尝试将一个模式窗口映射到多个“打开模式”按钮,因为“数据目标”属性在循环中始终具有相同的值 一个很好的方法是使用ajax获取模式窗口的内容,即单篇文章内容。快速的谷歌搜索可以很快为您设置 if ( have_posts() ) : while ( have_posts() ) : the_post(); $args = array( 'numberposts' => 1, 'order'=> 'DESC', 'post_mime_type' =

我假设您正在尝试将一个模式窗口映射到多个“打开模式”按钮,因为“数据目标”属性在循环中始终具有相同的值

一个很好的方法是使用ajax获取模式窗口的内容,即单篇文章内容。快速的谷歌搜索可以很快为您设置

if ( have_posts() ) : while ( have_posts() ) : the_post(); 

$args = array(
    'numberposts' => 1,
    'order'=> 'DESC',
    'post_mime_type' => 'image',
    'post_parent' => $post->ID,
    'post_type' => 'attachment'
    );

$get_children_array = get_children($args,ARRAY_A);  //returns Array ( [$image_ID]... 
$rekeyed_array = array_values($get_children_array);
$child_image = $rekeyed_array[0];


        ?>


<article class="col-sm-3 blurb-box" style="background-image: url('<?php echo $child_image[guid];?>');">
    <div class="title-text">
        <h2><?php the_title(); ?></h2>     
    </div>
    <button 
            type="button" 

            href="<?php the_permalink(); ?>" 

            class="btn btn-success btn-md" 
            data-toggle="modal" 
            data-target="#myModal">
            Open Modal
    </button>

</article> 

<?php endwhile; else : ?>

<?php endif; ?>