Landing page featured box and Polylang workaround

  • Author
    Posts
  • #118932

    Hi,

    As stated here, the featured box does not work with Polylang.

    The problem seems to be localized in the function “cryout_localize_cat” in file wp-content/themes/fluida/cryout/prototypes.php (line 1073 in Fluida 1.8.6.2)
    The get_term_by function is filtered by current language. To retrieve the category in any language, the get_terms function with the empty string assigned to the ‘lang’ argument must be used.

    So one workaround is:
    $cat = get_terms(array('taxonomy' => $tax, 'slug' => esc_attr($slug), 'lang' => ''))[0];
    instead of
    $cat = get_term_by( 'slug', esc_attr($slug), $tax );

    It works as expected with Polylang and 2 languages.

    Best regards.

    #119861
    Zed
    Cryout Creations mastermind

    Hi,

    Thank you very much for your code suggestion.
    We have already included the change in Fluida’s 1.8.7 update.


    If you like our creations, help us share by rating them on WordPress.org.
    Please read the available documentation and search the forums before posting.
Viewing 2 posts - 1 through 2 (of 2 total)

You need to log in to reply to this topic.