Ben
Ben

Reputation: 62364

Wordpress [caption] processing

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 output 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.

Upvotes: 0

Views: 396

Answers (3)

Richard M
Richard M

Reputation: 14535

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

Upvotes: 1

Pragati Sureka
Pragati Sureka

Reputation: 1412

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.

Upvotes: 0

Jamie Dixon
Jamie Dixon

Reputation: 54001

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.

Upvotes: 0

Related Questions