Trying to show an image by usning shortcode
-
Almost everything works fine accept to display the image.
I have the image anna.jpg in the same folder as the php function
getContactInfo where the code to hande the shortcode is located.The text from the switch clause when the case anna match is being displayed correct.
So what is it that I doing wrong here?
<?php /* * Plugin Name: WordPress ShortCode * Description: Create a wordpress contactinfo shortcode * Version: 1.0 * Author: Tony Johansson * Author URI: xxx */ add_shortcode( 'contact', 'getContactInfo' ); function getContactInfo( $atts ) { $result = ""; extract(shortcode_atts(array( 'person' => 'noName' ),$atts)); switch($person) { case 'anna': $result = "Namn: Anna Persson "; $result .= "Telefon: 08-123465 "; $result .= "Adress: Stigen 55, 123 45 Småstad "; $result .= "E-mail: anna.person@telia.com "; $result .= "<img src='anna.jpg' alt='Bild på Anna Persson' />"; break; more case here ... } return $result; } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Trying to show an image by usning shortcode’ is closed to new replies.