Forum Replies Created

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • in reply to: Portfolio Categories in WPML #68534

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

    Code:
    function post_page($element)
    {
    extract($element[‘saved_value’][0]);
    $output = “”;
    switch($dynamic_which_post_page)
    {
    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);

    in reply to: Portfolio Categories in WPML #68533

    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:

    Code:
    function portfolio($element)
    {
    extract($element[‘saved_value’][0]);
    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.

    in reply to: Portfolio Categories in WPML #68531

    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 :-/

    http://till.klampaeckel.de/blog/archives/ (Purchase code hidden if logged out) -post-types.html

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

    in reply to: Portfolio Categories in WPML #68530

    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)

    in reply to: Portfolio Categories in WPML #68529

    Hello!

    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.

    in reply to: Portfolio Categories in WPML #68527

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

    Code:
    //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.

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