mardev
Forum Replies Created
-
Forum: Plugins
In reply to: [Front-end Editor] Can't find filter 'front_end_editor_allow_post'Awesome! I’ll try it soon. Thank you very much for your efforts and quick fixes.
Forum: Plugins
In reply to: [Front-end Editor] Can't find filter 'front_end_editor_allow_post'Great, that feature should really increase functionality a lot.
I tried to implement what I explained above but 2 problems occurred that you should know about it.
1. In Ajax callback function defined in my functions.php the_content() method doesn’t apply FEE actions. This is my own ajax call for inserting new post.
add_action('wp_ajax_poi_insert', 'poi_insert'); function poi_insert() { // here are unrelated wp_insert_post logic // test FEE editing for newly created post, this same code works great in index.php query_posts('posts_per_page=2'); while ( have_posts() ) : the_post(); ?> <?php the_title(); ?> <?php the_content(); ?> <?php endwhile; wp_reset_query(); }Above code returns 2 posts title and content that are not wrapped in FEE editing elements/attributes.
2. FEE Ajax call for a new post returns nothing
Ignoring the first problem above, I return ID of newly inserted post instead of final FEE html and do FEE attributes wrapping by hand on the client side after which I reinitialize FEE editor. That works and I get nice ‘Edit’ flag on mouseover event over new post content. But the second problem occur when I click edit new post content, FEE sends proper AJAX call on server but script returns nothing. It seems like that is happening because I wrapped FEE attributes by hand, I assume the_content() method and FEE sets something on server.
Forum: Plugins
In reply to: [Front-end Editor] Can't find filter 'front_end_editor_allow_post'Scribu,
thanks again for your help. Method register_post_type was already wrapped in ‘init’ action callback but I didn’t want to paste large amount of other unrelated code. Anyway you pointed me in the right direction and I found error somewhere else. I was using get_posts and previous posts sorted that out http://ww.wp.xz.cn/support/topic/plugin-front-end-editor-making-fields-retrieved-with-get_post-editable?replies=13.
I have just one last question for you! Hope you don’t mind!
I want to achieve initializing FEE editor for the posts that has been returned from AJAX call so without reloading the whole page.
What I’m doing is:
I insert new post on front-end side with AJAX callback function which returns inserted post ID after which I can format content like:<div data-post_id='{POSTID}' class='fee-field fee-clearfix' data-filter='the_content' data-type='rich' > {POST_CONTENT} </div>In this stage I don’t use FEE but my own ajax call as I know you don’t support inserting new posts but what I want to achieve now is to call your internal mechanism(on PHP&JS side) to initialize this new post on frontend to enable FEE editing.
Your help is greatly appreciated! I really want to make this plugin work for my project, it has unbelievable UX.
Forum: Plugins
In reply to: [Front-end Editor] Can't find filter 'front_end_editor_allow_post'Thank you for your quick reply but I still can’t get things working so please help me once more.
My functions.php looks like this:
register_post_type('poi', $args); // 'poi' custom post type definition function fee_restrict_post_types( $allow, $data ) { $allowed_post_types = array( 'poi', 'post', 'page'); $current_post_type = get_post_type( $data['post_id'] ); return $allow && in_array( $current_post_type, $allowed_post_types ); } add_filter('front_end_editor_allow_post', 'fee_restrict_post_types', 10, 2 );Do I need to let FEE know anywhere else about the new post type ‘poi’?
Thanks!