Php Flamingo从特定表单获取消息
我怎样才能从某种形式上获得信息 通过此功能,我可以获取所有入站邮件:Php Flamingo从特定表单获取消息,php,wordpress,contact-form-7,wordpress-flamingo-plugin,Php,Wordpress,Contact Form 7,Wordpress Flamingo Plugin,我怎样才能从某种形式上获得信息 通过此功能,我可以获取所有入站邮件: <?php $args = array( 'post_type' => 'flamingo_inbound', 'post_status' => 'publish' ); $query = new WP_Query($args); if( $query->have_posts() ){
<?php
$args = array(
'post_type' => 'flamingo_inbound',
'post_status' => 'publish'
);
$query = new WP_Query($args);
if( $query->have_posts() ){
while( $query->have_posts() ){
$query->the_post();
echo '<article>';
echo get_the_title();
echo '</article>';
}
}
wp_reset_postdata();
?>
但我只想显示当月特定表单中的消息。我在Google和此处搜索,但我找不到任何示例或任何相关内容,因此我希望有人知道。我已经提出了一个解决方案,可能不是最好的php编写,但它可以工作:
<?php
$currentmonth = date('m');
$args = array(
'post_type' => 'flamingo_inbound',
'post_status' => 'publish',
'monthnum' => $currentmonth
);
$query = new WP_Query($args);
if( $query->have_posts() ){
echo '<ul>';
while( $query->have_posts() ){
$query->the_post();
$results = get_post_meta( get_the_ID() );
foreach($results['_meta'] as $result) {
$normaldata = unserialize($result);
if ($normaldata['post_id'] == '1234') { // The id of the post where the form is send from
$title = get_the_title();
echo '<li>' . $title . '</li>';
} else {
}
}
}
echo '</ul>';
}
wp_reset_postdata();
?>