public function wp_insert_post_empty_content($maybe_empty, $postarr) { // Allow translations to have empty content if (bbl_get_base_post_type($postarr['post_type']) != $postarr['post_type']) { return false; } return $maybe_empty; }
/** * Hooks the WP body_class filter to add classes to the * body element. * * @param array $classes An array of class strings, poss with some indexes containing more than one space separated class * @param string|array $class One or more classes which have been added to the class list. * @return array An array of class strings, poss with some indexes containing more than one space separated class **/ public function body_class(array $classes, $class) { // Shadow post_type archives also get the post_type class for // the default language if (is_post_type_archive() && !bbl_is_default_lang()) { $classes[] = 'post-type-archive-' . bbl_get_post_type_in_lang(get_query_var('post_type'), bbl_get_default_lang_code()); } if (is_single()) { $classes[] = 'single-' . bbl_get_base_post_type(get_post_type()); } return $classes; }
/** * Hooks the WP bbl_registered_shadow_post_types action to check that we've applied * all untranslated taxonomies to the shadow post types created for this base * post type. * * @param string $post_type The post type for which the shadow post types have been registered. * @return void **/ public function registered_shadow_post_types($post_type) { $taxonomies = get_object_taxonomies($post_type); $object_type = (array) $post_type; foreach ($taxonomies as $taxonomy) { // Untranslated taxonomies do not have shadow equivalents in each language, // but do apply to the bast post_type and all it's shadow post_types. if (!$this->is_taxonomy_translated($taxonomy)) { // Apply this taxonomy to all the shadow post types // of all of the base post_types it applies to. foreach ($object_type as $ot) { if (!($base_post_type = bbl_get_base_post_type($ot))) { continue; } $shadow_post_types = bbl_get_shadow_post_types($base_post_type); foreach ($shadow_post_types as $shadow_post_type) { register_taxonomy_for_object_type($taxonomy, $shadow_post_type); } } } } }