• Resolved gpspake

    (@gpspake)


    Hi,

    As far as I can tell there doesn’t seem to be a way to add a custom sidebar to the homepage if you are using an archive instead of a static page.

    In my case I did it by creating a custom sidebar called ‘Homepage Sidebar’ and calling it in home.php like this:

    <aside id="sidebar" class="small-12 large-4 columns">
    <?php dynamic_sidebar( 'Homepage Sidebar' ); ?>
    <aside>

    (Note: the ‘aside’ markup is specific to my theme; yours might be different.)

    I did need to add the markup for before/after the widget and widget title but custom sidebars made that part easy.

    I think it’s (rightfully) assumed that the default sidebar will be used on the homepage so, in most cases, this isn’t necessary but in the case that the homepage sidebar needs to be different from the default, this seems to be the right way to do it.

    Of course, if you are using a static page for your homepage, you can change the sidebar via the edit page screen.

    Hopefully this will be helpful to someone. Please share if there is a better way.

    https://wordpress.org/plugins/custom-sidebars/

Viewing 1 replies (of 1 total)
  • Hi @gpspake,

    Hope you’re well today! 🙂

    Really glad you were able to get it working with that method. Seems totally reasonable to me and I’m sure others will find it helpful!

    Could I just ask though, you mentioned an archive otherwise wouldn’t work for the front-page. The Blog archive, which is default in WordPress, is yet an archive.

    Is that what you’re saying didn’t work though? Or were you trying to get a different/custom archive for the front-page?

    Cheers,
    David

Viewing 1 replies (of 1 total)
  • The topic ‘Adding a custom sidebar to a blog homepage’ is closed to new replies.