I’ve created a custom metabox with a textarea in it. How would I go about using Markdown in this textarea? I’ve seen some WP plugins but they seem to only be for the main editor.
3 comments
Comments are closed.
I’ve created a custom metabox with a textarea in it. How would I go about using Markdown in this textarea? I’ve seen some WP plugins but they seem to only be for the main editor.
Comments are closed.
You can download a copy of PHP Markdown and use it to parse the textarea contents before you save it:
I installed ACF Custom Field WYSIWYG and Markdown Extra.
In
functions.php
, add code:Every custom post field that uses
acf_the_content
will convert to Markdown. You can use the main content too:The best Markdown parser I’ve found so far is the
Parsedown
. Something like this:If you are dealing with a client this is the way to go, Parsedown is almost bulletproof.