Support » Plugins » Get data from different table than wp_post….

  • Resolved Luigino

    (@luigino)


    Hello everyone on WordPress.org and Happy New Year!!!!!

    I am working around to show up on front end some travel offers like they are posts, I was thinking to create categories and sub-categories for each “identification-offer field”. But in this way I thought it would get a lot messed so it isn’t a clear solution and I thought about using a separate table called like tbl_offers with columns like offer_title, continent, state, city, departure_airport, departure date, duration, offer description.

    But the thing I am unsure is this: how I can manage the have_posts() loop to look at that table to put contents in the posts like I am putting the title of the offer at the place of the_title() and the continent, state, city, departure airport, date and duration under the title as like I am picking the_author() and the_time() and the content in the place of the_post() without alterating the philosophy of the theme and wordpress itself….Plus I thought for this way because I guess I could also filter some offers/posts to see for example only offers to America….

    Do you have a suggest if there’s a clear way to do that to visualize offers like posts?….

    Thanks in advance to all for the suggest and have an happy year 2009 again!!!
    Ciao,
    Luigi

Viewing 3 replies - 1 through 3 (of 3 total)
  • Instead of a separate posts table, I would look at using Custom Fields with posts. While you can create other tables in the same database as the rest of the tables and use the wpdb class, I don’t believe you will get a post loop to work with that.

    Resources:
    Using_Custom_Fields
    The Loop
    query_posts()
    Stepping Into Template Tags
    Stepping Into Templates
    Template Hierarchy

    Hi MichaelH!

    Thanks for your answer!….
    “I would look at using Custom Fields with posts.”….. You mean for example I write those offers like “A beautiful weekend in Prague, Europe – From Milan Malpensa, Departure: Feb. 14, 2009 – A beautiful package in prague for two days for only $400,00” in a post then use custom fields to insert Prague, Europe, Milan Malpensa, 02/14/09 to be used to search the post ?

    Luigi

    Yes, but Categories and/or Tags might make sense also…just to confuse things 😉

    Create a couple of posts using categories and tags, change to the WordPress Default Theme and see if you like the results.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Get data from different table than wp_post….’ is closed to new replies.