duan2428 2013-12-28 19:32
浏览 25

Wordpress IF声明

I'm trying to remove certain part of the post if:

property-type&tag_ID=13

The content I'm trying to hide is:

<div class="single-property-meta clearfix status-<?php echo $status_id; ?>-text">
<?php
$meta_size = get_post_meta( $post->ID, 'property_size', true );
**$meta_bedrooms = get_post_meta( $post->ID, 'property_bedrooms', true );
$meta_bathrooms = get_post_meta( $post->ID, 'property_bathrooms', true );
$meta_garages = get_post_meta( $post->ID, 'property_garages', true );
$meta_address = get_post_meta( $post->ID, 'property_address', true );**
?>
<span class="meta-size"><i class="ico-size"></i><?php echo $meta_size; ?></span>
**<span class="meta-bedroom"><i class="ico-bedroom"></i><?php echo $meta_bedrooms.'<span class="meta-hidden">'.__( ' Bedrooms' ).'</span>'; ?></span>
<span class="meta-bathroom"><i class="ico-bathroom"></i><?php echo $meta_bathrooms.'<span class="meta-hidden">'.__( ' Bathrooms').'</span>'; ?></span>
<span class="meta-garage"><i class="ico-garage"></i><?php echo $meta_garages.'<span class="meta-hidden">'.__( ' Garages').'</span>'; ?></span>**
<span class="meta-print visible-desktop"><i class="ico-print"></i><span class="print-hidden"><a href="javascript:window.print()"><?php echo __( 'Print this page'); ?></a></span></span>
<span class="meta-status"><?php echo $property_status; ?></span>
</div>

Any help would be welcome, I know I have to use some sort of a IF statement to show the content only IF the ID is = 13. All I have right now is this:

if ($property-type&tag_ID=13) {

}
  • 写回答

2条回答 默认 最新

  • duankaolei2921 2013-12-28 19:35
    关注

    Wrap the part you wanna hide with:

    <?if ($property-type && $tage_ID=13) {?>
        your hidden part
    <?}?>
    

    Actually Im not sure what $property-type&tag_ID=13 is.

    评论

报告相同问题?

悬赏问题

  • ¥20 怎么用dlib库的算法识别小麦病虫害
  • ¥15 华为ensp模拟器中S5700交换机在配置过程中老是反复重启
  • ¥15 java写代码遇到问题,求帮助
  • ¥15 uniapp uview http 如何实现统一的请求异常信息提示?
  • ¥15 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算