.

.

Get Blog Post Outsite Wordpress


<?php
   require 'blog/wp-load.php';  
   ?>
<?php
//instantiate a WP_Query and get the latest 10 posts
$wp_query = new \WP_Query();
$wp_query->query('showposts=3');
?>
<?php
//Iterate through the returned posts. The starts the WP "Loop"
while ($wp_query->have_posts()) :
  $wp_query->the_post();
?>
<a href="<?php the_permalink() ?>" target="_blank">
                  <?php the_title(); ?>
                  </a>
<?php if(has_post_thumbnail())
              {?>
<a href="<?php the_permalink() ?>" target="_blank"><img src="<?php echo the_post_thumbnail_url('large'); ?>" style="width:100%;" ></a>
                <?php }?>
<?php //$authorId = the_author_ID();
              
                $args = get_avatar_data(the_author_ID(),'' );
               
      $imgurl= $args['url'];
     
      ?>
                    <img src="<?php echo $imgurl; ?>" style="border-radius:100%;width:80px;height:80px;z-index:999;margin-left:-15px !important;" align="middle">
                    <h3><?php echo ucwords(get_author_name());?></h3>
<?php the_time( get_option( 'date_format' ) ); ?>
  <p> <a href="<?php comments_link(); ?>">
    Leave a Comment
</a></p>

1 comments:


EmoticonEmoticon