Does the tag work with the block editor?
-
I’d like to have clickable headings on one page with expandable content under each one. An old help question on the forum suggested that the <details> tag was the answer.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details
https://www.w3schools.com/tags/tag_details.aspHowever, when I try to use by editing HTML in the block editor, it gives me an “Invalid html” error message.
Is it just impossible to make something expandable in the block editor? Or is there another way around this or something that I’m doing wrong?
For example, the following:
<!– wp:heading –>
<h2>Frogs</h2>
<!– /wp:heading –><!– wp:heading {“level”:4} –>
<h4>Afro-Asiatic Treefrogs (Rhacophoridae)</h4>
<!– /wp:heading –><!– wp:paragraph –>
<p>Brown Treefrog (Polypedates megacephalus)f<br> Dwarf Bush Frog (Philautus parvulus)<br>Pied Warty Frog (Theloderma asperum)</p>
<!– /wp:paragraph –><!– wp:paragraph –>
<p></p>
<!– /wp:paragraph –><!– wp:paragraph –>
<p> Smith’s Litter Frog (Leptobrachium smithi) </p>
<!– /wp:paragraph –>I would like the heading “Frogs” to be the only thing that appears at first, and some form of “click to see” to get the rest of the content (which in reality would be far more of course). How can I do that?
The blog I need help with is: (visible only to logged in users)
-
Hi there,
From the code you posted here, it looks like you’re trying to edit the HTML of a paragraph block. That won’t work.
To use the details HTML tag as explained at https://en.support.wordpress.com/advanced-html/#collapsible-content-accordion-effect, you need to use the HTML block instead:
There do exist blocks for this as well, but none of them are currently available on WordPress.com and can only be added via plugins on our Business Plan. We are working on adding a block for this to WordPress.com as well, but I’m not able to tell you when that might be ready, so for now the HTML block is the only option.
- The topic ‘Does the tag work with the block editor?’ is closed to new replies.