WordPress.org

Support

Support » Themes and Templates » Extracting text from a post

Extracting text from a post

  • Hi all…this is my first attempt at getting into creating a theme for WordPress and I require a little assistance.

    I’m creating a site where I will list events but want to enter the information into a post and then extract the information as separate segments (unless there is an easier way). My thinking is that it would be something along the lines of using certain tags and then creating a query to search for these tags and extract everything between. So if I had a ‘price’ field for example that I wanted to be formatted in a different way, contain this within tags <price>$4.00<price> so I can then format this exclusively.

    Any thoughts on the best way of doing this?

Viewing 1 replies (of 1 total)
  • bondies

    @bondies

    You could extract the required sections of text with a regular expression (See something like this for a tutorial). The content of the post can be addressed with the string post_content from the <?php get_post( $id, $output, $filter ); ?> function

Viewing 1 replies (of 1 total)
  • The topic ‘Extracting text from a post’ is closed to new replies.
Skip to toolbar