[英]How to create a seperate popup form for each wordpress post on-click
I have listed my data through a custom-post-type plugin having some custom fields.我已经通过具有一些自定义字段的自定义帖子类型插件列出了我的数据。 Below code will display the custom-post-type listing data.
下面的代码将显示自定义帖子类型列表数据。
<?php
$args = array(
'post_type' => 'inde_case',
'posts_per_page' => -1
);
query_posts($args);
?>
<ul class="case_study_section1 col-md-12 nopadding">
<?php while ( have_posts() ) : the_post(); ?>
<?php $terms = get_the_terms( get_the_ID(), 'inde_case_category');
if( !empty($terms) ) {
$term = array_pop($terms);
}
?>
<li data-category="<?php echo $term->slug; ?>" class="case_study_img col-md-3 col-sm-6">
<div class="caseSection">
<div class="imagediv"><?php the_post_thumbnail(); ?></div>
<div style="width:100%;float:left;">
<a class="case_study_pdf" href="<?php the_field('linkicon'); ?>" >PDF</a>
<a class="case_study_title" href="<?php the_field('linktext'); ?>" ><?php the_title(); ?></a>
</div>
</div>
</li>
<?php endwhile; ?>
I have properly listed my data having thumbnail and pdf link...etc.我已经正确列出了具有缩略图和 pdf 链接的数据...等。
I am trying to create a popup by popup-maker plugin, it has created a class to open a popup.我正在尝试通过 popup-maker 插件创建一个弹出窗口,它创建了一个类来打开一个弹出窗口。 And when I put that class in above code (refer below), in this case only one popup will apply for each post.
当我把那个类放在上面的代码中时(请参阅下文),在这种情况下,每个帖子只会应用一个弹出窗口。
<a class="popmake-6981 case_study_pdf" href="<?php the_field('linkicon'); ?>" >PDF</a>
When somebody click on pdf link how can I open a separate popup for each particular post?当有人点击 pdf 链接时,我如何为每个特定帖子打开一个单独的弹出窗口? Or can I open a specific popup-form using postId or some unique data?
或者我可以使用 postId 或一些独特的数据打开特定的弹出表单吗? Please Advice.
请指教。
You can create popups with their [popup]
shortcodes, like described here .你可以用自己创建的弹出窗口
[popup]
简码,如描述在这里。 Match ID and a trigger class.匹配 ID 和触发器类。
<?php while ( have_posts() ) : the_post();?>
<article>
<h2><a class="popmake-post-<?php the_ID();?>" href="<?php the_permalink();?>"><?php the_title();?></a></h2>
<?php echo do_shortcode("[popup id='post-". get_the_ID() ."' size='small' title='". get_the_title() ."']". get_the_content() . "[/popup]");?>
</article>
<?php endwhile; ?>
Beware that you may also need some popup on that page in targeting settings, otherwise they may not initialize.请注意,您可能还需要在目标设置中的该页面上出现一些弹出窗口,否则它们可能无法初始化。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.