I’m quite unexperienced with the WordPress internals and ask myself how to change the html page head in dependence on the post content.
[The motivation: A filter on
the_contentaccomplishes syntax highlighting and generates CSS code. To achieve a valid document, this CSS code has to end up between <head> and </head>.]
Therefore, I have to use:
(a) a filter on
In general, I want to build a string S which depends on the content.
The string S built in dependence on the content should end up in the header between <head> and </head>.
Is this possible in theory? Or will it be impossible due to some chronological order things are called/evaluated?
My first idea was to just call
add_filter('the_content', 'some_func_building_S', 99); add_action('wp_head', 'some_func_echoing_S');
but it seems like it does not work using this simple approach.
Thank you for any suggestions!
- The topic ‘Edit head (via wp_head) after filtering content (via the_content)’ is closed to new replies.