WordPress: if_page() if statement is not displaying content

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>
    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="[Show slideshow]" order_by="sortorder" order_direction="ASC" returns="included" maximum_entity_count="500"]')

Read more here: WordPress: if_page() if statement is not displaying content

Leave a Reply

Your email address will not be published. Required fields are marked *