I need a duplicate of
index.php, but slightly modified. I added a "vote it up" plugin. So, I want the user to select how to display posts - by new or by popular. I know what to add to second
index.php, but how to create a second
index.php, thats the problem.
Elaborating on Rachel Baker's answer:
Copy the index.php file and name it something like popular.php. At the very top, paste the following:
Now, go in to the WordPress admin and create a new page, called something like "By Popular". On the right-hand side, select the "Posts by Popular" template where it says "Template" (screenshot). Publish the page, and when you view it you should see your new page.
Create a link to this page in the nav menu or wherever, and then your users will be able to access the new page.
You can create a new page, using a modified template file - and send users to that page if they choose to display posts "by popular"
When i do this kinds of modification i always use child theme Because its the easy way to doing it. And if i mess the child theme up i can just copy files form the main theme anytime.
If you never tried the child theme. This might be the right time for you. ;) Just make a child theme copy the index.php file form original theme and place it to the child theme directory and edit.