[Plugin: Posts 2 Posts] Conflict with plugin filtering the_title()
-
Hi Scribu,
I’ve added a snippet of code to my functions that pulls the title for custom post type ‘person’ from a combination of their first and last names (meta values). Unfortunately this filter seems to be confusing the p2p meta boxes. In the edit post screen they now show all connected posts with the same name of the post currently open for editing. The snippet I’m using is:
function theme_slug_filter_the_title( $title ) { global $post; if ( 'person' == get_post_type( $post ) ) { $custom = ( get_post_custom( $post->ID ) ? get_post_custom( $post->ID ) : false ); $custom_title = ( isset( $custom['person_name_first'][0] ) && isset( $custom['person_name_last'][0] ) ? $custom['person_name_first'][0] . " " . $custom['person_name_last'][0]: '(No Name)' ); return $custom_title; } else { return $title; } } add_filter( 'the_title', 'theme_slug_filter_the_title' );
Is there a way I should modify this to make it more compatible with p2p?
Thanks,
O
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘[Plugin: Posts 2 Posts] Conflict with plugin filtering the_title()’ is closed to new replies.