Yoast\WP\SEO\Presenters
Breadcrumbs_Presenter::present() public Yoast 1.0
Presents the breadcrumbs.
{} Это метод класса: Breadcrumbs_Presenter{}
Хуков нет.
Возвращает
Строку. The breadcrumbs HTML.
Использование
$Breadcrumbs_Presenter = new Breadcrumbs_Presenter(); $Breadcrumbs_Presenter->present();
Код Breadcrumbs_Presenter::present() Breadcrumbs Presenter::present Yoast 15.6.2
public function present() {
$breadcrumbs = $this->get();
if ( ! \is_array( $breadcrumbs ) || empty( $breadcrumbs ) ) {
return '';
}
$links = [];
$total = \count( $breadcrumbs );
foreach ( $breadcrumbs as $index => $breadcrumb ) {
$links[ $index ] = $this->crumb_to_link( $breadcrumb, $index, $total );
}
// Removes any effectively empty links.
$links = \array_map( 'trim', $links );
$links = \array_filter( $links );
$output = \implode( $this->get_separator(), $links );
if ( empty( $output ) ) {
return '';
}
$output = '<' . $this->get_wrapper() . $this->get_id() . $this->get_class() . '>' . $output . '</' . $this->get_wrapper() . '>';
$output = $this->filter( $output );
$prefix = $this->helpers->options->get( 'breadcrumbs-prefix' );
if ( $prefix !== '' ) {
$output = "\t" . $prefix . "\n" . $output;
}
return $output;
}