Adding wp posts into external website
-
Hello,
I wanted to show some posts headers from my blog into my website.I’ve added a php code into my web site just like it indicates in https://codex.www.ads-software.com/Integrating_Wordpress_with_Your_Website
but it is displays the entirely blog (in mobile version) instead of the 5 lasts posts.
I don’t know what I’ve done wrong.This is the code:
<?php /* Short and sweet */ define('WP_USE_THEMES', false); require('noticias/wp-blog-header.php'); ?> <?php // Get the last 5 posts. global $post; $args = array( 'posts_per_page' => 5 ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); ?> <a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a><br /> <?php endforeach; ?>
Thanks for help!
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Adding wp posts into external website’ is closed to new replies.