doushi1957 2014-08-25 13:17
浏览 15
已采纳

wordpress中的条件标签

Sorry for the trivial question but I'm not very skilled in php... I need to display a slideshow on every page of my wordpress site except in one (sponsor). I tried with this code but does not work.

<? php if (! is_sponsor ()) {do_action ('slideshow_deploy', '3484'); }?>

Where did I go wrong?

The normal code to display the slideshow is:

<?php do_action('slideshow_deploy', '3484'); ?>

Thanks in advance!

  • 写回答

2条回答 默认 最新

  • duanbozhong9689 2014-08-26 18:45
    关注

    If you want to disable the slider on the page with slug "sponsor", try with the following code:

    if( !is_page('sponsor') ) {
        do_action('slideshow_deploy', '3484');
    }
    

    If you want to disable the slider on posts from post type "sponsor", try with the following code:

    if( !( is_single() && get_post_type() == 'sponsor' ) ) {
        do_action('slideshow_deploy', '3484');
    }
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog
  • ¥15 Excel发现不可读取的内容