I want to get all the posts in wordpress whose ids are passed in parameter like
http://localhost/wordpres/?pid=181,109,5,1

My front-page.php have following code

<?php while (have_posts()) : the_post(); ?>
                <?php
                if ('posts' == get_option('show_on_front')) {
                    get_template_part('content', 'posts');
                } else {
                    get_template_part('content', 'page');
                }
                // If comments are open or we have at least one comment, load up the comment template
                if (comments_open() || '0' != get_comments_number()) :
                    comments_template();
                endif;
                ?>
            <?php endwhile;} // end of the loop.   ?>

And I have tried query_posts(‘p=181’); with http://localhost/wordpres/?pid=109 for single post; it works fine.
But I can’t sort out how to give query_posts multiple post ids which are passed through url. Need help.

Read more here: Display all posts whose IDs are passed through url


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: