dimanche 7 février 2016

Deciphering a WordPress Plugin

I'm trying to understand a section of code from this WordPress plugin: http://ift.tt/1stmJAN. The first thing I don't understand is the value label of the input: value="<?php echo esc_html( get_post_meta( $item_id, '_menu_item_visibility', true ) ); ?>" Can someone explain what is going on here? The variable '_menu_item_visibility' is a WP conditional tag entered by the user, and the menu item is hidden unless the tag evaluates to true. I'm also curious what there is no method label for this input.

function option( $item_id, $item, $depth, $args ) { ?>
                <p class="field-visibility description description-wide">
                        <label for="edit-menu-item-visibility-<?php echo $item_id; ?>">
                                <?php _e('Visibility') ?>:
                                <input type="text" class="widefat code" id="edit-menu-item-visibility-<?php echo $item_id ?>" name="menu-item-visibility[<?php echo $item_id; ?>]" value="<?php echo esc_html( get_post_meta( $item_id, '_menu_item_visibility', true ) ); ?>" />
                        </label>
                </p>


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire