Jan-Philip Gehrcke, could you provide any insight here?
Hey, please excuse the late reply and thanks for the reminder. I did not find time to deeply think about why exactly this does not work, nor did I come up with a solution. This is my diagnosis from the top of my head:
WP-GeSHi-Highlight directly accesses $wp_query->posts
from within the template_redirect
hook and looks for the <pre lang="..">...</pre>
occurrences in there. Only those are processed. The plugin only operates on $post->post_content
and on the comments returned by get_approved_comments($post->ID)
. I am quite sure that whatever you are doing is entirely “invisible” to WP-GeSHi-Highlight, because you seem not to operate on the blog or comment content at all.
Does this provide enough information for you to better understand the issue?
Please let me know when you have a well-founded idea how we could change WP-GeSHi-Highlight to enable what you are trying to achieve and w/o breaking existing systems. Thanks!
Jan-Philip,
I went ahead and took a crack at adding this functionality in myself. This plugin is designed to run very early; much too early for it to be aware of any custom fields that do not get called until we are in the template code.
The best solution I can find to support not just Advanced Custom Fields, but any kind of custom field, is to use a custom filter.
With some additions to your plugin, we can apply syntax highlighting to any custom field like so:
echo apply_filters( ‘geshi_highlight’, $my_custom_field_content );
You will find the required additions to your plugin to make this work here: https://gist.github.com/mattkeys/e7a34a34bf6cb04ee757
Note the extra filter on line 146 and the new function starting on line 202.
It would be great if you can integrate these additions into the plugin.