Wordpress PHP snipet to shortcode.
The following php code when added to the html of a post prints the folowing:
Price/per: [custom field :'item price'] €
or if the site is in greek (qtranslate):
Τιμή/τεμ: [custom field :'item price] €
<?php $price = get_post_meta(get_the_ID(),'item_price',true);?>
<span align="center">'<?php _e("<!--:en-->Price/per: <!--:--><!--:EL-->Τιμή/τεμ: <!--:-->"); ?><?php echo $price;?><?php echo "\xE2\x82\xAc";?>'</span>
What i'd like to do is create a shortcode so i don't have to go to html and copy paste this snippet in every post. Instead i'd like to type [price] and simply set a value to my custom field.
The custom field is also displayed in the categories and soon in the store page. So i'd like to automate this as much as possible. I've tried to make the shortcode in several ways and i've tried several insert php to post plugins... All my function.php attempts result in a white screen and the site going unresponsive, the only way to recover is to ftp a copy of function.php to replace my changes.. No empty space is left at the end btw.
The site is mainly empty due to small issues but the link is <snip>
Another issue i have, is there any way to automatically fill in the style variable when adding an image to post? Everytime i have to click, image properties, advanced and type into styles : border-radius:10px;