Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress

Giorgia Makris
Giorgia Makris
3,377 Points

How to Build a Wordpress Theme: adding widgets

I'm trying to make sidebar widgets in addition to the footer widgets in this lesson. I'm having some trouble with the grid.css and getting the sidebars to float correctly (plus I'm pretty sure the way I've done it is incorrect).

Does anyone have any suggestions on how to go about doing this without messing up my entire layout?

3 Answers

Giorgia Makris
Giorgia Makris
3,377 Points

Also, I should specify that I want left and right sidebar widget(s) to go on the blog page around the excerpt section - this is where I'm having the grid/floating issues.

Zac Gordon
STAFF
Zac Gordon
Treehouse Guest Teacher

Hi! Is the actual WP widget PHP code working for you and it's more of a CSS issue that you're dealing with?

Do you have a link or code that we can look at?

Giorgia Makris
Giorgia Makris
3,377 Points

Yes it's mainly CSS - i created a widget for the right sidebar but I need it to float next to my blog posts. I'm just a little confused with the grid styling. This is the code I have for my home.php:

```<?php get_header(); ?>

<div class="grid_12 omega clearfix">

<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

        <?php get_template_part( 'content', 'post' ); ?>



<?php endwhile; else: ?>

    <p>There are no posts or pages here.</p>


<?php endif; ?> 

<div class="sidebar-right"> <?php if( dynamic_sidebar( 'sidebar_right' ) ): ?>

                <?php endif; ?>     
        </div>

</div>

I'm not sure what grid to assign to the sidebar so that it will float alongside instead of placed at the bottom after the blog posts div. Hopefully this makes sense!