Options for before_content and after_content in sidebars

  1. Sayontan


    For creation of sidebars we specify before_widget, before_title, after_title and after_widget parameters. Is it possible to have something for before_content and after_content as well?

    Some theme authors (like myself) use docking boxes in the theme. To enable features like expand and collapse in docking boxes we use the header as a "handle" and the rest of the widget text as "content" - using the handle we can collapse the content. Note that the entire body (including the header) cannot be designated as "content", because then minimizing will cause the whole widget to disappear. To differentiate the content from the rest of the widget we start div class='content' in the after_title parameter and close the div in the after_widget parameter.

    But there are widgets that do not print the before_title and after_title parameters. The standard text widget, for example doesn't print them if you don't specify a title. And there are tons of custom widgets that do the same. Not displaying the after_title tag in these widgets effectively causes it to drop the start div tag and creates an extra closing div tag. This causes the document to become malformed and it fails validation.

    Posted: 9 years ago #
  2. digitalnature



    these parameters would also allow theme author to style the widget content separately, like they want, so you'll see nicer themes designed :D

    the only problem will be backward compatibility with plugins. Not all developers will update their plugins with before/after_content...

    Posted: 9 years ago #
  3. Andy Macaulay-Brook


    I'd rather not see anything that forced particular html into a widget - it should be entirely up to the widget author.

    Posted: 8 years ago #

RSS feed for this topic


You must log in to post.

  • Rating

    9 Votes
  • Status

    Good idea! We're working on it