Tampilkan postingan dengan label Wordpress. Tampilkan semua postingan
Tampilkan postingan dengan label Wordpress. Tampilkan semua postingan

Accessing wordpress functions from other page outside wordpess.

Excerpt from http://wpengineer.com/embed-wordpress-functions-outside-wordpress/:


This works, as the wp-load.php build a bridge to all other functions in WordPress.

require( '../my_wordpress_install_root/wp-load.php' );
get_header();
 
echo 'new content outside WordPress';
 
get_footer();
?>
Depending on where the data is needed, it could be, that the absolute path of WordPress is needed. This can be determined by creating a php file with the following contents, put it in the Root of the installation and call it directly. The output is the path to the file.
 echo $_SERVER['DOCUMENT_ROOT']; ?>
This is then used in the require command, and can now, as usual, use the features of WordPress.

Moving wordpress blog to a different domain

Recently I moved my wordpress blog to a new domain. Many links broke. Styles were not applied. After googling, I stumbled upon this wisdom.

To update WordPress options with the new blog location, use the following SQL command:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.old-domain.com', 'http://www.new-domain.com') WHERE option_name = 'home' OR option_name = 'siteurl';
After that you will need to fix URLs of the WordPress posts and pages, which translated from post slug, and stored in database wp_posts table as guid field. The URL values in this field are stored as absolute URLs instead of relative URLs, so it needs to be changed with the following SQL query:
UPDATE wp_posts SET guid = replace(guid, 'http://www.old-domain.com','http://www.new-domain.com');
If you have linked internally within blog posts or pages with absolute URLs, these links will point to wrong locations after you move the blog location. Use the following SQL commands to fix all internal links to own blog in all WordPress posts and pages:
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.old-domain.com', 'http://www.new-domain.com');
Browse through WordPress blog to check if everything is okay. You also need to re-login to WP Administration as authentication cookie has now became invalid due to different domain.