WordPress.org

Ready to get started?Download WordPress

Forums

Ambrosite Next/Previous Post Link Plus
[resolved] Include future posts? (8 posts)

  1. unknownmale
    Member
    Posted 1 year ago #

    Is it possible to include future post types to the query?

    I've tried post_status => 'future' but with no luck.

    http://wordpress.org/extend/plugins/ambrosite-nextprevious-post-link-plus/

  2. unknownmale
    Member
    Posted 1 year ago #

    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 -->
  3. ambrosite
    Member
    Plugin Author

    Posted 1 year ago #

    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?

  4. unknownmale
    Member
    Posted 1 year ago #

    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?

  5. ambrosite
    Member
    Plugin Author

    Posted 1 year ago #

    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")

  6. unknownmale
    Member
    Posted 1 year ago #

    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.

  7. ambrosite
    Member
    Plugin Author

    Posted 1 year ago #

    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 );

  8. unknownmale
    Member
    Posted 1 year ago #

    That's great!

    Thank you very much.

    Great plugin!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.