Title: Most viewed posts
Last modified: August 20, 2016

---

# Most viewed posts

 *  [sanderp](https://wordpress.org/support/users/sanderp/)
 * (@sanderp)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/)
 * Any ideas how to get two separate pages with one with most viewed posts and one
   with newest posts ?
 * By default the main page is the one with newest posts.. but I’d like it to be
   with most viewed posts..

Viewing 9 replies - 1 through 9 (of 9 total)

 *  [marv51](https://wordpress.org/support/users/marv51/)
 * (@marv51)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2780968)
 * How do you get the data on how often a page is viewed? WordPress doesn’t know.
   Do you have some kind of plugin?
 *  Thread Starter [sanderp](https://wordpress.org/support/users/sanderp/)
 * (@sanderp)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2780969)
 * No I haven’t yet, I’m looking for a solution to manage this.
 *  [marv51](https://wordpress.org/support/users/marv51/)
 * (@marv51)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2780972)
 * Maybe [http://wordpress.org/support/plugin/top-10](http://wordpress.org/support/plugin/top-10)
   is something for you.
 * Or google for “wordpress count page views”
 *  Thread Starter [sanderp](https://wordpress.org/support/users/sanderp/)
 * (@sanderp)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2780999)
 * Okay, I downloaded [wp-postviews ](http://wordpress.org/extend/plugins/wp-postviews/)
   and found [this topic ](http://wordpress.org/support/topic/change-loop-to-order-posts-by-views)
   quite similar, but where do I have to add this line of code what user vtxyzzy
   tells ?
 *  [marv51](https://wordpress.org/support/users/marv51/)
 * (@marv51)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2781004)
 * If you want it on your homepage, put it in /wp-content/themes/your-theme/index.
   php
 * put it below the get_header() call.
 *  Thread Starter [sanderp](https://wordpress.org/support/users/sanderp/)
 * (@sanderp)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2781034)
 * Thank you!
 * But any idea how I can get a custom page what looks just like my index page but
   with newest posts first, like normal index page ?
 * I tried with new page, but it won’t work this way.
 *  [marv51](https://wordpress.org/support/users/marv51/)
 * (@marv51)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2781041)
 * Here is what you should do:
    Create a page. Set title. Leave content empty. Via
   FTP copie the index.php file with which it worked before and rename it to page-{
   slug}.php replace {slug} with the short name/slug of the page you created (what
   ever is used in the link) upload. Undo any changes you hade to index.php
 * Now if you go to the page you just created the new template file should be used.
 * You can find detailed information here: [http://codex.wordpress.org/Template_Hierarchy](http://codex.wordpress.org/Template_Hierarchy)
 * Please beware that changes made to your theme will be undone by the theme update
   process. To prevent this from happening, please use a child theme for all you
   modifications. See info here: [http://codex.wordpress.org/Child_Themes](http://codex.wordpress.org/Child_Themes)
 *  Thread Starter [sanderp](https://wordpress.org/support/users/sanderp/)
 * (@sanderp)
 * [14 years ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2781107)
 * Okay, when I do this, I get the page, but only with one post and it has the name
   I gave to the page.
 * I can’t figure it out why it doesn’t give me all the posts just like it should.
 *  [marv51](https://wordpress.org/support/users/marv51/)
 * (@marv51)
 * [13 years, 12 months ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2781150)
 * You should verify that actually your new template file is used. To do that open
   that file page-{slug}.php and put something like `die("Just testing");` at the
   beginning of that file. Upload. Now reload the page you created and see if you
   only see the text “Just testing” in the browser. If so, there is something wrong
   with that file. If the page does show up normally (maybe try a different Browser
   or Privat Browsing Mode, just to make sure) the is something wrong with the name
   of the file.
 * Let me know if you have any further problems.
 * Marvin

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Most viewed posts’ is closed to new replies.

## Tags

 * [new-post](https://wordpress.org/support/topic-tag/new-post/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 9 replies
 * 2 participants
 * Last reply from: [marv51](https://wordpress.org/support/users/marv51/)
 * Last activity: [13 years, 12 months ago](https://wordpress.org/support/topic/most-viewed-posts/#post-2781150)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
