WordPress
- 3 ответа
- 0 вопросов
2
Вклад в тег
function _page_crumbs( $post ){
$parent = $post->post_parent;
$crumbs = array();
while( $parent ){
$page = get_post( $parent );
$my_title = get_field('my_title_field', $page->ID);
$post_title = esc_html($page->post_title);
$title = ($post_title != $my_title && !empty($my_title)) ? $my_title : $post_title;
$crumbs[] = sprintf( $this->arg->linkpatt, get_permalink($page), esc_html($title) );
$parent = $page->post_parent;
}
return implode( $this->arg->sep, array_reverse($crumbs) );
}
function _add_title( $add_to, $obj, $term_title = '' ){
$arg = & $this->arg; // упростим...
$title = $term_title ? $term_title : esc_html($obj->post_title);
$show_title = $term_title ? $arg->show_term_title : $arg->show_post_title;
$my_title_field = get_field('my_title_field');
$title = ($title != $my_title_field && !empty($my_title_field)) ? $my_title_field : $title;
// пагинация
if( $arg->pg_end ){
$link = $term_title ? get_term_link($obj) : get_permalink($obj);
$add_to .= ($add_to ? $arg->sep : '') . sprintf( $arg->linkpatt, $link, $title ) . $arg->pg_end;
}
// дополняем - ставим sep
elseif( $add_to ){
if( $show_title )
$add_to .= $arg->sep . sprintf( $arg->title_patt, $title );
elseif( $arg->last_sep )
$add_to .= $arg->sep;
}
// sep будет потом...
elseif( $show_title )
$add_to = sprintf( $arg->title_patt, $title );
return $add_to;
}
'filterUrl' => Url::to(['/orders']),