Viewing 3 replies - 1 through 3 (of 3 total)
  • I looked over your code and noticed a few problems.

    1. Give the select field and the meta box different names and IDs in my opinion. The fact that you are using “piano” for both could be problematic.
    2. Instead of using “add_meta_boxes_page,” use “add_meta_boxes_post.” The tag you are using for posts is incorrect.
    3. Before saving, verify the user input. You are not taking that risk by not doing it.

    I’m hoping that it will be very beneficial to you. Wishing you the Good Luck!

    Thread Starter sacconi

    (@sacconi)

    Ok, I found some code in the web that is working fine, with an array, my only problem is the in the editor I cant see correclty the carachter “°”

    
    
    
        $piani = array(
            __(' 1st floor, ','sacconicase') => ' 1°piano ',
              __(' 2nd floor, ','sacconicase') => ' 2°piano ',
    
      __(' 3rd floor, ','sacconicase') => ' 2°piano ',
    
        );
    

    Is there a solution?

    stormbreaker7

    (@stormbreaker7)

    Hii,

    So, you wanna show the degree symbol “°” in the PHP code. I think it is because of how your file or editor is encoded. For this, you can try the following things:

    • With the use of UTF-8 encoding, just save your file. After that, it can show the degree symbol and other special characters.
    • Apply UTF-8 encoding in your editor, or you can also use an editor that has UTF-8 by default like Notepad++.
    • Use ° in the place of “°” in your code. So, it will show the degree symbol in any browser, with no worry about the encoding.

    I hope it will surely work for you. Good Luck!

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘new meta box in post editor with select’ is closed to new replies.