WordPress.org

Ready to get started?Download WordPress

Forums

How to display wordpress popular posts outside of wordpress (2 posts)

  1. harishvarma
    Member
    Posted 10 months ago #

    I own a website in which one wordpress blog is a part. I would like to display the popular posts from the blog in the rest of the website. Please let me know how do I go about doing this. Right now I am using the static html generated on the blog to display popular posts on the rest of the site.

    This is my website: VTU Results
    This is my blog: VTU Results Blog

  2. wpismypuppet
    Member
    Posted 10 months ago #

    All you have to do is make sure your pages outside of WordPress are .php files (or at least the files you wish to run WordPress stuff on). Then, at the very top of a page outside of WordPress you wish to include WordPress stuff, place this:

    <?php require('/server/path/to/your/wordpress/folder/wp-load.php'); ?>

    Obviously replace the path to your own server's path. You need wp-load.php in the root of your WordPress install. Once you have that one line of code, you can do any WordPress function, including get_posts(), which is most likely what you'll need.

Reply

You must log in to post.

About this Topic