Viewing 10 replies - 1 through 10 (of 10 total)
  • Can’t you just open up sidebar.php and put an image there?

    You can add an image in a text-widget. Just supply the appropriate html. If all you want is a simple static image, this should do it.

    Thread Starter gwuido74

    (@gwuido74)

    Sorry I’m not really following this, could you explain further please.

    Thanks

    I think he’s just saying that you can get a text-widget to enter the html code for the image into sidebar.php

    Thread Starter gwuido74

    (@gwuido74)

    Thanks

    Ok.

    christian_d suggested that you edit the php file that controls your sidebar. This will work if you have a static sidebar. It gets overwritten if you add widgets to your sidebar. I suppose that does depend somewhat on how sidebar.php is written though.

    My suggestion was to login and navigate to Appearance->Widgets and drag a Text widget (Just labeled ‘Text’) over into the sidebar. Then add an image to it– <img src="pathe/to/image" alt="cool image" />.

    Thread Starter gwuido74

    (@gwuido74)

    Yes I am having problems, if I add widgets to my sidebar it gets overwritten.

    Can I do anything about this.

    Thanks

    Thread Starter gwuido74

    (@gwuido74)

    By the way my sidebar PHP is written like this

    <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar() ) : ?>

    Yes. That’s right. You can have a static sidebar and use no widgets or you can use widgets and not use the default static sidebar. Whatever your static sidebar looks like, you can recreate it with widgets pretty easily. My advise is to do that because chances are that one day you’ll find something you want to use and that something will to be a widget.

    Hi,

    Thought I’d throw out another point of view. This is assuming you have some XHTML/CSS knowledge.

    I add images and text to sidebars all the time, by editing the sidebar.php, and haven’t had any display issues.

    What you might look at is how your sidebar function, <?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> is displayed in your sidebar.php. If it’s wrapped in its own <div id>, <div class>, or <ul>, you need to add the image outside the <div>s or <ul>, either before or after, to have it display without conflict.

    You can wrap the image in its own <div class> or <img class> as well, to properly position the image within the sidebar using your style.css.

    I use widgets all the time, but have never considered using one to insert an image or simple text. However, that being said, it may be the easiest way for someone in a hurry or just starting out. Nothing wrong with that. It might be confining, though, if you progress into multiple images or more complex layouts.

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘How Do I add an image to the sidebar’ is closed to new replies.