Support » Plugin: Front-end Editor » [Plugin: Front-end Editor] Use front end editor with checkboxes

  • Resolved urre

    (@urre)


    I’m using the plugin More Fields and have some fields that are checkboxes. Need to edit theese checkboxes in the front end. Is that possible? Use other field types than input, textarea or rich?

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author scribu

    (@scribu)

    How would that work? What would you double-click on?

    maybe if checked > update database with true/false?

    Plugin Author scribu

    (@scribu)

    Yeah, that would work.

    My question is this:

    For a text value, you have a text input or a textarea. On the front end, you just show the value as HTML text.

    For a true/false value, you have a checkbox. But how do you display it?

    I guess a potential solution would be to just display ‘yes’ for true and ‘no’ for false.

    Plugin Author scribu

    (@scribu)

    Check out the development version (2.0-alpha3).

    To display a custom field that’s to be edited using a checkbox write:

    editable_post_meta( get_the_ID(), 'my-meta-key', 'checkbox' );

    replacing, of course, ‘my-meta-key’ with your meta key.

    If you need to replace yes/no with something else, you can write:

    editable_post_meta( get_the_ID(), 'my-meta-key', array(
        'type' => 'checkbox',
        'values' => array( true => 'yes', false => 'no' )
    ) );

    Thank you for your answers! I will try this now, but the link didn’t work (pointed to http://downloads.wordpress.org/plugin/checkbox.zip) ?

    Plugin Author scribu

    (@scribu)

    Oups, I meant http://downloads.wordpress.org/plugin/front-end-editor.zip

    You can always reach it by going to Front-end Editor -> Other Versions -> Development Version.

    Thanks a lot, that worked!

    Have two more questions!

    1.
    I’m wondering if instead of yes/no, displaying a png-image with different graphics on checked/unchecked. Could that be done, for example using jQuery (like .attr(“src”,”graphic.png”); or something?

    2.
    I need to reset all values of a certain custom field, would like to make it a function and run it on a specific php-page. But I don’t know exacly how. This code works, but for some reason it executes even it is on a page that is not used (why?)

    $querystr = "
    SELECT wposts.*
    FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
    WHERE wposts.ID = wpostmeta.post_id
    AND wpostmeta.meta_key = 'price'
    AND wpostmeta.meta_value = '50'
    AND wposts.post_status = 'publish'
    AND wposts.post_type = 'post'
    ORDER BY wposts.post_date DESC";
    
    $pageposts = $wpdb->get_results($querystr, OBJECT);
    
    ?>
     <?php if ($pageposts): ?>
    <?php foreach ($pageposts as $post): ?>
    <?php setup_postdata($post); ?>
    <?php update_post_meta($post->ID, 'price', '0'); ?>
    <?php endforeach; ?>
    <?php else : ?>
    <?php endif; ?>

    btw, will definitely donate some money to you, the plugin is great!

    Plugin Author scribu

    (@scribu)

    1.
    I’m wondering if instead of yes/no, displaying a png-image with different graphics on checked/unchecked. Could that be done, for example using jQuery (like .attr(“src”,”graphic.png”); or something?

    You can just send the img tags instead of the ‘yes’ / ‘no’ strings.

    (The img tags worked, but becomes hard to click at)

    old question on this topic,

    Can i make the checkbox beeing unchecked by default?

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘[Plugin: Front-end Editor] Use front end editor with checkboxes’ is closed to new replies.