doucao1888 2018-06-20 05:51
浏览 29
已采纳

Wordpress php if-statement

Iamtrying to use a if-statement in order to use/not use a entry-title based on post format. The title should not be present for quotes and links.

At this point I can only put one of the post formats in the if statement at a time.

This works:

<?php if ( !has_post_format( 'quote' ) ): // Quote ?>

<?php the_title( '<h2 class="entry-title" itemprop="name headline"><a href="' . esc_url( get_permalink() ) . '" itemprop="url">', '</a></h2>' ); ?>

<?php endif; ?>

This does not work:

<?php if ( !has_post_format( 'quote' ) || !has_post_format( 'link' ) ): // Quote or Link ?>

<?php the_title( '<h2 class="entry-title" itemprop="name headline"><a href="' . esc_url( get_permalink() ) . '" itemprop="url">', '</a></h2>' ); ?>

<?php endif; ?>

How can I make the last code to work?

  • 写回答

1条回答 默认 最新

  • dongtui0650 2018-06-20 06:04
    关注

    Try with below if condition and let me know what comes as a result.

    if ( !has_post_format( 'quote' ) && !has_post_format( 'link' ) ):
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器