Jump to content
Sign in to follow this  
marmaristasarim

Where can i add code to the function.php file?

Recommended Posts

marmaristasarim

Hello I am using WPML and need to place a code in the function.php for this language switcher to work in my header. however when i open the funtion.php file it refers to the core/core.init.php file. So when i go to the core/core.init.php file it refers to the function.php file. Can i find out which file am i supposed to add this code? :) Can i just add it to the function.php file? But if i do i guess it would have to be before the <?php at the top of the page. Thank you kindly :)

Share this post


Link to post
Share on other sites
Kate

You'll need to activate Base and edit that functions.php. (If you're making any other modifications, they should also be done in the child theme, Base.)

Share this post


Link to post
Share on other sites
marmaristasarim

Hello Kate, thank you for your reply. I have activated the Base, opened up the functions.php file in the wp-admin. I have this code from the plugin WPML. So do I add this code right at the end of the functions.php file? I know this may be a stupid question, but I have to ask so that I don't mess up anything. Here is the code from the plugin: function languages_list_footer(){ $languages = icl_get_languages('skip_missing=0&orderby=code'); if(!empty($languages)){ echo '

  • '; foreach($languages as $l){ echo '
  • '; if($l['country_flag_url']){ if(!$l['active']) echo ''; echo ''.$l['language_code'].''; if(!$l['active']) echo ''; } if(!$l['active']) echo ''; echo icl_disp_language($l['native_name'], $l['translated_name']); if(!$l['active']) echo ''; echo ''; } echo '
'; } }

Share this post


Link to post
Share on other sites
EvaB

Hello, I want to do almost the same thing. I am working with wpml too and want to change the position of the language selector. Now I have found out how [see: WPML Language Selector in PlatformPro Header Solution}], but I have tried to change the code in the Base functions.php and everything stopped. I have uploaded the functions.php to start from scratch. Can you please tell me where I can insert the code? Thanks, Eva

Share this post


Link to post
Share on other sites
EvaB

By he way, at WPML they told me: "We'll be happy to create a free WPML account for the theme author so that they can download WPML and join this forum." It might interest you.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×