WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Include future posts?

[Resolved] Include future posts?

Viewing 7 replies - 1 through 7 (of 7 total)
  • unknownmale
    Participant

    @unknownmale

    This is the code I’m using:

    <nav class="nav">
                                  <ul>
                                     <li>
                                      <?php previous_post_link_plus( array(
                                      'order_by' => 'post_date',
    								  'post_status' => 'future, publish',
                                      'loop' => true,
                                      'end_post' => false,
                                      'thumb' => false,
                                      'max_length' => 0,
                                      'format' => '%link',
                                      'link' => '<span class="uline">Previous</span> %title <span class="pndate">%date</span>',
                                      'date_format' => 'd.m.y',
                                      'tooltip' => '%title - %date',
                                      'ex_cats' => '',
                                      'ex_cats_method' => 'weak',
                                      'num_results' => 1,
                                      ) ); ?>
    
                                    </li>
    
                                    <li>
                                      <?php next_post_link_plus( array(
                                      'order_by' => 'post_date',
    								  'post_status' => 'future, publish',
                                      'loop' => true,
                                      'end_post' => false,
                                      'thumb' => false,
                                      'max_length' => 0,
                                      'format' => '%link',
                                      'link' => '<span class="uline">Next</span> %title <span class="pndate">%date</span>',
                                      'date_format' => 'd.m.y',
                                      'tooltip' => '%title - %date',
                                      'num_results' => 1,
                                      ) ); ?>
                                    </li>
                                 </ul>
                              </nav><!-- .nav -->

    Plugin Author ambrosite
    Participant

    @ambrosite

    I don’t understand, what are you trying to accomplish? A post with status ‘future’ is not published yet so why would you want it to appear in the navigation stream?

    unknownmale
    Participant

    @unknownmale

    I have a WordPress which shows events. So as all of the events I show are in the future I show posts which are in the future using post status in the query. This works fine.

    However I would like to use this plugin in the same way I use it to navigate through past events. This plugin does not allow this. Only published events

    Is it possible to use this plugin to navigate through future posts?

    Plugin Author ambrosite
    Participant

    @ambrosite

    Okay, I see now. It should be possible if you are willing to hack the plugin code. Replace line 190 with the following:

    $where = apply_filters( "get_{$adjacent}_post_plus_where", $wpdb->prepare("WHERE ( $order_by $op $order_format OR $order_2nd $op $order_format2 AND $order_by = $order_format ) AND p.post_type IN ($post_type) AND p.post_status IN ("publish","future") $in_same_term_sql $in_same_author_sql $in_same_meta_sql $ex_cats_sql $in_cats_sql $ex_posts_sql $in_posts_sql", $current_post, $current_post2, $current_post), $r );

    That looks very long and complicated, but the only thing I have changed is this:

    AND p.post_status = 'publish'

    To this:

    AND p.post_status IN ("publish","future")

    unknownmale
    Participant

    @unknownmale

    Hey, Thank you for your reply.. I did get this error when I updated the code –
    Parse error: syntax error, unexpected T_STRING in /home/admin/public_html/wp-content/plugins/ambrosite-nextprevious-post-link-plus/ambrosite-post-link-plus.php on line 190

    I did also try

    AND p.post_status = ‘future’,’publish’

    But with no results.

    Plugin Author ambrosite
    Participant

    @ambrosite

    Ah yes, sorry about that. I should have used single quotes rather than double quotes, like this:

    $where = apply_filters( "get_{$adjacent}_post_plus_where", $wpdb->prepare("WHERE ( $order_by $op $order_format OR $order_2nd $op $order_format2 AND $order_by = $order_format ) AND p.post_type IN ($post_type) AND p.post_status IN ('publish','future') $in_same_term_sql $in_same_author_sql $in_same_meta_sql $ex_cats_sql $in_cats_sql $ex_posts_sql $in_posts_sql", $current_post, $current_post2, $current_post), $r );

    unknownmale
    Participant

    @unknownmale

    That’s great!

    Thank you very much.

    Great plugin!

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Resolved] Include future posts?’ is closed to new replies.