首页 > 解决方案 > 使用 WCK 插件,当复选框被选中时,我想打印我在后端检查过的内容

问题描述

当复选框被选中时,我想打印我在后端检查过的内容。这里使用了WCK自定义帖子类型插件。下面是我在i中使用的代码。请帮助我。我是wordpress的初学者。

<?php
$args = array(
    'post_type' => array('post','research_areas'),
    'posts_per_page' => 50
);

$loop = new WP_Query($args);
$i = 0;

while ($loop->have_posts()):
    $loop->the_post();
    $checkbox = get_post_meta(get_the_ID(), 'latest-research_areas-checkbox', true);
    $latest_research = the_cfc_field("latest-research_areas-check", array(
        "output" => "raw"
    ));
    if ($latest_research == 1 && $i < 3):
        ?>
        <div class="research_box eqh_3">
            <div class="research_inner clearfix">
        <?php the_post_thumbnail('full'); ?>
                <div class="inner_cont">
                    <h3><?php the_title(); ?></h3>
                    <?php the_excerpt(20); ?>

                    <?php
                    if (the_cfc_field('reference-url', array(
                                'raw' => 'true'
                            ))) {
                        $reference_url = the_cfc_field("reference-url", array(
                            "output" => "raw"
                        ));
                        ?>
                        <a href="<?php echo $reference_url; ?>" target="_blank" class="read1">Read More</a>
                        <?php
                    } else {
                        ?>
                        <a href="<?php the_permalink(); ?>?rid=res_home" class="read1">Read More</a>
                        <?php }
                    ?>
                </div>
            </div>
        </div>
        <?php
        $i++;
    endif;
endwhile;
wp_reset_query();
?>

标签: phpwordpressplugins

解决方案


推荐阅读