我有一个循环拉入wordpress内容页面'peopleformat'。
这是循环
<?php
// Start the Loop.
while ( have_posts() ) : the_post();
$do_not_duplicate[] = $post->ID;
/*
* Include the post format-specific template for the content. If you want to
* use this in a child theme, then include a file called called content-___.php
* (where ___ is the post format) and that will be used instead.
*/
get_template_part( 'content', 'peopleformat' );
?>
<!--Get all the rest of the posts to display -->
<?php endwhile; ?>
<?php
// 2nd loop
$args = array( 'post_type' => 'profile', 'posts_per_page' => 300, 'order' => 'DESC' );
$loop = new WP_Query( $args );
while ( $loop->have_posts() ) : $loop->the_post();
if (in_array($post->ID, $do_not_duplicate)) continue;
?>
在人格式页面中,我正在比较两个变量。如果它们是相同的那么'做某事'
<?php
$acf_tax = get_field('key_person');
$custom_tax = get_taxonomy( $Team );
if($acf_tax === $custom_tax) :
?>
然而,在执行var_dump($ acf_tax,$ custom_tax)之后,它会出现bool(false)bool(false)。我不知道如何停止成为一名布尔人?并正确地找到价值观?
我想要实现的最终目标是,如果acf_tax和custom_tax具有相同的值,那么它将“做某事”。
答案 0 :(得分:0)
从变量名称,他们认为类型为float。像9.97 所以你可以这样做;
$acf_tax = (float)get_field('key_person');
$custom_tax = (float)get_taxonomy( $Team );
if($acf_tax === $custom_tax)
所以,他们会漂浮