Plugin Author
scribu
(@scribu)
1) Is there something like if functions exists, so I can make sure that my theme will still work after desactivation of the plugin?
You can do something like this:
<?php
if ( function_exists('editable_post_meta') ) {
editable_post_meta(get_the_ID(), 'my_key', 'textarea');
} else {
echo get_post_meta(get_the_ID(), 'my_key', true);
}
?>
2) After editable_option has been included in the plugin, what of the dev guide do I need to have a look at (http://scribu.net/wordpress/front-end-editor/developer-guide.html)?
If you don’t want to create your own custom editable field type, you don’t have to look at it at all.
You can use editable_option() similarly to how you use editable_post_meta().
Nice thanks scribu fort the if/else suggestion!
I was trying to add a custom editable field type to my sidebar. A simple text field that I could change from the front end & I didn’t know where to get started (since copying over the whole snippet from the dev page resulted in a double definition and a white page).
btw. I found one issue (bug?) so far where I wanted to edit/add a tag from the frontend:
<?php the_tags(‘<ul class=”post-tags”>
gets a list of the post tags. When I doubleclick to edit/add a tag it opens all the previous tags –>
* tumblog
* vimeo
* video
Adding frontend as a tag results in
* front-end editor, tumblog, video, vimeo
* video
* vimeo
Is that intended behaviour?
Is that correct? I get an syntax error, unexpected ‘)’, expecting ‘,’ or ‘;’ in /Users/…
<?php if ( function_exists('editable_post_meta') ) { editable_post_meta($post_id, 'image', 'textarea');} else { echo get_post_meta($post_id), 'image', true);}?>
Sorry again, I’m not yet very experienced with tweaking my own stuff!
Plugin Author
scribu
(@scribu)
It’s very hard to debug and modify code if you stuff it all in one line like that.
Here is the corrected version:
<?php
if ( function_exists('editable_post_meta') ) {
editable_post_meta($post_id, 'image', 'textarea');
} else {
echo get_post_meta($post_id, 'image', true);
}
?>
Plugin Author
scribu
(@scribu)
btw. I found one issue (bug?) so far where I wanted to edit/add a tag from the frontend:
<?php the_tags(‘<ul class=”post-tags”>
Please paste the entire line.
Sorry about that:
<?php the_tags('<ul class="post-tags"><li>','</li><li>','</li></ul>'); ?>
Plugin Author
scribu
(@scribu)
This is now fixed in the development version (1.9.2-alpha3).