I'm using a wordpress backend on my site and displaying the articles via my own way on the front end. I can't seem to find the file that parses the outp开发者_StackOverflow社区ut of posts. I'm trying to get to the code that process a post so that I can copy it for my site and make some minor changes to how it's displayed on my site.
Any ideas on where this file is? I've been through about 15 files searching but it's growing tiresome.
Your question is unclear. The function which processes the caption shortcode is img_caption_shortcode
and is in wp-includes/media.php
. If you want to change the output of this you can create a filter function for the img_caption_shortcode
hook (the comments for that function detail the required parameters).
If you need all the code that processes post content before output, this is more difficult due to the Wordpress plugin API and it's system of filter and action functions. The filter hook you need to look for is the_content
, by default (in Wordpress 2.9) this passes post content through the following filter functions:
- wptexturize
- convert_smilies
- convert_chars
- wpautop
- shortcode_unautop
- prepend_attachment
- do_shortcode
Have you looked for the get_post
and get_posts
methods?
They are the default methods in Wordpress for obtaining multiple and single posts.
Once you have the data, you can output it anyway way you want.
You don't need to copy anything from the source of the wordpress. Wordpress provides many ways to access your posts/articles and display it any way you want. Commonly used are WP_query
and query_post
.
精彩评论