Forums

Problem with dateorder on Custom Post Types Taxonomy (3 posts)

  1. averstedt
    Member
    Posted 1 year ago #

    Background:
    I am making av site that lists events.
    The client can make events by custom post types where they can write some info about the events.
    I then use the Advanced Custom Fields to decide when the event should take place.
    The event hides if it's older than todays date.

    Here is the code for that

    But now to the problem...

    I can't seem to make this work in my taxonomy.php. I have tried 3 things here:

    1. Insert the same query as in events.php (see code above).
    Result: It only lists everything exactly as in events.php witch I don't want. I only want to view the taxonomy I clicked on...

    2. I remove the the post_type => Events in the query.
    Result: It does'nt show anything.

    3. I take away the whole query.
    Result: The taxonomy works but the events are listed in the order I posted them. Not in the order the events are going to take place.

    Question:
    Is it possible to write a query in taxonomy.php at all? And how will I make this work?

  2. Digital Raindrops
    Member
    Posted 1 year ago #

    I think we had this before, custom fields are just text fields not date fields, so they will not sort how you want.

    Solution 1:
    Change the post date so the posts are in the date order you want, from the Posts > Posts > Edit

    Solution 2:
    For the custom field enter YYYYMMDD then they would be correct!

    HTH

    David

  3. averstedt
    Member
    Posted 1 year ago #

    I see...
    But I found this tutorial where he takes a text field and list events based on that string:
    http://wp.tutsplus.com/tutorials/how-to-build-a-ticket-sales-website-with-wordpress-and-tickettailor-day-two-building/

    I got the same thing to work on my events.php but I can't seem to make it work on my taxonomy.php.

    But shouldn't it be able to work on the taxonomy-page if I could get it to work on my event-page?

Topic Closed

This topic has been closed to new replies.

About this Topic