I'm currently creating a custom WordPress theme and using the WordPress Options Framework plugin to make a custom options page for my client. I'm able to easily create an image upload option and can get that uploaded image to show up where I intend it to within my theme's framework. Within my options file (required for the plugin to work), the array I've created for the image upload functionality is the following code:
$options[] = array(
'name' => __('Header Overlay', 'options_framework_theme'),
'desc' => __('This creates a full size uploader that previews the image.', 'options_framework_theme'),
'id' => 'header_overlay',
'type' => 'upload');
Then, within the theme I call that uploaded image with the following code:
<img src="<?php echo of_get_option('header_overlay', 'no entry'); ?>" />
Like I mentioned this all works perfectly. However, what I cannot figure out is how to extract the Alt Text from the image upload dialogue and including it as an echo within the img src tag in the theme. Is there anything I can add within the array above to create something to echo within the theme?
[update]
If I do a search for the text of_get_option
throughout the files, I find one file. This is the code:
if ( ! function_exists( 'of_get_option' ) ) :
function of_get_option( $name, $default = false ) {
$config = get_option( 'optionsframework' );
if ( ! isset( $config['id'] ) ) {
return $default;
}
$options = get_option( $config['id'] );
if ( isset( $options[$name] ) ) {
return $options[$name];
}
return $default;
}
endif;
of_get_option
only returns a string with the image source. Can't this be set to return the full attachment object?of_get_option
throughout the files, I find one file. This is the code:if ( ! function_exists( 'of_get_option' ) ) : function of_get_option( $name, $default = false ) { $config = get_option( 'optionsframework' ); if ( ! isset( $config['id'] ) ) { return $default; } $options = get_option( $config['id'] ); if ( isset( $options[$name] ) ) { return $options[$name]; } return $default; } endif;
$options
. If you do aprint_r
orvar_dump
maybe the site will break. Check this search results for how to debug with FirePHP/FireBug. This option is also good.