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
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, @$tmp )) + '...'; $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!
Hari Karam Singh