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 全部备份安卓app数据包括密码,可以复制到另一手机上运行
  • ¥15 Python3.5 相关代码写作
  • ¥20 测距传感器数据手册i2c
  • ¥15 RPA正常跑,cmd输入cookies跑不出来
  • ¥15 求帮我调试一下freefem代码
  • ¥15 matlab代码解决,怎么运行
  • ¥15 R语言Rstudio突然无法启动
  • ¥15 关于#matlab#的问题:提取2个图像的变量作为另外一个图像像元的移动量,计算新的位置创建新的图像并提取第二个图像的变量到新的图像
  • ¥15 改算法,照着压缩包里边,参考其他代码封装的格式 写到main函数里
  • ¥15 用windows做服务的同志有吗