How to crrectly write an echo command?

Discussion in 'PHP' started by rushy, Sep 13, 2008.

  1. #1
    Hi Guys,

    I am working on a WordPress theme and am coming up with an issue with widgets.

    I have a widget that I want to style individually into a CSS drop down box.

    I want to add a ul div above the widget and the only option I have to do this is globally, for all widgets...

    I have went into the actual plugin's code and discovered that there may be a way for to manyually add my <ul> but this code is present:
     // These lines generate our output. Widgets can be very complex
        // but as you can see here, they can also be very, very simple.
        echo $before_widget . $before_title . $options['Title'] . $after_title;
    Code (markup):
    I need to set $before_widget so that the <ul ="idname"> tag is added before the widget but I do not know how to correctly amend the line of code above to do this, can someone please help? As you can see, I am certainly no .php expert or even novice for that matter :D
     
    rushy, Sep 13, 2008 IP
  2. live-cms_com

    live-cms_com Notable Member

    Messages:
    3,128
    Likes Received:
    112
    Best Answers:
    0
    Trophy Points:
    205
    Digital Goods:
    1
    #2
    Huh?

    echo displays text to the screen.
    You can set variables with $before_widget = 'text';
     
    live-cms_com, Sep 13, 2008 IP
  3. mwasif

    mwasif Active Member

    Messages:
    816
    Likes Received:
    23
    Best Answers:
    1
    Trophy Points:
    70
    #3
    You can find difference examples of echo here.
     
    mwasif, Sep 13, 2008 IP
  4. VisualMaster

    VisualMaster Guest

    Messages:
    59
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Create a variable :
    Echo it :
     
    VisualMaster, Sep 13, 2008 IP
  5. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #5
    $before_widget .= 'your code here';

    Note the dot, that puts the string after the content of $before_widget.
     
    Icheb, Sep 13, 2008 IP
  6. rushy

    rushy Peon

    Messages:
    251
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Thanks for your help guys, I got it working now
     
    rushy, Sep 15, 2008 IP