Forum Replies Created

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter tonytj

    (@tonytj)

    Löst

    Thread Starter tonytj

    (@tonytj)

    Good explained!!

    Thread Starter tonytj

    (@tonytj)

    This code below is working and placed in contactInfo.php in the folder ContactInfo in folder Plugin.

    Is it a better way of doing this then what I have done here ?
    I have tvo questions.
    First question. Can I get this information from the database insteqad?

    Second question. If I want to add a picture to each person how do i do that?

    <?php
    /*
    * Plugin Name: WordPress ShortCode
    * Description: Create a wordpress contactinfo shortcode
    * Version: 1.0
    * Author: Tony Johansson
    * Author URI: xxx
    */

    //The contactinfo chortcode

    add_shortcode( ‘contact’, ‘getContactInfo’ );

    function getContactInfo( $atts )
    {
    $result =””;
    extract(shortcode_atts(array(
    ‘person’ => ‘noName’
    ),$atts));

    switch($person)
    {
    case ‘anna’:
    $result = ‘Name: Anna Persson
    ‘;
    $result .= ‘Phone: 08-123465
    ‘;
    $result .= ‘Address: Stigen 55, 123 45 Småstad
    ‘;
    $result .= ‘E-mail: anna.person@telia.com
    ‘;
    break;

    case ‘bosse’:
    $result = ‘Name: Bosse Hult
    ‘;
    $result .= ‘Phone: 08-987654
    ‘;
    $result .= ‘Address: Öken 99, 123 45 Storstad
    ‘;
    $result .= ‘E-mail: bosse.hult@telia.com
    ‘;
    break;

    case ‘catrin’:
    $result = ‘Name: Catrin Ås
    ‘;
    $result .= ‘Phone: 099-55555
    ‘;
    $result .= ‘Address: Kåken 123, 111 22 Mellanstad
    ‘;
    $result .= ‘E-mail: catrin.ås@telia.com
    ‘;
    break;

    case ‘noName’
    $result = ‘No name given’;
    break;
    }

    return $result;
    }
    ?>

    //Tony

Viewing 3 replies - 1 through 3 (of 3 total)