Adding more H tags to the editor
Submitted by retlas on Tue, 04/04/2017 - 15:21
Forums:
Hi All,
Got some custom CSS working with H5P but want to add a couple extra tagged tyles for repetitive styling; H4 & H5.
Can't see to find a way to add the extra tagging to the Paragraph Format dropdown in the course presentation editor.
Screeshot: http://d.pr/i/I2w9
Any guidance would be appreciated.
Worpress 4.7.3 & H5P 1.7.13
icc
Wed, 04/05/2017 - 09:55
Permalink
Hi,You'll need to implement
Hi,
You'll need to implement an action listener for the h5p_alter_library_semantics action in your theme or a custom plugin:
function mymods_h5p_semantics_alter(&$semantics) { foreach ($semantics as $field) { // Go through list fields while ($field->type === 'list') { $field = $field->field; } // Go through group fields if ($field->type === 'group') { mymods_h5p_semantics_alter($field->fields); // Check your function name! continue; } // Check to see if we have the correct type and widget if ($field->type === 'text' && isset($field->widget) && $field->widget === 'html') { // Found a field. Add support for table tags. if (!isset($field->tags)) { $field->tags = array(); } $field->tags = array_merge($field->tags, array( 'h4', 'h5' )); } } } add_action('h5p_alter_library_semantics', 'mymods_h5p_semantics_alter');The example above will add h4 and h5 tag support to all wysiwyg fields in the editor.