WordPress.org

Ready to get started?Download WordPress

Forums

Featured Post
[resolved] get_next_posts_link doesn't work w/ this plugin (2 posts)

  1. nalin1017
    Member
    Posted 6 months ago #

    I believe get_next_posts_link & get_previous_posts_link no longer works on pages using this plugin. Those functions will still grab all posts featured or not... so you'll end up with an erroneous 'view older posts' link where there are no more posts.

    https://wordpress.org/plugins/featured-post/

  2. WPPress
    Member
    Plugin Author

    Posted 5 months ago #

    ya. thats a bit tricky... actually you should do something like

    $old_query=$wp_query;
    $wp_query=new WP_Query(array('featured'=>'yes',...your other conditions...));
    ... Your if else and while loop with $wp_query->have_posts();
    ....your get_next_posts_link() and your get_previous_posts_link();
    $wp_query=$old_query; // restore default query variable;

    make sure you use $wp_query as wp uses it most for other helper functions if you want to use them

Reply

You must log in to post.

About this Plugin

About this Topic