WordPress.org

Support

Support » How-To and Troubleshooting » List custom posts

List custom posts

  • 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!

Viewing 1 replies (of 1 total)
  • 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)

Viewing 1 replies (of 1 total)
  • The topic ‘List custom posts’ is closed to new replies.
Skip to toolbar