Hi,
Thank you for your answer.
Is there a good reason for this not to be on the roadmap?
i made some changes to the code:
\ui\boxes.php:55 added:
function add_to_post() {
$my_post = array(
'post_title' => $_POST['post_title'],
'post_author' => 1,
'post_type' => $this->to
);
wp_insert_post( $my_post );
die(1);
}
\ui\boxes.php:112 added:
<a href="#" class="p2p-addnew button" name="p2p-addnew">
<?php _e( 'Add new', 'posts-to-posts' ); ?>
</a>
ui.css:22 added
.p2p-footer .p2p-addnew {
float: right;
}
and ui.js:208 added:
// Delegate p2p-addnew
$metabox.delegate('.p2p-addnew', 'click', function() {
var $button = $(this);
if ( $button.hasClass('inactive') )
return false;
var $x =$metabox.find('.p2p-search :text').val();
$button.addClass('inactive');
var data = $.extend( base_data, {
action: 'p2p_connections',
subaction: 'add_to_post',
post_title: $x
} );
$.post(ajaxurl, data, function(response) {
find_posts(1, $x);
$button.removeClass('inactive');
});
return false;
});
And the result is as suggested in
this post.
What do you say?