Thread Starter
Nina15
(@nina15)
It works well for making the media button globally available and restricting it to post/page. But on further testing and spending days trying to figure out a way to apply the media button to a specific custom post type (and the frontend post and editing plugins are commonly custom post types anyway) I declare total defeat! This may have something to do with “typenow” as you mentioned above. Any pointers on how to include a specific post type while excluding post and other post types is greatly appreciated.
If it works on those forms in mode 4 – without the “typenow” checks, then it’s definitely something to do with that.
A quick and dirty, on a dev box/site, test would be to find (in index.php):
} else {
echo '<a href="#" id="insert-zurlpreview-media" class="button"><img src="' . plugins_url( '/button.png', __FILE__ ) . '" width="22" height="22"> Add Preview </a>';
}
and change it to:
} else {
echo '<a href="#" id="insert-zurlpreview-media" class="button"><img src="' . plugins_url( '/button.png', __FILE__ ) . '" width="22" height="22"> Add Preview (' . htmlspecialchars($typenow) . ')</a>';
}
To see what, if anything “typenow” is set to.
If it’s blank then it’s a matter of finding something else to filter against… may be “pagenow”.
Thread Starter
Nina15
(@nina15)
Thanks for the troubleshooting tip. Replaced as suggested and set option 4 (media button row) gives empty i.e. the button shows as “Add Preview ()” in the cpt form and sure enough shows “Add Preview (post)” in new post editor from the backend.
This may be fine for the intended scenario of using the plugin from the backend. Not sure if I am at odds here or there may be a genuine need by others to be able to display the button on a frontend form. This is your call to make.
Your tip above gave me the idea of using the related action hooks with a helper script, injecting the media button into the form while selecting one of the TinyMCE options (row 1,2 or 3). Just need to find out why enqueue action is not firing when the action is copied to the script – perhaps a matter of adjusting the priority. This is a work-around but somehow manageable.
If there is a use case for front-end forms I’ll add it – if I can figure it out. I just don’t use them.
I don’t, currently, have a dev environment (long story). Do you have a front-end plugin that you could suggest that would have a zero/minimal impact on my live site so I could try your use case?
Thread Starter
Nina15
(@nina15)
I use BuddyForms by Themekraft which is a commercial product and fairly sophisticated. Cannot speak of other frontend plugins available freely (like WP User Frontend and a few other) but only assume they are custom post types as well. Perhaps this thread will generate more comments from others on the subject.
Thanks, I’ll have a look at some and see if I can find one to play with.