我正在运行一个简单的查询,以显示自定义帖子类型中的一些帖子。
通过该帖子类型中的每个帖子,我添加了一个ACF真/假复选框。如果勾选该复选框,我希望该帖子仅在您在美国境内时出现。
Here\'s what I have so far:
<?php // Begin loop
while ( have_posts() ) : the_post(); ?>
    <article>
        <?php // If within the USA
            if(get_field(\'usa\')) {
        ?>
            <?php // Query post
                $args = array(
                    \'post_type\' => \'projects\',
                    \'posts_per_page\' => 12
                );
                $get_projects = new WP_Query( $args );
                while ( $get_projects->have_posts() ) :
                $get_projects->the_post();
            ?>
                <section>
                    <header class="entry-header">
                        <?php the_title( \'<h1 class="entry-title">\', \'</h1>\' ); ?>
                    </header><!-- .entry-header -->
                    <?php the_content(); ?>
                </section>
            <?php // End query post type
                endwhile;
                wp_reset_postdata();
            ?>
        <?php } // end if
        else { // The rest of the world ?>
            <?php // Query post
                $args = array(
                    \'post_type\' => \'projects\',
                    \'posts_per_page\' => 12
                );
                $get_projects = new WP_Query( $args );
                while ( $get_projects->have_posts() ) :
                $get_projects->the_post();
            ?>
                <section>
                    <header class="entry-header">
                        <?php the_title( \'<h1 class="entry-title">\', \'</h1>\' ); ?>
                    </header><!-- .entry-header -->
                    <?php the_content(); ?>
                </section>
            <?php // End query post type
                endwhile;
                wp_reset_postdata();
            ?>
        <?php } // end else ?>
    </article>
<?php endwhile; // End loop ?>
 我是否正确地认为需要通过指定特定的IP范围来添加到USA查询?我什么都找不到
via conditional 抄本上的标签。