/**
  * Load property from page type.
  *
  * @param  string $slug
  * @param  string $child_slug
  *
  * @return null|Papi_Core_Property
  */
 public function get_property($slug, $child_slug = '')
 {
     $taxonomy_type_id = papi_get_taxonomy_type_id($this->id, 'term');
     $taxonomy_type = papi_get_entry_type_by_id($taxonomy_type_id);
     if ($taxonomy_type instanceof Papi_Taxonomy_Type === false) {
         return;
     }
     if ($property = $taxonomy_type->get_property($slug, $child_slug)) {
         return $this->prepare_property($property);
     }
 }
Beispiel #2
0
/**
 * Get the taxonomy type name.
 *
 * @param  int $term_id
 *
 * @return string
 */
function papi_get_taxonomy_type_name($term_id = 0)
{
    $term_id = papi_get_term_id($term_id);
    if (empty($term_id)) {
        return '';
    }
    $entry_type_id = papi_get_taxonomy_type_id($term_id);
    if (empty($entry_type_id)) {
        return '';
    }
    $entry_type = papi_get_entry_type_by_id($entry_type_id);
    if (empty($entry_type)) {
        return '';
    }
    return $entry_type->name;
}