• Resolved Csilla Molnar

    (@csillamolnar)


    My website has a portfolio with the following link structure: %featured_item_category%/%featured_item%

    However, when I turn on the Falang Portfolio translation, the featured_item_category disappears from the link not only in the translated language, but also from the original.
    Falang also translates the category correctly.

    I tried to debug the bug with my knowledge of php and came to the conclusion that in
    wp-content\plugins\falang\src\Falang\Core\Falang_Core.php

    The value of $ post-> post_type is = featured item
    the hierarchical value is 1

    but the parent_id = 0

    And that’s why don’t look for featured item category value.

    Any idea what I should do? How to set a parent for a portfolio item, because I don’t see it in the admin …

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author sbouey

    (@sbouey)

    Hi,

    What is your portfolio plugin ? if it’s a free plugin i can have a look on my system to see what’s wrong.

    Stéphane

    Thread Starter Csilla Molnar

    (@csillamolnar)

    This Portfolio came with the Flatsome Theme…

    Plugin Author sbouey

    (@sbouey)

    Ok,
    i configure my flatsome theme with portfolio but i can’t reproduce the problem

    i have enable in falang > settings > transalte option
    translation of cateogy and portfolio item

    i can translate it , but i don’t know how to have the same url

    i have something like that
    https://localhost/support/flatsome/fr/featured_item_category/livre/

    i don’t know how to have the cateogy-name and not featured_item_category

    Stéphane

    Thread Starter Csilla Molnar

    (@csillamolnar)

    Hi,

    I found a solution for the problem, if I put the following code to
    falang/src/Falang/Core/Falang_Core.php

    if ($post->post_type == 'featured_item' ){
    					$portfolio_categories = get_the_terms( $post->ID, 'featured_item_category' );
    					foreach($portfolio_categories as $cat=>$item){
    						$post_link = $translated_cpt.'/'.$item->slug.'/'.user_trailingslashit($translated_slug);
    					}
    }

    Soo, my url will be something like this:
    https://localhost/mysite/en/zoo/mammal/dog
    OR
    https://localhost/mysite/en/zoo/amphibian/frog

    I hope you understand what I wanted ??

    Thread Starter Csilla Molnar

    (@csillamolnar)

    Ohh sorry,
    falang/src/Falang/Core/Falang_Core.php line 484

    Plugin Author sbouey

    (@sbouey)

    Hi,

    i have managed to configure my flatsome theme with portfolio. it was not so easy.

    in my case without Falang i have this url

    https://localhost/support/flatsome/portfolio/books/my-first-book/

    with falang enabled i have this url
    https://localhost/support/flatsome/en/featured_item/my-first-book/

    i can replace the featured_item with the portfolio page name.
    In Falang > Settings > Translate Options > Portfolio (Options) replace featured_item by portfolio.
    https://localhost/support/flatsome/en/portfolio/my-first-book/
    This url is not working , it’s missing the cateogry book

    With the change , you set is work
    but i’m looking for a solution without code changing , i can add of course a filter in falang for this.

    Stéphane

    Plugin Author sbouey

    (@sbouey)

    Hi,

    i have a better solution in falang/src/Falang/Core/Falang_Core.php line 484
    you can just add the %featured_item_category%, the category will be replaced by flatsome portfolio

    
    if ($post->post_type == 'featured_item' ){
    
                        $post_link = $translated_cpt.'/'.'%featured_item_category%'.'/'.user_trailingslashit($translated_slug);
    
                    }
    

    i will see for a filter in translate_custom_post_link to fix this without Falang change
    Stéphane

    Plugin Author sbouey

    (@sbouey)

    a way to fix this even with Falang update is to put this function in the child/function.php

    and replace the 2 $this->get_current_language() by Falang()->get_current_language()

    function fix_featured_items_permalinks($link, $post_id, $sample = false) {

    }

    add_filter( ‘post_type_link’, ‘fix_featured_items_permalinks’, 10, 2 );

    Stéphane

    Thread Starter Csilla Molnar

    (@csillamolnar)

    Thank you very much!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Portfolio Url translation problem’ is closed to new replies.