1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

shortcode not working

Discussion in 'WordPress' started by stephan2307, Jun 27, 2011.

  1. #1
    right just writing my first proper plugin. Finished activation and deactivation part.

    Added a new shortcode but for some reason the shortcode is not getting parsed and I am getting no error. As far as I can tell the function to replace the shortcode doesn't even get called.

    here is my code.

    Can anyone see any problems with it?

    
    add_shortcode('cs_currency_converter', 'cs_currency_converter_func');
    
    function cs_currency_converter_func($atts) {
        
        $sql = 'SELECT * FROM `cs_currency` ORDER BY `name`';
        $query = mysql_query($sql);
        
        $options = '';
        
        while ($result = mysql_fetch_assoc($query)) {
            $options .='<option value="'.$result['id'].'">'.$result['code'].' - '.$result['name'].'</option>';
        }
            
        $html = '<form action="#" method="post">';
        
        $html .= '<select name="cs_currency_from">';
        $html .= $options;
        $html .= '</select>';
        
        $html .= '<select name="cs_currency_from">';
        $html .= $options;
        $html .= '</select>';
        
        $html .= '</form>';
        
        return $html;
    }
    PHP:
     
    stephan2307, Jun 27, 2011 IP
  2. stephan2307

    stephan2307 Well-Known Member

    Messages:
    1,277
    Likes Received:
    33
    Best Answers:
    7
    Trophy Points:
    150
    #2
    ok never mind. I fixed the issue myself. seems like 'cs_currency_converter' was too long.

    thanks anyway
     
    stephan2307, Jun 27, 2011 IP