WordPress.org

Ready to get started?Download WordPress

Forums

Extracting text from a post (2 posts)

  1. BoboBarlow
    Member
    Posted 1 year ago #

    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?

  2. bondies
    Member
    Posted 9 months ago #

    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

Topic Closed

This topic has been closed to new replies.

About this Topic