vendredi 28 novembre 2014

How to put a url image as a value in a select box


I have got a select box which has 3 options, in each of the values I want to put a link to an image stored in a folder. Then I'm going to use the get_post_meta to display the image that has been selected.


Here is my code so far:



array(
'label'=> 'Select Box',
'desc' => 'A description for the field.',
'id' => $prefix.'select',
'type' => 'select',
'options' => array (
'one' => array (
'label' => 'Option One',
'value' => '?> <img src="<?php bloginfo('template_directory'); ?>/images/mainimage.jpg" title="" alt="" /><?php'
),
'two' => array (
'label' => 'Option Two',
'value' => 'another url to a different image will go here'
),
'three' => array (
'label' => 'Option Three',
'value' => 'another url to a different image will go here'
)
)
)


I get the following image in the browser:


Parse error: syntax error, unexpected 'template_directory' (T_STRING), expecting ')'


Should I use template_directory for something like this?





Aucun commentaire:

Enregistrer un commentaire