我在一页上显示所有帖子,并显示以下代码:
<?php $query = new WP_Query( array( 'post_type' => 'myposttype', 'posts_per_page' => '-1' ) );
if($query->have_posts())
?>
<div class="jumbotron">
<div class="container">
<?php
while($query->have_posts()) : $query->the_post();
?>
<div class="row">
<div class="col-lg-7 col-md-6 col-sm-6 col-xs-12">
<h2><?php the_field('title');?> <a data-toggle="modal" data-target="#exampleModal" href="?product=<?php the_field('title');?>" class="button">Interested</a></h2>
<?php the_field('content');?>
</div>
</div>
<?php
endwhile;
wp_reset_query();
?>
</div>
</div>
如您所见,我正在使用Bootstrap。我要完成的工作如下:
当您按下按钮以打开模式时,“重力形式”中的选择字段应使用正确的帖子类型标题预填充该字段。现在,它仅显示选择字段的占位符。
这是引导程序模式代码:
<div class="modal fade" id="exampleModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Interested in <?php the_field('title');?></h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<div class="modal-body">
<?php gravity_form(1, false, false, false, '', true);?>
</div>
</div>
</div>
</div>
参数名称正确(“产品”)。此外,模式中的标题显示的是页面标题,而不是帖子类型的标题。我需要怎么做才能正确显示它?甚至有可能吗?
感谢您的帮助。谢谢。