Posts 2 Posts
Alternative to 'p2p_candidate_title'? (5 posts)

  1. blurby
    Posted 2 years ago #


    I need to display post author and post date in addition to the title when I am creating/searching for connections. (I need to know the date/author before I relate one item to the other)

    I believe "p2p_candidate_title" is what I need, but I found out that it's not yet available in the current release.

    Any alternatives to solving this issue? I store all the info I need in the post_excerpt field and it would suffice if I can simply display post excerpt instead of the post title while creating connections.



  2. scribu
    Plugin Author

    Posted 2 years ago #

    Just released version 1.6, which contains the 'p2p_candidate_title' filter.

  3. blurby
    Posted 2 years ago #

    Scribu, once again, you are a star!

    Thank you for all your hard work!

  4. blurby
    Posted 2 years ago #

    Quick question:

    Am I using the filter properly? I am not getting anything next to the candidate title:

    function append_date_to_candidate_title( $title, $ctype, $post ) {
    	if ( 'tweets_to_posts' == $ctype->name && 'post' == $post->post_type ) {
    		$title .= " (" . $post->_wp_page_template . ")";
    		$title .= " (" . $post->post_author . ")";
    		$title .= " (" . $post->post_date . ")";
    	return $title;
    add_filter( 'p2p_candidate_title', 'append_date_to_candidate_title', 10, 3 );


  5. blurby
    Posted 2 years ago #


    I have realized the field has to come from the meta table, so I have updated the code accordingly, but to no avail.

    Here's my code (I have a meta field titled "OriginalID" in my post_meta table):

    function append_info_to_candidate_title( $title, $ctype, $post ) {
    	if ( 'tweets_to_posts' == $ctype->name && 'tweet' == $post->post_type ) {
    		$title .= " (" . $post->OriginalID . ")";
    	return $title;
    add_filter( 'p2p_candidate_title', 'append_info_to_candidate_title', 10, 3 );

    Even if I ask the function just to add a static text string to the candidate title, I get nothing.

    Thanks Scribu!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Posts 2 Posts
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.