The problem with admin panel theme
-
Dear friends, I need your help.
I have such a problem: I’m creating a template with admin panel. There are a few fields, which I would use for sending information to the site.
But writing all the fields takes too much time and space and the file will be so large.
I created a function, then I tried to use it from one place, where I would like to display a specific field.function get_image_field( $field, $field_name, $button_id ) { ?> <label for="r_options[<?php echo $field; ?>]"><?php echo $field_name; ?></label> <input type="text" id="r_options[<?php echo $field; ?>]" class="upload_image" name="r_options[<?php echo $field; ?>]" value="<?php echo esc_attr( $options[$field] ); ?>" /> <input type="button" id="<?php echo $button_id; ?>" class="upload_image_button" value="Upload" /> <?php }When I use a function, the data is sending through the form, but doesn’t stay in the field.
But when I don’t use a function, but write all the fields with “label, input and button”, the data is sending through the form and stay in the field. At the same time, this process is too time- and spaceconsuming.<label for="r_options[r_logo_url]">Upload Logo</label> <input type="text" id="r_options[r_logo_url]" class="upload_image" name="r_options[r_logo_url]" value="<?php echo esc_attr( $options['r_logo_url'] ); ?>" /> <input type="button" id="r_logo_upload_button" class="upload_image_button" value="Upload" />First screenshot (without function):
http://i.pixs.ru/storage/2/7/0/Snimokekra_6578211_10904270.png
Second one (using a function):
http://i.pixs.ru/storage/2/7/5/Snimokekra_2571682_10904275.png
You can see, that in the first example the data is sending and at the same time saving in the field. The data is only sending in the second example.
In my template I use such a code:/* Get options */ if ( !function_exists( 'r_get_option' ) ) : function r_get_option( $option ) { $options = get_option( 'r_options', r_default_options() ); return $options[ $option ]; } endif;If you have an idea how to solve this problem, please help me. Thanks.
-
That’s NOT a free hosted WordPress.COM blog and we do not provide support for it here. You are posting to the wrong support forum. WordPress.com and WordPress.org are completely separate, have different log-ins and run different versions of themes with same names. http://support.wordpress.com/com-vs-org/
We provide support only for free hosted WordPress.COM blogs and not for WordPress.org software installs. If you don’t have a username account at WordPress.ORG click http://wordpress.org/support/ and register one on the top right hand corner of the page that opens, so you can post to the support forums there and receive advice from WordPress.ORG bloggers.
-
- The topic ‘The problem with admin panel theme’ is closed to new replies.