Automatically Generated Custom Field Based On Post’s Image Content
I am looking for a simple straightforward code to scan my post’s content and pick up the first image’s address and apply it into a “custom field” box.
Earlier this week I discovered the “Autofields” plugin and it does what I am looking for but it is badly executed.
(I don’t know of any other plugins which are able to do this, if there are any then please let me know).
The problem I am having with it is that this function is executed whenever you click to add a new tag to your post which might have been fine but then every time you add a new tag you also get a new custom field to go with it and it just keeps adding these junk fields to the post. So say you had a post with 20 tags for instance, then you would also have 20 extra custom fields added to it when all you really need is one!! Sure you could delete them all but the Plugin shouldn’t be making redundant data which surely is a product of bad coding? Also if you are to click on publish/update post then the plugin checks to see whether the “image” field has any content but only as a warning for the user, I don’t see how this serves any real function? So the initial part of this plugin serves a good function but it is done so in a confusing way that in it’s current form can create a lot of junk fields and warns of empty fields which should have been automatically filled as the name “Autofields” suggests.
My idea for greatly improving this plugin (or to create a new one based on it) would be to somehow change the code so that for instance when the user clicks publish/update to check to see whether the “Image” custom field is filled in OTHERWISE it should THEN scan the post’s content and then add the custom field. Surely this check would stop the repetition of the custom field being constantly created?
And then the next step beyond this would be to allow an option to specify what the custom field should be called so that the user can use it effectively in their theme design.
I don’t have a good knowledge of JQuery otherwise I would be giving it a go myself but if all these changes were to be made this would be an awesome-must-have plugin that all the community could benefit from.
- The topic ‘Automatically Generated Custom Field Based On Post’s Image Content’ is closed to new replies.