WordPress.org

Ready to get started?Download WordPress

Forums

Polylang
[resolved] Get_default_category (5 posts)

  1. Patrick Hesselberg
    Member
    Posted 2 years ago #

    Heya

    I was wondering if there was a way to get the category of the default language?

    Lets say I have catA(id=5,default) and catB(id=9). Is there a way to get the id of catA when you have the value of catB?
    It should be possible, as the id of catA is stored in catB I just dont know how/where its getting saved :(

    http://wordpress.org/extend/plugins/polylang/

  2. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    You can do that with the function pll_get_term.

    $tr_id = pll_get_term($cat_id, 'en');

    will return the id of the English translation of the category which has $cat_id as id. If the category is already in English, the function returns $cat_id.

  3. Patrick Hesselberg
    Member
    Posted 2 years ago #

    Wow. That was quick. Worked perfectly.

    I might be blind but have you written any manual for this plugin?

  4. Chouby
    Member
    Plugin Author

    Posted 2 years ago #

    In polylang/doc/documentation-en.pdf or even here.

  5. Patrick Hesselberg
    Member
    Posted 2 years ago #

    That is awesome. Thanks alot again :)

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags