comments_popup_link_attributes
Фільтрує атрибути посилання, що виводить функція comments_popup_link() .
Використання
add_filter( 'comments_popup_link_attributes', 'wp_kama_comments_popup_link_attributes_filter');
/**
* Function for `comments_popup_link_attributes` filter-hook.
*
* @param string $attributes Комментарі link attributes.
*
* @return string
*/
function wp_kama_comments_popup_link_attributes_filter( $attributes ){
// Filter...
return $attributes;
}- $attributes
(рядок) - Атрибути посилання.
За замовчуванням: ”
Приклади
#1 Додамо свій атрибут data
Додасть атрибут data-postid із ID запису.
add_filter( 'comments_popup_link_attributes', 'filter_comments_popup_link_attributes');
function filter_comments_popup_link_attributes( $attrs ) {
$my_attr = sprintf( 'data-postid="%d"', get_the_ID() );
return $attrs ? "$attrs $my_attr": $my_attr;
}
список змін
| З версії 2.5.0 | Введено. |
Де викликається хук
comments_popup_link_attributes
Де використовується хук у WordPress
Використання не знайдено.