jabrecmm
Forum Replies Created
-
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Edit image-attatchmentsNo Idea?
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Edit image-attatchmentsOk, that helped me a lot. Now I understand, how it works.
But I have one issue: The Image is wrapped and if I doubleclick it, I get the thickbox etc. But if I click on “Attach” the thickbox doesn’t disappear and the image isn’t changed.
Can you help me one more time, please?These are my class and function:
// Handles the post thumbnail class FEE_Field_Img_1 extends FEE_Field_Thumbnail { function wrap( $html, $post_id, $post_thumbnail_id, $size ) { if ( !$post_id = $this->_get_id( $post_id, false ) ) return $html; return FEE_Field_Base::wrap( $html, compact( 'post_id', 'size' ) ); } function get( $data ) { extract( $data ); return get_post_meta( $post_id, '_fit_profile_img_1', true ); } function save( $data, $thumbnail_id ) { extract( $data ); if ( -1 == $thumbnail_id ) { delete_post_meta( $post_id, '_fit_profile_img_1' ); return -1; } update_post_meta( $post_id, '_fit_profile_img_1', $thumbnail_id ); list( $url ) = image_downsize( $thumbnail_id, $size ); return $url; } } function fit_get_img_1( $post_id = NULL, $size = 'post-thumbnail', $attr = '' ) { global $id; $post_id = ( NULL === $post_id ) ? $id : $post_id; $post_thumbnail_id = get_post_meta( $post_id, '_fit_profile_img_1', true ); if ( $post_thumbnail_id ) { $html = wp_get_attachment_image( $post_thumbnail_id, $size, false, $attr ); } else { $html = ''; } return apply_filters( 'editable_img_1', $html, $post_id, $post_thumbnail_id, $size ); }
And this is, what I register:
'editable_img_1' => array( 'title' => __( 'Profile image 1', 'front-end-editor' ), 'class' => 'FEE_Field_Img_1', 'type' => 'thumbnail', 'argc' => 4 )
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Edit image-attatchmentsI’ve solved the Point 2 by using a custom field and the action-hook “updated_post_meta”.
But I still have no solution for my Images: I need the same function like changing the posts thumbnail. Just for another custom field.
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Edit image-attatchmentsArgh! Hours of working, but I still don’t get it and deadlines coming nearer and nearer…
I need to accomplish two things:
1. Change a image like described above.
2. And write a Field for custom Data of a Plugin (stored in a db-table).Using “fee_register_field” I register my own field, right? And thats, what I use in apply_filters, right?
myFieldClass::get() is used to get the actual data.
I still don’t really understand how the content is wrapped and how Data like the $key is handled between AJAX and the myFieldClass.Please help me a bit.
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Edit image-attatchmentsI took a closer look at the FEE_Field_Thumbnail Class and realized, that the thumbnail is a simple custom field containing the image(Attachment)-ID.
I could save my images (they are limited to 3) as Attachment-IDs in three Customfields. What I need is: the function for Thumbnails (you already have) for a custom field.
Example:
The custom field _xyz_image contains the Attachment-ID of an image. If I call e.g. editable_custom_attachment( $post->ID, ‘_xyz_image’, ‘image’, ‘thumbnail’ ) it shows the attachment in thumbnail size. On double click it opens the thickbox to upload/change the Image saved in custom field _xyz_image.I hope this was understandable. I’ve tried it on my own, but I had difficulties to understand the complete Code.
By searching for an example, I’ve found this link: https://scribu.net/wordpress/front-end-editor/developer-guide.html but the Site doesn’t exist any more, right?Maybe you can point me the right direction.
Thanks, Jan
Forum: Plugins
In reply to: [Front-end Editor] [Plugin: Front-end Editor] Edit image-attatchmentsI’m using wp_get_attachment_image to show a image in a single-template (within the loop, image is an attatchment of the current post).
The author must be able to change this image.Forum: Fixing WordPress
In reply to: no display No categories result from wp_list_categoriesThis code would do it:
<?php $cats = wp_list_categories('echo=0'); if ( !preg_match( '/No\scategories/i', $cats ) ) { echo $cats; } ?>
If the displayed Text reads “No categories”.
Jan