Forums

WPML Multilingual CMS
Problem using the icl_object_id function (1 post)

  1. TheDailyDG
    Member
    Posted 1 year ago #

    Hi all, I also posted a similar message on WPML's own forum, but maybe the kind people of the WP community can give this a look. ;-D

    Here goes:

    My theme has featured categories that I've made an important part of the home page (www.diegograglia.net). But the names of those categories are not showing translated on the Spanish version. See the second tier columns on es.diegograglia.net ("storytelling", "web publishing", "hard news").

    I carefully (I think) read http://wpml.org/documentation/support/creating-multilingual-wordpress-themes/language-dependent-ids/
    and also consulted: http://forum.wpml.org/topic.php?id=188

    I think I'm pretty close to the solution, after adding the code below to functions.php as per Amir's suggestion on the forum.

    function lang_category_id($id){
    if(function_exists('icl_object_id')) {
    return icl_object_id($id,'category',true);
    } else {
    return $id;
    }

    What I'm having trouble with is the right call to the function. Here's how my theme calls for that headline on featured3.php:

    <h2><?php echo $featuredpostscatname3;?></h2>

    As you may have guessed by now, I'm a noob on php matters. Although I tried many combinations, I cannot get the right syntax to have it display the translation.

    Could anyone point me in the right direction? Big thanks in advance.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic