This is really throwing me off. I have heard high recommendations for GeneratePress, but as a developer, I can’t find a function reference anywhere. I was looking to have a deep understanding of what
generate_do_attr
does, because it is used in the “single.php” file. It doesn’t seem intuitive to me so I went looking for the ubiquitous function reference / API but could find none. The two main sites I found the most helpful are:
1. [https://houradaywp.wordpress.com/2024/04/05/day-5-continuing-index-php-the-loop-learning-style-css/](https://houradaywp.wordpress.com/2024/04/05/day-5-continuing-index-php-the-loop-learning-style-css/)
2. [https://github.com/tomusborne/generatepress/blob/master/inc/theme-functions.php#L744](https://github.com/tomusborne/generatepress/blob/master/inc/theme-functions.php#L744)
3. [https://docs.generatepress.com/?s=generate\_do\_attr](https://docs.generatepress.com/?s=generate_do_attr)
But, even the GeneratePress theme-functions.php code doesn’t clearly explain what it is or how to use it. Is **generate\_do\_attr()** just a wrapper for some other function? It doesn’t seem to follow the WordPress standard [template hierarchy](https://i0.wp.com/developer.wordpress.org/files/2023/10/template-hierarchy-scaled.jpeg?resize=1024%2C562&ssl=1). Here is the entire code for the function:
/**
* Output our string of HTML attributes.
*
* @since 3.1.0
*
* @param string $context The context, to build filter name.
* @param array $attributes Optional. Extra attributes to merge with defaults.
* @param array $settings Optional. Custom data to pass to filter.
*/
function generate_do_attr( $context, $attributes = array(), $settings = array() ) {
echo generate_get_attr( $context, $attributes, $settings ); // phpcs:ignore — Escaping done in function.
}
What “string of HTML attributes”? Are they saying that it will render to the page things like style, class, selected, readonly, etc.? If so, in what context? And what context?
I have included that because inevitably somebody will ask “what function are you having a problem with?”. But, at this point, ***I’d just like someone to point me to the function reference*** so I can bookmark it — obviously link 3 can’t be it, since there are no results for the generate\_do\_attr function.
Thanks for any help!
[ad_2]