body_tag — Get a <body> tag with attributes.

View-related functions

Summary

body_tag($attributes = array())

Get a <body> tag with attributes.

Attributes can be filtered using the ‘body_tag_attributes’ filter.

Parameters:
  • $attributes (array) –

Returns:

string An HTML <body> tag with attributes and their values.

Usage

Examples

Use the body_tag function to set the id and class attributes for an HTML body tag.

<?php echo body_tag(array('id' => 'home', 'class' => 'two-col')); ?>

See Also