doushiposong30622 2014-03-19 13:07
浏览 24
已采纳

Php过滤内容错误的方式

I am trying to filter content depending on if a field has the value of 'copyclearance'. It is filtering but instead of showing the content with a value of 'copyclearance' it is hiding it and displaying the others. How do I alternate this so that it only displays the content with a value of 'copyclearance'.

<?php while(has_sub_field('team_profile')): 
        $category = get_sub_field('category');
        if($category!='copyclearance'){ ?>
        <li class="col-lg-3 teamProfile">
            <img src="<?php the_sub_field('user_image'); ?>" class="img-responsive"/>
            <h2><?php the_sub_field('profile_name'); ?></h2>
            <p class="jobTitle"><?php the_sub_field('category'); ?></p>
            <p><?php the_sub_field('bio'); ?></p>
        </li>
    <?php } 
    endwhile; ?>
  • 写回答

1条回答 默认 最新

  • doufubu2518 2014-03-19 13:09
    关注

    Simply change

    if($category!='copyclearance')
    

    to

    if($category=='copyclearance')
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥16 Qphython 用xlrd读取excel报错
  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法