• Hello, I’d like to add the sidebar on the homepage, but when I add the php line in index.php, it goes on the bottom left because there is not enough width space I suppose.
    I tried to change everything in the style.css with no success.
    How can I achieve that?

Viewing 8 replies - 1 through 8 (of 8 total)
  • Moderator Kathryn Presner

    (@zoonini)

    Could you please provide a link to your site where folks can see the issue directly.

    Also just a heads-up that if you edited the theme files, your changes will be erased every time you update the theme. The best way to make changes to a theme is to use a child theme, so your tweaks won’t be overwritten when updating the theme. Here are some guides in case you haven’t made one before:

    https://codex.www.ads-software.com/Child_Themes
    https://www.smashingmagazine.com/2016/01/create-customize-wordpress-child-theme/
    https://op111.net/53/

    Thread Starter risine

    (@risine)

    Hi Kathryn,

    thanks for your reply.
    I’m using a child theme already.
    My site is not online yet, just local.
    On a normal page, the sidebar is positioned on the right side of my article, like this :
    post description | sidebar
    On a normal Home page :
    post title | post description

    What I’d like on the homepage is :
    post title | post description | sidebar

    But when I add <?php get_sidebar(); ?> in index.php ( the one I copied in libre-child directory ), the sidebar appears at the BOTTOM-left of the posts before the footer, like this :
    post title | post description
    sidebar

    Thread Starter risine

    (@risine)

    I could send you a picture however

    Moderator Kathryn Presner

    (@zoonini)

    Could you copy the contents of your child theme’s index.php into a Pastebin and link it here?

    https://pastebin.com/

    I could send you a picture however

    Sure – you can upload the screenshot – in a graphic format like JPG, PNG, or PDF – in your Media Library, and provide a link so I can see it, or upload it with a service like Imgur or Snaggy.

    Thread Starter risine

    (@risine)

    here is the pastebin link :
    https://pastebin.com/XUhj9Nwf

    And the picture :
    https://snag.gy/yNzQ4.jpg

    Moderator Kathryn Presner

    (@zoonini)

    There are a few things you’ll need to do to get things looking the way you want, and it’ll take some CSS and HTML skills (or willingness to learn ?? ) in order to achieve.

    You’ll need to:
    – narrow the width of your main column so that there is space for a sidebar, because right now there isn’t
    – float the sidebar to the right
    – float the main column to the left
    – possibly add a new wrapper div with a defined width around both columns in order to place them side-by-side
    – add media queries to make sure all of the above stays responsive, and works on different screen sizes

    If this sounds too complicated, it might be simpler to find a theme that already has the layout you’re looking for. ?? Good luck!

    Thread Starter risine

    (@risine)

    Wow,

    I thought it was just about narrowing the width of my main column ( both “post Title” column & “post description” column ).
    How can I change this width? (I have tried everything in style.css
    with no success)
    For the rest, I’ll try to have a look at that.

    Thanks for your help.

    Moderator Kathryn Presner

    (@zoonini)

    Hi there! Yes, layout changes can definitely seem simple at first but then they become more complicated when you dig in, especially when it comes to maintaining responsiveness. ??

    I think the width you’re looking for is set within a media query here:

    .site {
      margin: 7em auto 0;
      width: 30em;
      padding: 0;
    }
Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Adding sidebar on homepage’ is closed to new replies.