WordPress.org

Ready to get started?Download WordPress

Forums

List custom posts (2 posts)

  1. Gyrate360
    Member
    Posted 1 year ago #

    0 down vote favorite

    I want list all the upcoming and past events(custom posts) in chronological order. I have saved data by meta key start_time,duration ,

    I try to use sql ,but can not get there!

    Thanks for any help in advance!

  2. Gyrate360
    Member
    Posted 1 year ago #

    I have tried this,seems not work

    SELECT  p.* FROM wp_posts AS p, wp_postmeta AS m
    				WHERE p.ID = m.post_id
    			  ORDER BY ( SELECT ABS(m1.meta_value-UNIX_TIMESTAMP(NOW())) from wp_postmeta AS m1 WHERE m1.meta_key='st_time' AND m1.post_id=p.ID)

Topic Closed

This topic has been closed to new replies.

About this Topic