The plugin author used this code to show off the new reactions to forum posts which works perfect,
function add_reactions($reactions) {
$reactions['heart'] = array(
'icon' => 'fas fa-heart',
'screen_reader_text' => __('Click for heart.', 'asgaros-forum')
);
return $reactions;
}
add_filter('asgarosforum_reactions', 'add_reactions');
However when I try adding multiple reactions it causes a critical error, obviously I'm doing something wrong...
function add_reactions($reactions) {
$reactions['amar'] = array(
'icon' => 'fas fa-heart',
'screen_reader_text' => __('Amar', 'asgaros-forum')
);
return $reactions;
}
function add_reactions($reactions) {
$reactions['divertido'] = array(
'icon' => 'fas fa-laugh',
'screen_reader_text' => __('Divertido', 'asgaros-forum')
);
return $reactions;
}
function add_reactions($reactions) {
$reactions['triste'] = array(
'icon' => 'fas fa-sad-tear',
'screen_reader_text' => __('Triste', 'asgaros-forum')
);
return $reactions;
}
function add_reactions($reactions) {
$reactions['enojado'] = array(
'icon' => 'fas fa-angry',
'screen_reader_text' => __('Enojado', 'asgaros-forum')
);
return $reactions;
}
function add_reactions($reactions) {
$reactions['sorprendido'] = array(
'icon' => 'fas fa-surprise',
'screen_reader_text' => __('Sorprendido', 'asgaros-forum')
);
return $reactions;
}
function add_reactions($reactions) {
$reactions['genialidad'] = array(
'icon' => 'fas fa-fire',
'screen_reader_text' => __('Genialidad', 'asgaros-forum')
);
return $reactions;
}
function add_reactions($reactions) {
$reactions['elegante'] = array(
'icon' => 'fas fa-lightbulb',
'screen_reader_text' => __('Elegante', 'asgaros-forum')
);
return $reactions;
}
add_filter('asgarosforum_reactions', 'add_reactions');
I've tried everything I know, still get critical errors on frontend wordpress site.
You should use like this
function add_reactions($reactions) {
$reactions['amar'] = array(
'icon' => 'fas fa-heart',
'screen_reader_text' => __('Amar', 'asgaros-forum')
);
$reactions['divertido'] = array(
'icon' => 'fas fa-laugh',
'screen_reader_text' => __('Divertido', 'asgaros-forum')
);
$reactions['triste'] = array(
'icon' => 'fas fa-sad-tear',
'screen_reader_text' => __('Triste', 'asgaros-forum')
);
$reactions['enojado'] = array(
'icon' => 'fas fa-angry',
'screen_reader_text' => __('Enojado', 'asgaros-forum')
);
$reactions['sorprendido'] = array(
'icon' => 'fas fa-surprise',
'screen_reader_text' => __('Sorprendido', 'asgaros-forum')
);
$reactions['genialidad'] = array(
'icon' => 'fas fa-fire',
'screen_reader_text' => __('Genialidad', 'asgaros-forum')
);
$reactions['elegante'] = array(
'icon' => 'fas fa-lightbulb',
'screen_reader_text' => __('Elegante', 'asgaros-forum')
);
return $reactions;
}
add_filter('asgarosforum_reactions', 'add_reactions');