Adding a WordPress blog to an HTML website is simple. Just create a new directory on your website and add the following files:
– wp-config.php
– wp-blog-header.
php
– wp-blog-content.php
– wp-footer.php.
You’ll also need to create a new database and add the WordPress settings to your wp-config.php file:
define(‘DB_NAME’, ‘WordPress’); define(‘DB_USER’, ‘username’); define(‘DB_PASSWORD’, ‘password’); // Optional: define(‘DB_HOST’, ‘localhost’); // Optional: define(‘DB_PORT’, 3306); // Optional: define(‘WP_DEBUG’, true); // Optional: define(‘WP_USE_THEMES’, true); // Optional: define(‘WP_DEBUG_LOGGING’, true); /* Don’t forget to activate the plugin */ require_once(__FILE__.’/wp-load.php’); /* Create a table to store posts */ $wpdb->createTable( ‘posts’ , array( ‘id’ => int(3), ‘title’ => string(255), ‘content’ => string(255), ) ); /* Insert some test data */ $post1 = new WP_Post(); $post1->ID = 1; $post1->title = “First post”; $post1->content = “This is my first post!”; $wpdb->insert( “posts”, $post1 ); /* Display the table data */ echo “
ID | Title | Content |
---|---|---|
$post->ID | $post->title | $post->content |
“; } /* Display the blog header */ include __DIR__ . ‘/wp-blog-header.
php’; /* Display the blog content */ include __DIR__ . ‘/wp-blog-content.php’; /* Display the blog footer */ include __DIR__ . ‘/wp-footer.php’;.