WP functions outside of WordPress

WP functions outside of WordPress

Have you ever needed to call WordPress functions outside of WordPress? If you operate a website and have WordPress installed in a sub-directory. For example, a directory called “blog” within the root level of your website. Then you can relate to the difficulties that can be involved with bringing WordPress functionality out of the WordPress directory and into your global website.

Below is one of the easiest ways I have found to deliver WordPress functions to a website outside of the WordPress installed directory. For this example, we’ll go over adding recent posts, listing categories, and Tag Clouds to your sidebar.

Add the following PHP code within your sidebar div element.

Step 1.) Include WordPress

Step 2.) Query Most Recent Posts

Step 3.) Display The Most Recent Posts