parent == 0) { return $thematique; } else { return get_term($thematique->parent, 'thematiques'); } } // DOES THE SAME THING AS ABOVE BUT RENAMED function getMainThematique($thematique) { if (!$thematique) { return null; } if ($thematique->parent == 0) { return $thematique; } else { return get_term($thematique->parent, 'thematiques'); } } // TO GET ARCHIVE RELATED PAGES BY TEMPLATE function get_page_by_template($template = '') { $args = array( 'meta_key' => '_wp_page_template', 'meta_value' => $template ); return get_pages($args); }