Support

Account

Home Forums Front-end Issues Edit attribute page

Solved

Edit attribute page

  • Hello,
    I wan’t edit order menu number page in the front end with acf_form().
    but i don’t find the parameter to target him.

    I try this but it’s not working :

    $field = array(
    ‘fields’ => array(
    ‘menu_order’
    ),
    ‘form’ => false
    );

    acf_form($field);

    Thank you

  • Hi @mikealkeal

    I’m afraid I don’t understand your query. Could you please explain it to me in more details?

    If you want to order the fields, you can always order it in the “fields” option like this:

    $field = array(
        'fields' => array(
            'field_1234567890abc', // this will be shown first
            'field_abcdefghijklm', // this will be shown second
        ),
        'form' => false
    );

    Where “field_1234567890abc” and “field_abcdefghijklm” are the field keys.

    I hope this helps 🙂

  • Sorry,
    I attach a snapshot :
    Menu Order of a post or page in Menu

  • I found a solution,
    I have create an input width menu_order as value
    <input type="texte" name="menu_order" value="<?php echo $post->menu_order; ?>"/>

    and when i update acf_form();
    I launch a function :

    add_filter('acf/pre_save_post' , 'my_pre_save_post' );
    function my_pre_save_post($post_id) {
    	 $menuOrder = $_POST['menu_order'];
    	 $post = array(
            'menu_order'  => $menuOrder
        );
    	 
    	$post_id = wp_update_post( $post ); 
    
    	// Save the fields to the post
     do_action( 'acf/save_post' , $post_id );
    }
Viewing 4 posts - 1 through 4 (of 4 total)

The topic ‘Edit attribute page’ is closed to new replies.