- This topic has 4 replies, 2 voices, and was last updated 7 years, 7 months ago by
Steve.
-
AuthorPosts
-
-
June 24, 2014 at 1:25 pm #1889
civilzMemberhi
i use this code in setting section :piklist('field', array( 'type' => 'file' ,'field' => 'logo_upload_file' ,'scope' => 'post_meta' ,'label' => 'plz upload logo' ,'description' => 'Size Only : 97 x 338 px' ,'options' => array( 'basic' => true ) ));and use this theme :
<a href="#"><img class="head-logo" src="<?php bloginfo('template_directory'); ?/images/logo.jpg"></a>i want set the upload img url on the :
src="<?php bloginfo('template_directory'); ?>/images/logo.jpg">how to set?
-
June 24, 2014 at 1:28 pm #1890
civilzMemberi read :
`
http://piklist.com/user-guide/tutorials/displaying-images-upload-field/
`
but not working !! -
June 24, 2014 at 4:54 pm #1892
SteveKeymaster1) Since this is a setting, let’s grab all your settings:
$settings = get_option('my_settings');. Replacemy_settingswith whatever is in the comment block of your settings file.
2) Now let’s find the image ID for the fieldlogo_upload_file:$image_id = $settings['logo_upload_file'];
3) WordPress gave us back an array, but we are only interested in the first key=>value pair:$image_id = $image_id[0];
4) Now that we have the image ID for the attachment, lets use a standard WordPress function to display the associated image:<a href="#"><img class="head-logo" src="<?php echo wp_get_attachment_url($image_id);?>"></a>FULL CODE
$settings = get_option('my_settings'); $image_id = $settings['logo_upload_file']; $image_id = $image_id[0];<a href="#"><img class="head-logo" src="<?php echo wp_get_attachment_url($image_id);?>"></a>Let me know if you still have any issues.
-
June 26, 2014 at 2:30 am #1897
civilzMemberthanks but not work !
my code :
theme code :<?php $settings = get_option('my_theme_settings'); $image_id = $settings['logo_upload_file']; $image_id = $image_id[0]; ?> <a href="#"><img class="head-logo" src="<?php echo wp_get_attachment_url($image_id); ?>"></a>themesetting code :
* Title: setting Setting: my_theme_settings */ /*---LOGO---*/ piklist('field', array( 'type' => 'file' ,'field' => 'logo_upload_file' ,'scope' => 'post_meta' ,'label' => 'logo upload' ,'description' => 'Size Only : 97 x 338 px' ,'options' => array( 'basic' => true ) ));but nothing display !
-
June 26, 2014 at 9:38 am #1898
SteveKeymaster@civilz– I believe this is not working because you are on a settings page and setting:
'scope' => 'post_meta'.Let Piklist determine the scope automagically:
piklist('field', array( 'type' => 'file' ,'field' => 'logo_upload_file' ,'label' => 'logo upload' ,'description' => 'Size Only : 97 x 338 px' ,'options' => array( 'basic' => true ) ));
-
-
AuthorPosts
- The topic ‘displaying images upload field problem!!!’ is closed to new replies.