/** * uses and cache (via transient) count of posts linked with a term of a taxonomy in current language * * @since XL 2.16.3 * */ function xili_cached_taxonomy_count($taxonomy, $slug, $term_id) { global $xili_language; $curlang = xili_curlang(); $transient_name = 'xili_count_' . $taxonomy . '_' . $term_id . '_' . $curlang; if (false === ($xili_count = get_transient($transient_name))) { // It wasn't there, so regenerate the data and save the transient $xili_count = $xili_language->count_posts_in_taxonomy_and_lang($taxonomy, $slug, $curlang); // post by default here set_transient($transient_name, $xili_count, 12 * HOUR_IN_SECONDS); } return $xili_count; }
/** * Return the current language of theme. * * @since 0.9.7 * @updated 2.11.0 * use by other function elsewhere * @param slug, iso, full name, alias, charset, hidden, count * * @return by default the slug of language (used in query). */ function the_curlang($by = 'slug') { // soon obsolete return xili_curlang($by); }