Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
  • #10566

    Hello and first of all thanks for making Corona – great theme!!

    Now to my trouble:

    My page has a portfolio-categorie “hotels” and i want to make it available in 3 languages.

    For WPML and the cat-filter to work proper, I create a translated copy of the hotel-category, too.

    Next I create a dynamic template with portfolio and assign it to all languages of the page. works for the primary language but when i switch to second language, the portfolio is empty. the frontend doesn’t recognize that it has to use the translated version of the hotel-category.

    So i wanted to work-around and create dynamic templates for each language – but at this point the template builder just shows me the cat’s of the first language … I cannot select the translated versions of the hotel-category.

    The final question:

    I there a way to generate one single dynamic template which recognizes the different languages of my hotel-category??



    I am afaraid the combination of dynamic portfolios + WPML is currently not supported properly. Its a shortcomming in both the theme code and the plugin and I wasnt able til yet to fix this issues.

    Sorry for that, once I have found a way to make all of that work well together an update will be released


    Well, I was trying to patch this in portfolio-loop, by modifying the includeArray:

    //transform CATs for languages
    if(function_exists(‘icl_object_id’)) {
    foreach ($includeArray as &$value) {
    $value = icl_object_id($value,’category’,true);

    By this I got a warning that the array is empty. How is that possible – there are 3 cat’s assigned to the dynamic template.




    Probably because this is already taken care of in includes/helper-templates.php at line 967

    Nevertheless the portfolio is not working 100% fine, and I am at this point not sure why thats the case…





    Regarding line 949, this seems to affect the static portfolio page only, not the dynamic template portfolio.

    I will try to trace where the category IDs are lost on the way to the portfolio loop :-)

    Best regards

    Edit: seems that avia_config is empty when calling a translated page on line 8 of loop-portfolio.php … confusing.


    For now I ended up on helper-templates.php:473 where a variable called portfolio_cats_dynamic is used.

    This one is empty when I have a translated page (and listing the cats when I load a page in my primary lang)


    Update: Seems to be a malfunction in WPML.

    I was able to set the translated cat-ID manually right after helper-templates.php:470 in $portfolio_cats_dynamic. Worked in the frontend.

    So I tried to do it with icl_object_id() but it always returns the same ID that I pass to it.

    Googling i found that icl_object_id cannot handle custom post types and categories by default. too bad :-/

    Bad joke that WPML lets me translate these items in the dashboard :)


    Yes – the documentation: just mentions ‘post’, ‘page’, ‘post_tag’ or ‘category’. I’d create a feature request thread here: and ask them to extend the function.


    Good news, i got it to work. As i saw later on in helper-templates.php a call like icl_object_id($term_id, ‘portfolio_entries’, true);

    The type ‘portfolio_entries’ works for categories, too. The beginning of my dynamic portfolio() function is now like this:

    function portfolio($element)
    global $avia_config;

    $avia_config[‘portfolio_columns’] = $portfolio_columns;
    $avia_config[‘portfolio_item_count’] = $portfolio_item_count;
    $catArray = explode(‘,’, $portfolio_cats_dynamic);

    if (function_exists(‘icl_object_id’))
    foreach ($catArray as $key => $value ) {
    $catArray[$key] = icl_object_id($value, ‘portfolio_entries’, true);
    $portfolio_cats_dynamic = implode(“,”, $catArray);

    Now i can create a single dynamic templates with portfolios, just assign the categories in my primary language and all the language hustle is fixed automaticly.


    Same problem with post/page module in dynamic templates was much easier to solve:

    function post_page($element)
    $output = “”;
    case’post': $query_id = $dynamic_post_id; $type =’post'; break;
    case’page': $query_id = $dynamic_page_id; $type =’page'; break;
    case’self': $query_id = $this->post_id; $type = get_post_type( $this->post_id ); break;
    //WPML ready
    if (function_exists(‘icl_object_id’)) $query_id = icl_object_id($query_id, $type, true);


    Hey bbmarketing,

    Thank you for posting the follow ups and fixes! Really helps to have such active users who come back and share what they were able to find and achieve :)



Viewing 11 posts - 1 through 11 (of 11 total)

The topic ‘Portfolio Categories in WPML’ is closed to new replies.