我的内部有一个AJAX回调函数functions.php
文件,其中显示特定类别中的帖子。
add_action( \'wp_ajax_ajaxified_function\', \'ajaxified_function\' );
add_action( \'wp_ajax_nopriv_ajaxified_function\', \'ajaxified_function\' );
function ajaxified_function()
{
$post = get_post($_POST[\'post_id\']);
$feat_image = get_the_post_thumbnail($post->ID);
$desc_values = get_post_custom_values("designation",$post->ID);
$title = current(explode(\' \', get_the_title($post->ID)));
if( is_array( $desc_values ) )
{
foreach($desc_values as $key => $value );
}
$email_values = get_post_custom_values("email",$post->ID);
if( is_array( $email_values ) )
{
foreach($email_values as $key => $email_value );
}
echo \'<div id="bloggers_avatar">\'.$feat_image.\'</div>\'.$post->post_.\'<div id="bloggers_title">\'.$post->post_title.\'</div><div id="bloggers_desig">\'.$value.\'</div><div id="emailid" ><a class="email_link">Email \'.$title.\'</a></div><br/><div id="postContent">\'.$post->post_content.\'</div>\';
echo \'<script>
jQuery(document).ready(function(){
jQuery(".email_link").colorbox({inline:true,
width:400,
height:600,
fixed:true,
href:"#email_id_meet_the_team"
});
});
</script>\';
echo \'<div style="display:none">
<div id="email_id_meet_the_team">
<div>\';
echo do_shortcode(\'[contact-form-7 id="698" title="Meet The Team Email"]\');
echo \'</div>
</div>
</div>\';
die();
}
我用这个的时候echoing 短代码,而不是显示联系人表单。我现在在本地工作。我有一个演示,只使用the ajax, not the colorbox.
您可以在中看到电子邮件链接biography div.单击该链接后,我想显示一个带有联系人表单的颜色框。