Wordpress: Run a loop outside Wordpress

<?php // This can be used on any PHP file even OUTSIDE your WordPress installation - // Include Wordpress define('WP_USE_THEMES', false); require('/server/path/to/your/wordpress/site/htdocs/blog/wp-blog-header.php'); query_posts('showposts=1'); ?> <?php // Run loop ?> <?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; ?>

1 Response

So, in theory, I can use this to display an updated (lets say TODAY's Product) on a Custom Facebook tab of a Facebook Page?

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.