Home Forums Front-end Issues Position 9 posts in grid based on Options page & Have timed posts work Reply To: Position 9 posts in grid based on Options page & Have timed posts work

  • Sorry, still not sure I follow. I would set these fields up as post object fields to allow selecting a post rather than entering an ID manually.

    So, thinking about what you have this is the way I would do something similar.

    The options page has 9 post object fields that will appear and override specific positions. Each could be empty.

    I would get the values from these fields and I would query all the posts to get 9 posts in descending date order excluding any posts selected in the post object fields.

    I would then create a loop to show 9 posts using a counter to tell me what post from the query is next something like the following.

    Please note that this is just a rough idea and a lot of it would need to be filled in.

    $next_post = 0;
    for ($i=0; $i<9; $i++) {
      if (/* test for top post at this position */) {
        $post = {post at this position};
      } else {
        $post = $queried_posts[$next_post]
      // show the selected post

    What this would do is show the posts that are selected filled in with other recent posts up to the 9 needed and avoid showing any post twice.

    I can help flesh this out more if need be. I have actually created something like this before for a client. They wanted to events and to have a slider that showed the first X number of upcoming posts but they also wanted to be able to override any position in the slider with a “featured” event that may be further into the future.