ThemeShaper Forums » Thematic

[closed]

Adding to thematic_after_widget_area content

(10 posts)
  • Started 2 years ago by amish1
  • Latest reply from amish1
  • This topic is resolved
  1. I have searched this forum high and low, and though I have learned TONS there are still a few things that I am not getting. I think if someone can answer my question it should tie together everything that I have done so far. I have been able to move things to other hooks, and I have also modified my #wrapper div to also contain a custom class. What I am trying to do now is add '<div class="clear"></div>' before closing the UL in the widget areas (thematic_after_widget_area). I have found the function but I am having trouble making it out what I need because the function uses return instead of echo (which differs from the tuts that I have found on here.) Also is there any way to add this to the after_widget_area of only one widget area (page-top). I apologize if my question has been answered or this is remedial, but I am seeing the benefits of thematic and I am hoping, like I said, that this ties it all together. Thanks in advance for any assistance.

    Posted 2 years ago #
  2. can i ask why? strikes me that there is probably another way to do whatever it is you are trying to do that doesn't involve adding additional markup

    also since thematic_after_widget_area "returns" something.... that's usually a tip off that you need to filter something.

    read up on filters w/ my "primer"
    http://forums.themeshaper.com/topic/need-help-understanding-actions-vs-filters-and-changing-post-meta-and-utility#post-22638

    Posted 2 years ago #
  3. Thank you for the quick response! After all the reading that I have done I figured if helgatheviking responded I would be on my way to figuring this out. I have read your primer and found it very helpful, just not connecting the dots of how to use it for any given condition.

    What I am doing is moving the page-top widget to above_container and to create a full width widget area to float 3 (or 4 etc.) list items in. I have been able to do all of that except add a clear inside the unordered list. I was hoping this would be an easier fix than creating a new widget area, but a few hours later and I am starting to second guess that.

    Should I not be trying to additional markup to things, even if my child theme? I have added a class of container to the wrapper with the thought of implementing the 960 system as that is what the HTML mock up that I am basing my child theme on.

    Posted 2 years ago #
  4. From what I could tell this is what I need to be looking for for closing the widget areas (widgets-extensions.php):

    function thematic_after_widget_area($hook) {
    	$content = "\n" . "\t" . '</ul>' ."\n";
    	if ($hook == 'primary-aside') {
    		$content .= '</div><!-- #primary .aside -->' ."\n";
    	} elseif ($hook == 'secondary-aside') {
    		$content .= '</div><!-- #secondary .aside -->' ."\n";
    	} elseif ($hook == '1st-subsidiary-aside') {
    		$content .= '</div><!-- #first .aside -->' ."\n";
    	} elseif ($hook == '2nd-subsidiary-aside') {
    		$content .= '</div><!-- #second .aside -->' ."\n";
    	} elseif ($hook == '3rd-subsidiary-aside') {
    		$content .= '</div><!-- #third .aside -->' ."\n";
    	} else {
    		$content .= '</div><!-- #' . $hook . ' .aside -->' ."\n";
    	}
    	return apply_filters('thematic_after_widget_area', $content);
    }

    I would like to add <div class="clear"></div> right before the </ul>, and like I said I would like to be able to only apply this to the page-top widget area.

    Posted 2 years ago #
  5. you just happened to catch me when i am intentionally trying to procrastinate. ;)

    so i am going to guess that you are floating the widgets inside the widget area and need to clear those floats in which case i'd probably go w/ a clearfix versus adding markup since i find adding markup is inelegant. ;)

    in this thread you will see how to filter the class name of a widget area
    http://forums.themeshaper.com/topic/how-to-rename-widget-area-classes#post-11326

    so:

    add_filter('thematic_before_widget_area', 'kia_pagetop_class');
    
    function kia_pagetop_class($content) {
    	$kia_class = str_replace('page-top" class="aside', 'page-top" class="aside cf', $content);
    	return $kia_class;
    }

    and then in your stylesheet

    /* http://nicolasgallagher.com/micro-clearfix-hack/ */
    /* For modern browsers */
    .cf:before,
    .cf:after {
        content:"";
        display:table;
    }
    
    .cf:after {
        clear:both;
    }
    
    /* For IE 6/7 (trigger hasLayout) */
    .cf {
        zoom:1;
    }

    i've also used the perishable press method w/ great success:
    http://perishablepress.com/press/2009/12/06/new-clearfix-hack/

    if that doesn't do what you want then i'll try to actually add the extra div

    Posted 2 years ago #
  6. I am at work now,(procrastinating just like you!) So I will give this a go when I get home tonight and mark this resolved or pick your brain a little harder. Thanks a million for your time!

    Posted 2 years ago #
  7. That works splendidly! Thank you so much! =)

    Posted 2 years ago #
  8. While researching the micro clear fix hack I found a comment on css-tricks.com that I also found useful. With the above method of filtering the widget area the div cleared the list items. With the use of overflow:hidden in the css for the ul of the widget this will fix it also.

    Posted 2 years ago #
  9. good point. you might not need to filter anything. does the overflow:hidden trick work on all browsers?

    Posted 2 years ago #
  10. As far as I can tell, yes.

    Posted 2 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.