Problem with additional custom field in existing meta box

Support General Problem with additional custom field in existing meta boxResolved

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #11068
    lhkeeperlhkeeper
    Participant

    Hello,

    I hope you will be able to help me on this. I created for my project a few meta boxes with a number of custom fields a few month ago. Today I wanted to extend one of them with addition custom field (url link). I added it to the code as I did it before but nothing has been displayed unfortunately. It looks like the new field is not "accepted". I am enclosing the code for your attention below.

    I will appropriate any help on this matter.
    Thanks!

    <?php
    // meta box for Homepage  - Benefits Section
    $meta_boxes[] = [
            'title'  => esc_html__( 'Benefits Section', 'lhk' ),
            'post_types' =>   [
             'page',
            ],
            'context' => 'after_title',
            'priority' => 'default',
            'autosave' => false,
            'include' =>   [
              'relation' => 'AND',
              'template' =>     [
                  'templates/template-homepage.php',
              ],
    
            ],
            'fields' => [
                [
                  'id' => 'benefits_h1',
                  'type' => 'text',
                  'name' => esc_html__('Heading Text', 'lhk'),
                  'desc' => esc_html__('Please insert your text in the box.','lhk'),
                  'size' => 85,
                ],
                [
                  'id' => 'benefits_text',
                  'type' => 'textarea',
                  'name' => esc_html__('Description', 'lhk'),
                  'desc' => esc_html__('Please insert your text in the box.','lhk'),
                ],
                //***** This is a new custom field I wanted to add
                [
                    'id' => 'benefits_button_heading',
                    'type' => 'text',
                    'name' => esc_html__('See more Features', 'lhk'),
                    'size' => 85,
                ],
                [
                    'id' => 'benefits_button_url',
                    'type' => 'url',
                    'name' => esc_html__('Redirection URL', 'lhk'),
                    'desc' => esc_html__('Please insert URL address in the box','lhk'),
                    'size' => 85,
                ],
                //*****
                [
                    'id'     => 'group_benefits',
                    'type'   => 'group',
                    'clone'  => true,
                    'sort_clone' => true,
                    'collapsible' => true,
                    'add_button'  => esc_html__( 'Add FlipBox', 'lhk' ),
                    'group_title' => esc_html__( 'Flip Box', 'lhk' ), // ID of the subfield
                    'save_state' => true,
                    'fields' => [
                        [
                            'id' => 'benefits_image',
                            'type' => 'single_image',
                            'name' => esc_html__('Icon/Image', 'lhk'),
                            'desc' => esc_html__('Please upload your image.','lhk'),
                        ],
                        [
                            'id' => 'benefits_front',
                            'type' => 'text',
                            'name' => esc_html__('Flipbox - Front', 'lhk'),
                            'desc' => esc_html__('Please insert your text in the box.','lhk'),
                            'size' => 85,
                        ],
                        [
                            'id' => 'benefits_back',
                            'type' => 'text',
                            'name' => esc_html__('Flipbox - Back', 'lhk'),
                            'desc' => esc_html__('Please insert your text in the box.','lhk'),
                            'size' => 85,
                        ],
                    ],
                ],
            ],
        ];
    #11099
    Anh TranAnh Tran
    Keymaster

    I see you're using Include Exclude extension. Can you check if these fields appear on that specific page template?

    #11167
    lhkeeperlhkeeper
    Participant

    Hello Anh,

    My apologies for delay in response. At the beginning they didn't appear on the page at all. I deleted and then uploaded my plugin few times in a row and then suddenly they showed up. So everything is working fine at the moment. However I'm wondering what could be the reason for this behavior...

    Thank you,
    Kasia

    #11211
    Anh TranAnh Tran
    Keymaster

    Hi Kasia,

    Glad that the problem is resolved.

    I'm not sure about the bug, neither. Maybe it's some kind of caching / proxy. Some browsers (like Firefox) auto caches the page. So, next time, try to clear the browser cache first.

    I'll mark this topic as resolved. If you need any help, please just reply.

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.