You appear to be a bot. Output may be restricted
Description
Build list of attributes into a string and apply contextual filter on string.
The contextual filter is of the form `genesis_attr_{context}_output`.
Usage
$string = genesis_attr( $context, $attributes, $args );
Parameters
- $context
- ( string ) required – The context, to build filter name.
- $attributes
- ( array ) optional – Optional. Extra attributes to merge with defaults.
- $args
- ( array ) optional – Optional. Custom data to pass to filter.
Returns
string String of HTML attributes and values.
Source
File name: genesis/lib/functions/markup.php
Lines:
1 to 25 of 25
function genesis_attr( $context, $attributes = [], $args = [] ) { $attributes = genesis_parse_attr( $context, $attributes, $args ); $output = ''; // Cycle through attributes, build tag attribute string. foreach ( $attributes as $key => $value ) { if ( ! $value ) { continue; } if ( true === $value ) { $output .= esc_html( $key ) . ' '; } else { $output .= sprintf( '%s="%s" ', esc_html( $key ), esc_attr( $value ) ); } } $output = apply_filters( "genesis_attr_{$context}_output", $output, $attributes, $context, $args ); return trim( $output ); }