WPML

resolved (15 posts) (5 voices)

  1. calutateo
    Member

    I would like to translate the slider contents using WPML.

    I read this post in the infocus forum:
    http://mysitemyway.com/support/topic/wpml-translation-for-the-content-on-the-slideshow#post-3911

    Does this work with the Awake theme, too?

    Posted 7 years ago #
  2. Uniq
    Support

    Hi calutateo,

    No that won't work with Awake. I'll look into it further in a couple of minutes, and come back to you with an answer.

    Thanks for your patience!

    Cheers,
    Uniq

    Posted 7 years ago #
  3. calutateo
    Member

    This code works just great. It would be great if I could place it in any fields such as "Header Contact Info" or the slider and footer configuration fields:

    <?php if (ICL_LANGUAGE_CODE == 'en')
    {
     echo('English');
    }
     elseif (ICL_LANGUAGE_CODE == 'de')
    {
     echo('Deutsch');
    }
    ?>
    Posted 7 years ago #
  4. Uniq
    Support

    calutateo,

    I understand. I'll work on a tweak for this in the next couple of hours and post it back here. Thanks for posting this code, I was researching for it.

    Cheers,
    Uniq

    Posted 7 years ago #
  5. calutateo
    Member

    Hi Uniq,

    I have wrapped the footer and the header contact info into gettext calls and placed a .mo file in the theme folder. It works but to make the theme translation ready would definitely be a feature request.

    As for the slider contents (slider source) I have used a post category so I can translate the individual posts using WPML.

    Problem:
    The slider works fine with the titles and images, however,

    • the excerpt text does not appear
    • I don't know how to get rid of the "Read more" button

    Could you please help with this issue?

    Posted 7 years ago #
  6. Elliott
    Support

    Hey calutateo,

    I thought for sure we had an option to take off the read more button but I am having trouble finding it.

    If you wish to take it off of every slider then open up /wp-content/themes/awake/lib/functions/sliders.php and around line 105 you should see this..

    if($$slider_link && !$$slider_btn){ $out .= '<p><a class="button_link" href="' .$$slider_link. '"><span>Read More</span></a></p>'; }

    Go ahead and change it like this..

    if($$slider_link && !$$slider_btn){ $out .= ''; }

    As for the excerpt not showing up.. when you edit your post make sure that the "Disable Slider Text" option is not checked and make sure you actually have some text within the post.

    Let us know if this helps calutateo.

    Posted 7 years ago #
  7. celsokk
    Member

    Hi, I'm using WPML with INFOCUS theme at in a commercial website. I would like to know how to make different homepage (first page of website) in English, French, Spanish etc and the menu link "Home" too.

    Posted 7 years ago #
  8. Elliott
    Support

    Hello celsokk,

    If you create a new page and set that page to display on your homepage under Dashboard -> Awake -> Homepage then WPML should be able to translate the text for you.

    For the "Home" link consider using WP 3.0 menus and it should work as expected. If you still want to use the default menus then see this link here..

    http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/

    Follow the instructions it tells you and then open up /wp-content/themes/awake/lib/functions/theme-functions.php and around line 239 you should see this..

    $out .= '<li><a ' .$active_class. ' href="' .get_option('home'). '">Home</a></li>';

    Go ahead and change it like this..

    $out .= '<li><a ' .$active_class. ' href="' .wpml_get_home_url(). '"><?php _e('Home', 'wpml_theme'); ?></a></li>';

    This is if you are using the getText calls as seen here..

    http://wpml.org/2009/05/wordpress-theme-localization/

    Posted 7 years ago #
  9. celsokk
    Member

    Thanks Elliot, but in what php can I find this respective line code in the Infocus Theme?

    Posted 7 years ago #
  10. Elliott
    Support

    For inFocus you would open up /wp-content/themes/infocus/header.php and around line 90 you should see this..

    <li <?php if (is_front_page()){echo 'class="current_page_item"';} ?> ><a href="<?php echo get_settings('home'); ?>">Home</a></li>

    Try changing it like this..

    <li <?php if (is_front_page()){echo 'class="current_page_item"';} ?> ><a href="<?php echo wpml_get_home_url(); ?>"><?php _e('Home', 'wpml_theme'); ?></a></li>

    Posted 7 years ago #
  11. calutateo
    Member

    Hi Elliot, hi Uniq,

    Awake theme:

    It's working but...

    @Elliot
    1.
    The excerpt length is too short and I don't want the ellipsis at the end of the text.
    This is something I might change in theme-functions.php around line 108, right? However, I don't know where to set the $length. And, do I just delete $ellipsis in lines 108 and 114?
    If I change these lines the $ellipsis won't work in all posts, right?
    A solution to this might be that I apply the code only if the post category is $category = 13 ??? (13 is the category ID I use for the slider posts.)
    So change lines 108 through 116 to

    <?php
    $category = get_the_category(); 
     
    if ($category == '13')
    {
     function webtreats_excerpt($length) {
    	$length == '120';
            $text = get_the_content();
    	$text = preg_replace('<code>\[(.*)]*\]</code>','',$text);
    	$text = strip_tags($text);
    	$text = substr($text, 0, $length);
    	$text = substr($text, 0, strripos($text, " "));
    	$text = $text;
    	return $text;
    }
    }
     else
    {
     function webtreats_excerpt($length, $ellipsis) {
    	$text = get_the_content();
    	$text = preg_replace('<code>\[(.*)]*\]</code>','',$text);
    	$text = strip_tags($text);
    	$text = substr($text, 0, $length);
    	$text = substr($text, 0, strripos($text, " "));
    	$text = $text.$ellipsis;
    	return $text;
    }
    }
    ?>

    Sorry, I am not a programmer. Would this code work?

    @Uniq
    2.
    I would rather use the slider with "Custom define the images that the slider uses".
    When I posted the following example code (see my reply above)

    <?php if (ICL_LANGUAGE_CODE == 'en')
    {
     echo('English');
    }
     elseif (ICL_LANGUAGE_CODE == 'de')
    {
     echo('Deutsch');
    }
    ?>

    you said you would work on it.
    Have you found out yet?

    Best,
    Carsten

    Posted 7 years ago #
  12. celsokk
    Member

    thanks Elliot

    Posted 7 years ago #
  13. Elliott
    Support

    @celsokk, your welcome. :)

    @calutateo, that wouldn't work, try this..

    function webtreats_excerpt($length) {
    	if (get_the_category == 13) { $length = '120'; }
            else { $length = '120'; }
            $text = get_the_content();
    	$text = preg_replace('<code>\[(.*)]*\]</code>','',$text);
    	$text = strip_tags($text);
    	$text = substr($text, 0, $length);
    	$text = substr($text, 0, strripos($text, " "));
    	$text = $text;
    	return $text;
    }

    Or you can find where webtreats_exerpt() is being called and insert a length like this.. webtreats_excerpt('50');

    Let us know if it works for you calutateo.

    Posted 7 years ago #
  14. calutateo
    Member

    Solved. Thanks. I found a different solution without WPML.

    Posted 7 years ago #
  15. Does this still work??

    Posted 2 years ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme