WordPress.org

Ready to get started?Download WordPress

Forums

[Plugin: Posts 2 Posts] how to add post-to-post info to manage screen? (2 posts)

  1. Anointed
    Member
    Posted 4 years ago #

    I'm a bit confused as to how to add 'related' posts-to-posts custom fields to the 'manage custom posts' screen. Could use some advice.

    Here is what I am using to add some custom columns to my 'sermons' post-type screen.

    add_filter("manage_edit-sermons_columns", "prod_edit_columns");
    add_action("manage_posts_custom_column",  "prod_custom_columns");
    
    function prod_edit_columns($columns){
    		$columns = array(
    			"cb" => "<input type=\"checkbox\" />",
    			"title" => "Sermon Title",
    			"series" => "Sermon Series",
    			"topics" => "Sermon Topics",
    			"description" => "Description",
    			"date" => "date",
    		);
    
    		return $columns;
    }
    
    function prod_custom_columns($column){
    		global $post;
    		switch ($column)
    		{
    			case "description":
    				the_excerpt();
    				break;
    
    			case "series":
    				echo get_the_term_list($post->ID, 'series', '', ', ','');
    				break;
    			case "topics":
    				echo get_the_term_list($post->ID, 'sermon-tag', '', ', ','');
    				break;
    		}
    }

    I have another post-type 'preachers' related to the post-type sermons.

    What I am trying to do is add the 'preachers' title to the sermons manage UI. It would also be nice to add the preachers custom field 'preachers_image' to the sermons manage UI screen as well.

    Is there a special trick needed to pull in those fields to the sermons manage screen?

    thnx

    http://wordpress.org/extend/plugins/posts-to-posts/

  2. scribu
    Member
    Posted 4 years ago #

    Well, you can use the same p2p_list_connected() function as on the front-end, only using a different callback.

Topic Closed

This topic has been closed to new replies.

About this Topic