Title: language 2 not visible using php function for front page
Last modified: February 4, 2018

---

# language 2 not visible using php function for front page

 *  Resolved [Susnos](https://wordpress.org/support/users/susnos/)
 * (@susnos)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/language-2-not-visible-using-php-function-for-front-page/)
 * The issue can be found here: [https://www.nunki.se](https://www.nunki.se)
    The
   preview works: irrelevant It works with other themes: Haven’t Tried It works 
   when I disable all other plugins: Haven’t Tried Meta Slider version: 3.6.8 ———–
   Hi, I can not get MS to display slides on the static home page using the php 
   function in our second language (which is English). The other pages works with
   multilingual languages but these are created with the shortcodes directly on 
   the page. I have tried several variants with wordpress conditional both for slug‘
   en’ and also for the page ID like:
 *     ```
       function sus_add_headerslider() { ?> 
       		<div class="slider-wrap">   
       		<?php if (is_front_page()) : echo do_shortcode("[metaslider id=27]");           
             elseif ( is_page( 833 )) : echo do_shortcode("[metaslider id=1040]");
             endif;
           ?>  
       		</div>  
       	<?php 
         }         
       add_action('thematic_belowheader','sus_add_headerslider');
       ```
   
 * But looking on the source code does not change MS ID. But if I use the code below,(
   active on the site right now feb 4 2018) you’ll see in the source code that it
   retrieves the correct MS ID (which is 1040) but not the images in the ul class.
 *     ```
       function sus_add_headerslider() { ?> 
       		<div class="slider-wrap">   
       		<?php if (is_front_page()) {
           $curLang = substr(get_bloginfo( 'language' ), 0, 2);
           switch ($curLang) {
               case "en":
                   // english slideshow for english users
                   echo do_shortcode("[metaslider id=1040]");
                   break;
               case "se":
               default:
                   // fallback to swedish slideshow for any other language
                   echo do_shortcode("[metaslider id=27]");
                   break;
           }
       }
       ?>  
       		</div>  
       	<?php 
         }         
       add_action('thematic_belowheader','sus_add_headerslider');
       ```
   
 * On this site, the slider should be just the same so I also tried to have the 
   same MS ID (27) for both. Have also tested with the usual php function, but it
   does not work either. So the slider on the start page is only visible to the 
   Swedish language.
    I would of course want it to appear on both languages. Anyone
   who has a solution?
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Flanguage-2-not-visible-using-php-function-for-front-page%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 6 replies - 1 through 6 (of 6 total)

 *  [Kevin Batdorf](https://wordpress.org/support/users/kbat82/)
 * (@kbat82)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/language-2-not-visible-using-php-function-for-front-page/#post-9939071)
 * Hi [@susnos](https://wordpress.org/support/users/susnos/),
 * Are the images on the slideshow saving properly?
 * What happens if you switch 1040 and 27 around? Does it then only work on the 
   English site?
 *  Thread Starter [Susnos](https://wordpress.org/support/users/susnos/)
 * (@susnos)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/language-2-not-visible-using-php-function-for-front-page/#post-9939231)
 * Thank you for your reply.
    I have now tested to switch and still the same problem,
   but you can se that the swedish site picks upp the MD ID 1040 and showing it.
 * In the back end It looks like they are saveing properly, and otherwise they would
   not show in the swedish site now…
 *  [Kevin Batdorf](https://wordpress.org/support/users/kbat82/)
 * (@kbat82)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/language-2-not-visible-using-php-function-for-front-page/#post-9940017)
 * Hi,
 * I will have to look into this more. I’ll try to reproduce the error locally first.
   In the meantime, if you want to try to fix this, you can alter the file
 * inc/slider/metaslider.class.php
 * Look for the get_slides() function and in there you can alter the query. I’m 
   thinking maybe one of these language arguments is causing a problem
 *     ```
       $args = array(
           'force_no_custom_order' => true,
           'orderby' => 'menu_order',
           'order' => 'ASC',
           'post_type' => array('attachment', 'ml-slide'),
           'post_status' => array('inherit', 'publish'),
           'lang' => '', // polylang, ingore language filter
           'suppress_filters' => 1, // wpml, ignore language filter
           'posts_per_page' => -1,
           'tax_query' => array(
               array(
                   'taxonomy' => 'ml-slider',
                   'field' => 'slug',
                   'terms' => $this->id
               )
           )
       );
       ```
   
 *  [Kevin Batdorf](https://wordpress.org/support/users/kbat82/)
 * (@kbat82)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/language-2-not-visible-using-php-function-for-front-page/#post-9940326)
 * Also, can you tell me which language plugin you are using? WPML?
 *  Thread Starter [Susnos](https://wordpress.org/support/users/susnos/)
 * (@susnos)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/language-2-not-visible-using-php-function-for-front-page/#post-9940582)
 * Yes I’m using WPML.
    Let me know if there is anything else you need. I will look
   into the function above, I’m no php ninja bu i’ll give it a try 🙂
 *  [Kevin Batdorf](https://wordpress.org/support/users/kbat82/)
 * (@kbat82)
 * [8 years, 4 months ago](https://wordpress.org/support/topic/language-2-not-visible-using-php-function-for-front-page/#post-9940826)
 * Hi,
 * Well I think WPML is altering the query but I’m not sure exactly. The line `'
   suppress_filters' => 1` is supposed to stop that from happening.

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘language 2 not visible using php function for front page’ is closed to
new replies.

 * ![](https://ps.w.org/ml-slider/assets/icon.svg?rev=3523572)
 * [Slider, Gallery, and Carousel by MetaSlider - Image Slider, Video Slider](https://wordpress.org/plugins/ml-slider/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ml-slider/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ml-slider/)
 * [Active Topics](https://wordpress.org/support/plugin/ml-slider/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ml-slider/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ml-slider/reviews/)

## Tags

 * [meta slider](https://wordpress.org/support/topic-tag/meta-slider/)
 * [php function](https://wordpress.org/support/topic-tag/php-function/)

 * 6 replies
 * 2 participants
 * Last reply from: [Kevin Batdorf](https://wordpress.org/support/users/kbat82/)
 * Last activity: [8 years, 4 months ago](https://wordpress.org/support/topic/language-2-not-visible-using-php-function-for-front-page/#post-9940826)
 * Status: resolved