[Plugin: Crayon Syntax Highlighter] HOW-TO: Manually extract unformatting code?
-
Hi,
I’m trying to render a list view in which I need at most the first couple lines of a code block, probably unformatted. Is there a way with the Crayon API I can manually extract and process the content?
get_the_content() returns a [crayon-124] id tag which I gather is being inserted via a hook somewhere as the database has the actual
<pre>....</pre>
content. It’s the later I need, or even better, a way of limiting the output to a couple lines and some ellipses – something like this:$unformatted = get_the_unprocessed_code_content() $tmp = split('\n', $unformatted); $unformatted_shortened = implode('\n', array( $tmp[0], @$tmp[1] )) + '...'; $formatted_shortened = CrayonWP::process($unformatted_shortened);
Barring that, I’d be happy just to have the raw content of the post…
Many thanks. This is stellar plugin by the way. I’ve been through a few of them too!
Gratefully,
Hari Karam Singh
https://club15cc.comhttps://www.ads-software.com/extend/plugins/crayon-syntax-highlighter/
- The topic ‘[Plugin: Crayon Syntax Highlighter] HOW-TO: Manually extract unformatting code?’ is closed to new replies.