How to modify post content before output to blog
-
Hi all!
I am setting up a blog where most/all of the post are excpected to contain an identical set of information. Since I would like to structure these pieces of information a bit in the output of each post – and alwas in identical fashion, I intend to write a plugin that does just that.
Basically, it should recognize a couple of tags that I would use in all of my post, e.g.,
[item1]MyContent[/item1] [item2]MyContent[/item2] ... etc.
so as for the plugin to be able to parse the post’s content and replace the tags with HTML-elements that would allow me to build the desired structure and add the desired formatting (via CSS).
I have gotten as far as identifyfing the relevant hook
add_filter('the_content', 'myFunction');
and linking my stylesheet
echo '<link type="text/css" rel="stylesheet" href="' . get_bloginfo('wpurl') . '/wp-content/plugins/myPath/myStyleSheet.css" />' . "\n";
.I am suspecting that I will have to retrieve
$post->post_content
to apply my modifications, but this is just a suspicion, since I have not been able to test anything yet.
I am failing, however, to understand how I return my modified content (which I expect to be stored in a string variable after the above operations) to ‘the loop’ so that it will be output to screen.
Can anyone give me the necessary spark of inspiration?
TIA
Matthias
- The topic ‘How to modify post content before output to blog’ is closed to new replies.