• Resolved isimone

    (@isimone)


    Hey scribu, thanks for making something like this happen. I really love what someone with actual development skills could do with this (not me obviously).

    I got two questions:

    1) I would like to use the front-end plugin on custom fields and other stuff. So adding something like this is the way to go: <?php editable_post_meta(get_the_ID(), 'my_key', 'textarea'); ?> Is there something like if functions exists, so I can make sure that my theme will still work after desactivation of the plugin?

    2) After editable_option has been included in the plugin, what of the dev guide do I need to have a look at (https://scribu.net/wordpress/front-end-editor/developer-guide.html)?

    Cheers, have a great Evening

Viewing 8 replies - 1 through 8 (of 8 total)
  • 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 (https://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().

    Thread Starter isimone

    (@isimone)

    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?

    Thread Starter isimone

    (@isimone)

    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.

    Thread Starter isimone

    (@isimone)

    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).

    Thread Starter isimone

    (@isimone)

    Nice!

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: Front-end Editor] Wrap editable_post in an if function?’ is closed to new replies.