Huw to style output from shortcode
-
In Wp-content have I folder Plugins and in Plugins have I folder ContactInfo. In ContactInfo have I contactInfo.php.
In this contactInfo.php have a the code below.
If I want to style the output from the shortcode how do I do that ?
I mean I can create a folder css in my plugin folder ContactInfo
and put a style.css in there.But now to my question I must in some way reference this style.css from my contactInfo.php?
<?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 )
{
extract(shortcode_atts(array(
‘person’ => ‘noName’
),$atts));switch($person)
{
case ‘anna’:
$result = “<img src='”.plugin_dir_url(__FILE__).’images/anna.jpg’.”‘ alt=’Bild på Anna Persson’ />
“;
$result .= “Namn: Anna Persson
“;
$result .= “Telefon: 08-123465
“;
$result .= “Adress: Stigen 55, 123 45 Småstad
“;
$result .= “E-mail: anna.person@telia.com“;
break;
case ‘bosse’:
$result = “<img src='”.plugin_dir_url(__FILE__).’images/bosse.jpg’.”‘ alt=’Bild på Bosse Hult’ />
“;
$result .= “Namn: Bosse Hult
“;
$result .= “Telefon: 08-987654
“;
$result .= “Adress: Kåken 99, 123 45 Storstad
“;
$result .= “E-mail: bosse.hult@telia.com“;
break;
case ‘catrin’:
$result = “<img src='”.plugin_dir_url(__FILE__).’images/catrin.jpg’.”‘ alt=’Bild på Catrin Ås’ />
“;
$result .= “Namn: Catrin Ås
“;
$result .= “Telefon: 099-55555
“;
$result .= “Adress: Kåken 123, 111 22 Mellanstad
“;
$result .= “E-mail: catrin.Ås@telia.com“;
break;
case ‘noName’ :
$result = ‘No name given’;
break;
}return $result;
}
?>
- The topic ‘Huw to style output from shortcode’ is closed to new replies.