Function Request: Image Thumbnail
-
The plugin is great and I’m using it in a project. However, I was unable to add image to the directories. Is there a project to create this functionality?
-
Hi @hellstoncrusher ,
At this moment there isn’t such a functionality. That would implicate a (kind of) content system in the description and my “USP” for this plugin is to keep it simple. I am sorry however to tell you, but I am not planning on adding this to this version of the plugin.
You can add HTML however, so you can do this yourself but then you should upload the images yourself. Would this work for you?
Kind regards,
Jeroen Peters
I tried some things myself. I thought it would be easy enough to just switch the plain textarea to wp_editor in admin.php but for some reason it doesn’t pick up the update.
I think that having the WordPress editor there wouldn’t hurt the simplicity. In fact, it would even add to it, as it ensures a similar look and feel across the entire backend.
I would tinker a bit more with it myself but my time is a little limited these days unfortunately. This is what I used:
<td><?php wp_editor(stripslashes($name['description']), 'description', array('textarea_rows' => 5, 'textarea_name' => 'description')); ?></td>Would you consider adding this?
hey @ju5t,
thanks for looking into it. I did see that function before but I didn’t get it right the first time to my liking. Since I now have a global-settings page, I have the opportunity to let that be configured by the user.
I know it’s easy to assume that it wouldn’t hurt simplicity, but I have had lots of mails regarding to layout issues. Also, now with Gutenberg, I’m not sure if it would work correctly.
But as much as yours, my time is very limited also, being a dad and all. But it’s nice to have it brought up again and have some new ideas.
Kind regards,
Jeroen Peters
I have tested wp_editor() but it doesn’t load Gutenberg. No matter what plugins you have enabled. I don’t think Gutenberg is intended to be used as an editor for anything else other then posts.
I did some further research and jQuery’s serialize() was the reason it didn’t work.
Apart from the html change, I’ve also adjusted the JavaScript file and added:
tinyMCE.triggerSave();before:
var form_data = jQuery(this).serialize();It’s confusing that it also clears the input fields. I can see why it was done, but because you have mixed both the insert and update into a single method it gets blurry from a UX perspective. I don’t expect my input fields to be cleared after an update. If this is required, the success function needs the following to empty it:
tinymce.activeEditor.setContent('');I also think it would be better to remove html from the admin output with wp_strip_all_tags(). To me that makes more sense. I understand you have to deal with other users too though.
I have never in my life contributed to WordPress plugins before. Is there a GitHub repo that I can use so you can see the changes I have made?
Hi @ju5t,
there is no GitHub repo for this, only the SVN repo which WordPress provides for the plugin authors, but that does not include any modern features like pull requests and such. You sound like you’re a developer, I can deal with patch files to see your changes.
Now I see your explanation, I don’t think the
jQuery(this).serialize()is the problem, it’s just that the HTML field doesn’t contain a proper value because of the editor that is doing it’s magic. ThetinyMCE.triggerSave()does just that.What do you mean with stripping the html output in the admin? I’m not sure if people would find it confusing if their markup is removed in that admin, but visible on the frontend.
The input-fields clearing is there for quite some time but I didn’t think of it that way, that updating would leave the data. I didn’t have any feedback on it btw.
Thanks for your work!
Kind regards,
Jeroen Peters
You’re right, serialize() wasn’t the problem.
I am stripping html because I prefer an excerpt over all html-content. It doesn’t easily ruin the admin interface either. Saying this, I realize it isn’t a real excerpt in my current implementation and in fact it changes the current functionality, so I have no problem if that part wouldn’t make a next release.
I will create a patch file tomorrow.
@hellstoncrusher this is now released in v1.14.2
The topic ‘Function Request: Image Thumbnail’ is closed to new replies.