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.

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

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度