Wordpress: Sidebar question

7 replies
Newbie here trying to set up a test blog.

I have used a new theme, added various widgets and
now want to edit the sidebar to add some graphics.

I have gone to the Theme Editor but the file sidebar1.php
does not seem to correspond to the actual sidebar.

Am I looking in the wrong place ?

Harvey
#question #sidebar #wordpress
  • Profile picture of the author SaSeoPete
    Hi Harvey,

    It should be just sidebar.php. Usually that is your sidebar not sidebar1.php.

    If you want to add an image, you can add it in the text widget for your side bar. Just type in <img src = "http://yoursite.com/Images/pic.jpg"> The bit in bold will be where ever your picture is.

    Pete
    {{ DiscussionBoard.errors[904380].message }}
  • Depends on your themes design as well. Some use multiple sidebars. The trick is just to find a place in the file you think you want to edit and place a few text blurbs... the save. See where they show up?

    Be careful how many links you place in sidebars as they become site wide and if they link out you end up with a ton of outgoing links which may not be very helpful for ranking purposes.
    {{ DiscussionBoard.errors[904390].message }}
    • Profile picture of the author ppc4profit
      Harvey,

      If you are using a theme with two sidebars the files will be located in the theme directory and they are typically called sidebar1.php and sidebar2.php. Older themes and those with only one sidebar may have it called sidebar.php

      These files are set up with a code test to see if you are using any widgets. If you are any pre existing sidebar code will be ignored and your widgets will in effect replace any code you put into the sidebar file, hence it is a bad idea to edit it. Also if you ever change theme the new theme will not have the custom code within the sidebar whereas it will be able to replicate the widgets you had previously selected.

      You can add the code for an image into the 'text' widget as it can take html. eg <img src=" .... " />
      Signature

      Checkout Our Fully Responsive Wordpress Templates
      Mobile Enable Your Wordpress Website Today - With This Plugin
      Online Marketing - We Help With PPC, SMS and QR Code Campaigns

      {{ DiscussionBoard.errors[904472].message }}
      • Profile picture of the author KenJ
        Harvey

        I have edited some sidebars and placed images in them. The problem is that you have to commit to the theme long term or face lots of re-editing if you want to put the images in the new theme.

        I have now started outsourcing theme editing - well one so far - because it can be difficult to get the look you want

        PM me the theme name and I could quickly check it out for you, if you like.

        Kenj
        {{ DiscussionBoard.errors[904493].message }}
      • Profile picture of the author Harvey Segal
        Originally Posted by SaSeoPete View Post

        It should be just sidebar.php. Usually that is your sidebar not sidebar1.php.

        If you want to add an image, you can add it in the text widget for your side bar. Just type in <img src = "http://yoursite.com/Images/pic.jpg"> The bit in bold will be where ever your picture is.
        There is only one sidebar in the theme and the only template says sidebar1.php

        Originally Posted by The Pension Guy View Post

        Make sure you put your manual code outside of the
        <?php if ( !function_exists('dynamic_sidebar')
        ....
        <?php endif ?>
        code portion, i.e. before or after it; otherwise when you activate even one single widget everything that is manually coded inside of the dynamic sidebar code will disappear.
        Ok, the code that I put before and after does show.
        But code in between does not which stops me inserting content between widgets.


        Originally Posted by ppc4profit View Post

        These files are set up with a code test to see if you are using any widgets. If you are any pre existing sidebar code will be ignored and your widgets will in effect replace any code you put into the sidebar file
        Ah - that helps explain some things.

        Originally Posted by ppc4profit View Post

        You can add the code for an image into the 'text' widget as it can take html. eg <img src=" .... " />
        If I can add text widgets in different locations that would solve
        the problem. But is that possible ?

        Harvey
        {{ DiscussionBoard.errors[904591].message }}
        • Profile picture of the author Harvey Segal
          Originally Posted by Harvey.Segal View Post

          If I can add text widgets in different locations that would solve
          the problem. But is that possible ?
          Ah - I've just realised you can move around the widgets
          within the sidebar.

          Problem is solved !

          Thanks everyone.

          Harvey
          {{ DiscussionBoard.errors[904818].message }}
  • Profile picture of the author The Pension Guy
    Caution when you edit widgetized sidebars (and nowadays every WP theme is widget ready, so it applies to all...)
    A sidebar can be as simple as
    PHP Code:
    <div id="sidebar1">
    <ul>
    <?php     /* Widgetized sidebar, if you have the plugin installed. */
            
    if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar(sidebar1) ) : ?>
            
    <?php endif; ?>
    <li></li>
    </ul>

    </div>
    Then you can drag into it as many widgets as you wish, they will show up on the site but the sidebar code will not change!

    Make sure you put your manual code outside of the
    <?php if ( !function_exists('dynamic_sidebar')
    ....
    <?php endif ?>
    code portion, i.e. before or after it; otherwise when you activate even one single widget everything that is manually coded inside of the dynamic sidebar code will disappear.
    Signature

    {{ DiscussionBoard.errors[904456].message }}

Trending Topics