WordPress.org

Ready to get started?Download WordPress

Forums

Front-end Editor
editable custom field and number format (3 posts)

  1. Pepperbase
    Member
    Posted 1 year ago #

    Hi,

    Great plugin.

    I am using

    editable_post_meta( $wp_query->queried_object->ID, 'test_key', 'input' );

    to edit custom fields (which are displayed in a html table).

    The custom fields contain numbers, hence I would like to use number_format to give the numbers a format. I tried this:

    number_format(editable_post_meta( $wp_query->queried_object->ID, 'test_key', 'input' ), 0, ',', '.');

    However, somehow an extra zero is added (100 gets 1000). In firebug I see the zero is outside the fee span class. What is the proper way to use number_format with editable_post_meta?

    Thanks for your help.

    http://wordpress.org/extend/plugins/front-end-editor/

  2. designsimply
    Member
    Plugin Author

    Posted 1 year ago #

    Can you do number_format on the data separate before you call editable_post_meta ?

  3. Pepperbase
    Member
    Posted 7 months ago #

    Hi,

    I have a new approach using jQuery. I have created a numberformat function which I like to run when the ajax call to save data is complete. This is working:

    jQuery(document).ready(function() {
        jQuery( document ).ajaxComplete(function() {
    	numberformat('some_custom_field_name');
        }
    });

    However, this code runs on every ajax call. How can I select the ajax calls from the front end editor to edit and save data? From jQuery I understand I can insert an if statement, but I cannot find the right handler to select the ajax calls, see below

    jQuery(document).ready(function() {
        jQuery( document ).ajaxComplete(function() {
            if ( "#some-fee-ajax-handler..." ) {
    	     numberformat('some_custom_field_name');
             }
        }
    });

    Any ideas?

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic