按兰德wp查询订单

时间:2019-03-26 21:35:55

标签: php wordpress

enter image description here

我用兰特从两个类别中的两个wp查询左两个列(分为两个帖子)和右列(一个帖子),有时是重合帖子,我如何用兰德使用一个wp查询并为左列添加类添加类flex-direction:colum吗?

<div class="info__block__main d-flex">
    <div class="small__info__block">
        <div class="child__info__block d-flex">             
            <?php
            $project_cat = array(1,7,33,38,43,40,35,45);
            $select_post_1 = get_field('select_post_from_services_small');

            $args = array(
                'paged' => $paged,
                'cat' => $project_cat,
                'post_type' => 'post',
                'posts_per_page' => 2,
                'post__in' => $select_post_1,
                'orderby'  => 'rand'
            );

            $query = new WP_Query($args);
            if($query->have_posts()) :
                while($query->have_posts()) :
                    $query->the_post();
                    get_template_part('parts/project', 'parts2');
                endwhile;
                wp_reset_query();
            endif;
            ?>
        </div>
    </div>
    <div class="big__info__block">
        <?php
        $project_cat = array(1,7,33,38,43,40,35,45);
        $select_post = get_field('select_post_from_services_big');

        $args = array(
            'paged' => $paged,
            'cat' => $project_cat,
            'post_type' => 'post',
            'posts_per_page' => 1,
            'post__in' => $select_post,
            'orderby'  => 'rand'
        );

        $query = new WP_Query($args);
        if($query->have_posts()) :
            while($query->have_posts()) :
                $query->the_post();
                get_template_part('parts/project', 'parts1');
            endwhile;
            wp_reset_query();
        endif;
        ?>
    </div>
</div>  

我尝试将count添加到循环中,但是结果不成功,也许我无法清除代码。

1 个答案:

答案 0 :(得分:0)

如果没有人帮助我,我将通过此代码解决此问题;)

using System.Threading;

bool photo_was_taken = false;


private void buttonStartCamera_Click(object sender, EventArgs e) 
 {

Thread thread = new Thread(new ThreadStart(exitcamera));
thread.Start(); 
 FinalVideo = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString);
 FinalVideo.DesiredFrameSize = new System.Drawing.Size(640, 480);
 FinalVideo.DesiredFrameRate = 90;
 FinalVideo.NewFrame += new NewFrameEventHandler(FinalVideo_NewFrame);
 FinalVideo.ProvideSnapshots = true;  //snapshots
 FinalVideo.Start(); 
 }
private void FinalVideo_NewFrame(object sender, NewFrameEventArgs eventArgs)
    {
        // what you want to do ( your code is here )
        photo_was_taken = true; 

    }
 private void exitcamera()
 { 
        while (!photo_was_taken)
        {
            Thread.Sleep(5); // you can change wait milliseconds
        }
        FinalVideo.SignalToStop();
        FinalVideo.NewFrame -= new NewFrameEventHandler(FinalVideo_NewFrame);
        //FinalVideo.WaitForStop();
        while (FinalVideo.IsRunning)
        {
            FinalVideo.Stop();
            // FinalVideo = null; >> // that is not condition
        }
 }