How to integrate a WordPress blog in your existing website?

WordPress is amazing in its nature. You can convert it into anything and integrate it with any PHP site. You can even set the degree of integration. Like, there may be only a few features of WordPress you want to use when integrating it with your site. For example, you want to display the recent blog posts at your website’s homepage. Your website is in PHP and WordPress blog is installed in another folder. In this article, I will show you the steps that how you can achieve this awesomeness.

Let’s assume you already have a site running at and you want to start a blog for your Product. Create a new sub-directory (folder) at your site and call it ‘blog‘. So you now have an empty sub-directory at Now, download WordPress framework and upload all of its files into and install WordPress on it. If you don’t know how to install WordPress, please read this tutorial.

So, at this point, You have installed WordPress at blog directory and want to show the recent blog posts on your website’s homepage. You need to add the following code snippet at the start of the home page in which you want to utilize WordPress functions.


Then the next important thing is ‘WordPress loop’. If you don’t know what is ‘WordPress loop’, please read this here.

Put the following code anywhere on your homepage where you want to display the latest posts.


Pretty simple, isn’t it? This way you can use every functionality of ‘WordPress’, but you should have an idea of how things can be done in ‘WordPress’.

If you are having any difficulties while integrating your website with a WordPress blog, please feel free to ask below in the comments section.

Thanks, Good luck!


30 thoughts on “How to integrate a WordPress blog in your existing website?”

  1. So I’ve recently just started learning html,css, javascript and I made my first website. I would now like to put a wordpress blog on the site. If possible I’d like to full integrate it so it looks like just another page on the website.

    Is this possible? and whats the best way to do it.

  2. Hello

    Thanks for the tutorial, I have a bespoke website based on PHP.
    I have done below so far
    1- installed wordpress in subdirectory called /blog
    2- all the components have been correctly downloaded.
    Could somebody let me know how to add blog button/click in the home page where shop online, gallery, services, contact us etc are residing?
    I am not sure what the script would be.

    Thank you

  3. Hi, there! Thanks for the helpful post!

    I am trying to figure out how to use apply_filters or get_the_content() on each post processed by the above script so that the tags and other formatting in the original post are preserved. I can created a new variable, such as $content, and feed it the formatted content like so, I believe:

    $content = get_the_content();

    But how do I get that statement in to the foreach process you use in this example? Any help appreciated!

    – Brock

  4. i want to display blog content as well as their respective images. guide me how to display img along the content.

  5. Hi there. I have been using the above code to embed recent posts into a section on my website. However, I’m not sure what happened or when it happened, but for sometime now, when I make a blog entry, when it appears in the embedded section of my website, the following code appears above the photo: “[caption ID= ” and then the relevant code. So now I just delete this code and a tag for each photo and it’s fine. But this is time consuming. This used to never happen. It only happens when I add captions to the photos. There also used to be a link to go to the archives. Any suggestions would be greatly appreciated. Here’s a link to the page:

  6. This is a helpfull posting and it makes live easier.
    But what if I have TWO seperate WP installations I want to show posts from.
    How do I separate them.
    Ant suggestions are (more than) welcome.

  7. We have created a website in php all thing is fine. We have installed a blog of wordpress in directory /blog
    when we are trying to set urrl of our existing website by default it appears /blog in all urls can you suggest me to remove it

  8. Hey how do I add a wordpress blog to my already existing site? I already have it on a subfolder and want it accessible from main website

  9. Hi! i come to your site by searching it on google and i found this tutorial is really helpful but still i have a question in my mind that without database how can i call the WordPress blog on my html website.

  10. hi

    this was very helpful
    How to integrate a WordPress featured image blog in your existing website?
    in this code we hava title,time,content;i want to add featured image to every post???

  11. Hi !

    Thanx for the tip. I’ve got a question. When I’m installing WordPress in the folder /blog/ do I connect it to the same Data base that my MAIN web site is connected or I can use a different database ?

    Thanx a lot in advance

  12. Hi, there! Thanks for the helpful post.
    I Just copy and paste above code. Its complied successfully.
    But I need to display an recent posts id and featured image also in my php site. How can I do? Please give an suggestion for my query ..

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.