Yoast\WP\SEO\Llms_Txt\Infrastructure\Markdown_Services
Terms_Collector{}
The collector of terms.
Хуков нет.
Использование
$Terms_Collector = new Terms_Collector(); // use class methods
Методы
Код Terms_Collector{} Terms Collector{} Yoast 27.8
class Terms_Collector {
/**
* The taxonomy helper.
*
* @var Taxonomy_Helper
*/
private $taxonomy_helper;
/**
* The constructor.
*
* @param Taxonomy_Helper $taxonomy_helper The taxonomy helper.
*/
public function __construct( Taxonomy_Helper $taxonomy_helper ) {
$this->taxonomy_helper = $taxonomy_helper;
}
/**
* Returns the content types in a link list.
*
* @return Link_List[] The content types in a link list.
*/
public function get_terms_lists(): array {
$taxonomies = $this->taxonomy_helper->get_indexable_taxonomy_objects();
$link_list = [];
foreach ( $taxonomies as $taxonomy ) {
if ( $this->taxonomy_helper->is_indexable( $taxonomy->name ) === false ) {
continue;
}
$terms = \get_categories(
[
'taxonomy' => $taxonomy->name,
'number' => 5,
'orderby' => 'count',
'order' => 'DESC',
],
);
$term_links = new Link_List( $taxonomy->label, [] );
foreach ( $terms as $term ) {
$term_link = new Link( $term->name, \get_term_link( $term, $taxonomy->name ) );
$term_links->add_link( $term_link );
}
$link_list[] = $term_links;
}
return $link_list;
}
}