dongzi1397 2017-04-24 15:03
浏览 70
已采纳

Wordpress:is_page()if语句未显示内容

I am trying to alter a shortcode dependent on the page which means I need to determine what page we are on and what shortcode to use.

When I try the below code the sidebar disappears completely leading me to believe that it clearly isn't working. The sidebar appears with the working shortcode when I remove the IF statement from the code however this is needed.

If you have any ideas on whats not working correctly then please feel free to shed some light on it (I have seen some similar questions however non of them have ever received answers).

<aside id="drinks-gallery" class="widget widget_gallery">
<div class="gallery-inner">
    <h3 class="widget-title">View The Gallery</h3>
    <p>Don't just take our word for it, take a look at some of our drinks!</p>
    <?php 
    if (is_page('drinks-packages')) {
        echo do_shortcode('[ngg_images source="galleries" container_ids="1" display_type="photocrati-nextgen_basic_thumbnails" override_thumbnail_settings="1" thumbnail_width="110" thumbnail_height="62" thumbnail_crop="1" images_per_page="20" number_of_columns="2" ajax_pagination="0" show_all_in_lightbox="0" use_imagebrowser_effect="0" show_slideshow_link="0" slideshow_link_text="&#91;Show slideshow&#93;" order_by="sortorder" order_direction="ASC" returns="included" maximum_entity_count="500"]')
    };?>
</div>

  • 写回答

1条回答 默认 最新

  • doulangtiao4508 2017-04-24 15:09
    关注

    The first line of your if statement seems incorrect.

    Change this:

    if (is_page('drinks-packages'){

    to:

    if (is_page('drinks-packages')) {

    and remove the last ) as well.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 如何让企业微信机器人实现消息汇总整合
  • ¥50 关于#ui#的问题:做yolov8的ui界面出现的问题
  • ¥15 如何用Python爬取各高校教师公开的教育和工作经历
  • ¥15 TLE9879QXA40 电机驱动
  • ¥20 对于工程问题的非线性数学模型进行线性化
  • ¥15 Mirare PLUS 进行密钥认证?(详解)
  • ¥15 物体双站RCS和其组成阵列后的双站RCS关系验证
  • ¥20 想用ollama做一个自己的AI数据库
  • ¥15 关于qualoth编辑及缝合服装领子的问题解决方案探寻
  • ¥15 请问怎么才能复现这样的图呀