WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Future Post Quandary (7 posts)

  1. thornomad
    Member
    Posted 7 years ago #

    Hello,

    I have modified my category-2.php file to allow it to show posts made to the future (for a "Future Events" category). (I got the idea
    from here
    .)

    Everything works great in the category view until a user follows the permalink to the post to the future post ... there, nothing is displayed (because, of course!, it is a future post and wordpress only let's the admin view a post made in the future).

    Is there anyway around this ? Can I let people read posts I've made in the future ?

    Thanks,
    Damon

  2. vkaryl
    Member
    Posted 7 years ago #

    Well, there probably is. But I'm no php programmer.... too bad KafkaesquĆ­ is among the missing.

  3. thornomad
    Member
    Posted 7 years ago #

    I figured there must be away to adjust the single.php file to run a custom loop ... one that creates the database connection manually and thta would disregard whatever safegaurds are hard coded into the wordpress loop functions.

    I am just not sure how to query the database and tell it which post ID to use (since I wouldn't be in a loop, I don't know how the post ID is "identified"). What function, that is.

    D

  4. thornomad
    Member
    Posted 7 years ago #

    Actually, it may be more difficult than that ... a quick test using simply the have_posts() function to see if a post is even being passed through the wp_head shows that none is ... all I need, though, is someway to retrieve the ID of the post it was that was requested and then send that through a custom loop in order to display that post. Have to get away without using $post though, because I suspect that will be empty.

    D

  5. thornomad
    Member
    Posted 7 years ago #

    Well, all right: I went and solved it a less than pretty way ... I used the EventCalendar Plugin ... it had a "dirty hack" that works with some of its variables; once the "event calendar" is configured to work with my future post category, it allows wordpress to display the posts.

    This did require that I edit the classes.php file ... but, so far, no harm no foul.

    I wish there was an easier way.

  6. vkaryl
    Member
    Posted 7 years ago #

    Only problem is that you'll need to re-hack core when a new version hits (an almost monthly occurrence, ain't?)

  7. thornomad
    Member
    Posted 7 years ago #

    Yea, I suppose that is a problem -- I don't see a good way around it yet. Wish it was simply a check-button option in wordpress: "Show Future Posts".

    Maybe not that simple, coding-wise.

Topic Closed

This topic has been closed to new replies.

About this Topic