• Hi everyone,

    I have a website which has a ‘news section’. I update this news section by editing the HTML and re-uploading the page. It’s not a very robust method.

    Instead, I would like to use my WordPress posts to populate this news section, but I’m not sure how to do that.

    What would be the best way to do that. Two options I know so far are:

    1. Use an iframe to embed the whole blog (not what I’m after, I just want the posts to be embedded
    2. Embed an RSS feed with iframe to embed posts (closer to what I’d like).

    Are these two options the only/best choices I have? Other advice I’ve received have suggested I use Drupal or Joomla, but I’m keen to stick with WordPress.

    Any advice would be great,

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • 🙂

    <?php
      $args=array(
          'category_name' => 'latest',
          'post_type' => 'post',
          'post_status' => 'publish',
          'posts_per_page' => 1,
          'caller_get_posts'=> 1
          );
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo 'Latest News';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><h3><?php the_title(); ?></h3>
    <?php echo get_the_post_thumbnail( $page->ID, 'thumbnail',array( 'class' => 'style' )  ); ?><?php the_excerpt(); ?></a>
           <?php
          endwhile;
        }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    So you have an html site on which you want to show post links and excerpts from a separate WordPress site?

    If so, yes, RSS is the best way to go. Google’s RSS API was recently deprecated, but there are alternatives. http://simplepie.org/ works well.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘How to embed blog posts’ is closed to new replies.