简体   繁体   中英

Integrating Wordpress page into existing HTML site

I've run into a bit of a wall with a site I'm designing for a client. This was originally a very low budget static site but the client now needs the ability to edit some content from time to time. I've heard that you can just embed a wordpress page into existing HTML site and have followed the steps on the Codex site but can't seem to get it working. Any help is greatly appreciated.

So the wordpress page I'm trying to embed is the following:

http://octagonclubmiami.com/cs/

And the code I'm using is as follows:

This is posted at the beginning of the php file

<?php 
/* Short and sweet */
define('WP_USE_THEMES', false);
require('cs/wp-blog-header.php');
?>

And this is within the body of the php file

<?php
$posts = get_posts('numberposts=10&order=ASC&orderby=post_title');
foreach ($posts as $post) : setup_postdata( $post ); ?>
<?php the_date(); echo "<br />"; ?>
<?php the_title(); ?>    
<?php the_excerpt(); ?> 
<?php
endforeach;
?>

The actual page I'm trying to embed into is the following:

http://octagonclubmiami.com/community_service_test.php

As it sits it's currently displaying I guess some sample post instead of the page mentioned earlier.

Thanks in advance!

The better solution (I think) is to use get_post() and specify the ID number of the post/page you wish to output:

<?php
$page = get_post( 'ID NUMBER HERE' );
setup_postdata( $page ); 
?>

<?php the_date(); echo "<br />"; ?>
<?php the_title(); ?>    
<?php the_excerpt(); ?>

You can identify the post's ID number in the WordPress back-end.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM