1
votes

I want to embed the news section of a Wordpress (posts) page/site into a html page without the Wordpress Menu or the Footer and make it the content appear as though it is part of that HTML page. This is because the uploading of news stories is easier in Wordpress for beginners.

2
Using jQuery inject an iframe into html and using .remove() remove all the unwanted stuff from it... Hope this works :)Sanjay Achar

2 Answers

1
votes

The recommended solution would be to also use WordPress for displaying the posts/content you created with its admin interface. You can create a theme from scratch (or modify an existing one), that matches your existing website design.

But, if you are using PHP to generate your other html pages, you could also include the WordPress bootstrap file (wp-load.php), then use WordPress function get_posts() to retrieve a list of posts. For example:

Your .php file:

<?php

// ...
// other stuff you do
// ...

require_once('/path/to/your/wordpress/installation/wp-load.php');

$posts = get_posts();

// do whatever you want with the array of found posts
var_dump($posts);

// ...
0
votes

You can use this way

<ul>
<?php
global $wpdb;
global $post;
$str = "SELECT $wpdb->posts.* FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'";
$result = $wpdb->get_results($str);
foreach($result as $post):
  setup_postdata($post);?>
    <li><a href="<?php the_permalink()?>"><?php the_title();?></a></li><?php 
endforeach;?>
</ul>

or this

<?php
  // Include WordPress
  global $wpdb;
  define('WP_USE_THEMES', false);
  require('/server/path/to/your/wordpress/site/htdocs/blog/wp-blog-header.php');
  query_posts('posts_per_page=1');
?>

<?php while (have_posts()): the_post(); ?>
   <h2><?php the_title(); ?></h2>
   <?php the_excerpt(); ?>
   <p><a href="<?php the_permalink(); ?>" class="red">Read more...</a></p>
<?php endwhile; ?>