acf_get_post_title() ACF 1.0
Хуков нет.
Возвращает
Null. Ничего.
Использование
acf_get_post_title( $post, $is_search );
- $post **
- -
- $is_search **
- -
По умолчанию: false
Код acf_get_post_title() acf get post title ACF 5.9.1
function acf_get_post_title( $post = 0, $is_search = false ) {
// vars
$post = get_post($post);
$title = '';
$prepend = '';
$append = '';
// bail early if no post
if( !$post ) return '';
// title
$title = get_the_title( $post->ID );
// empty
if( $title === '' ) {
$title = __('(no title)', 'acf');
}
// status
if( get_post_status( $post->ID ) != "publish" ) {
$append .= ' (' . get_post_status( $post->ID ) . ')';
}
// ancestors
if( $post->post_type !== 'attachment' ) {
// get ancestors
$ancestors = get_ancestors( $post->ID, $post->post_type );
$prepend .= str_repeat('- ', count($ancestors));
// add parent
/*
removed in 5.6.5 as not used by the UI
if( $is_search && !empty($ancestors) ) {
// reverse
$ancestors = array_reverse($ancestors);
// convert id's into titles
foreach( $ancestors as $i => $id ) {
$ancestors[ $i ] = get_the_title( $id );
}
// append
$append .= ' | ' . __('Parent', 'acf') . ': ' . implode(' / ', $ancestors);
}
*/
}
// merge
$title = $prepend . $title . $append;
// return
return $title;
}