Support » Fixing WordPress » 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)
  • How do you get the data on how often a page is viewed? WordPress doesn’t know. Do you have some kind of plugin?

    No I haven’t yet, I’m looking for a solution to manage this.

    Maybe is something for you.

    Or google for “wordpress count page views”

    Okay, I downloaded wp-postviews and found this topic quite similar, but where do I have to add this line of code what user vtxyzzy tells ?

    If you want it on your homepage, put it in /wp-content/themes/your-theme/index.php

    put it below the get_header() call.

    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.

    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:

    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:

    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.

    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.


Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Most viewed posts’ is closed to new replies.