• nicadmin75

    (@nicadmin75)


    So i added a bunch of posts (~30 or so) about latest movies released at the box office!

    I wrote some text (the movie release date) on the 3rd line of the blog post for each movie as follows:

    14 November 2008
    18 June 2008
    24 April 2009 (soon to come on cinema)
    07 October 2008…

    I would like to arrange all my posts using the release date mentioned in each post!

    so they look like this:

    1st post: 24 april 2009
    2nd post: 14 november 2008
    3rd post: 07 october 2008
    4th post: 18 june 2008

    the 24 april being the most recent one (of course, if the movie will air in april 2009 – too far timewise and such – i’ll put a timestamp on it a few days before)

    can anybody help?

    is this even possible? probably is! nothing is unreachable in programming!

    thanks in advance for taking your time and looking into this matter!

    all the best!

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter nicadmin75

    (@nicadmin75)

    is there no expert here which knows how to deal with this problem? >_<

    renato_s

    (@renato_s)

    Well, I don’t know exactly how to solve your problem, but I have a strong feeling you should use Custom Fields to get it done.

    https://codex.www.ads-software.com/Using_Custom_Fields

    I don’t know how it works with dates, though.

    wp_guy

    (@wp_guy)

    Ideally you would insert the release date in a custom field: Using Custom Fields, and just to make things easier type a date that can be sorted easily (like 2008-12-31).

    Then use a custom Select Query (Displaying Posts Using a Custom Select Query).

    With a query such as:

    SELECT wposts.*, wpostmeta.*
    FROM $wpdb->posts wposts, $wpdb->postmeta wpostmeta
    WHERE wposts.post_status = 'publish'
    AND wposts.ID = wpostmeta.post_id
    AND wposts.post_type = 'post'
    AND wpostmeta.meta_key = 'release_date'
    ORDER BY wpostmeta.meta_value

    where ‘release_date’ is the name of your custom field.

    And, you would add “ASC” or “DESC” to the end of that query depending on the order you want (ascending or descending).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hard problem to manage as a newbie!’ is closed to new replies.