Archive for January, 2014

10 January, 2014 — Blogging

Blogging Topics…

Over the past few days I have been fining blogging hard. Not the actual technical side of blogging more the coming up with topics to write about…

Some of you may well know I am a big fan of John Saddington a former owner of 8BIT and WPDaily who I worked with when I contributed to WPDaily. His expertise and advice has gotten me to this point today and have allowed me to keep blogging for nearly a year now!

People can’t lie to you, blogging is hard work – getting readers and keeping readers isn’t easy. However one of John’s posts really helped me out. In it John said blog at least 3 times a week, to gain more traffic to your blog or website. My aim is to hit 250 unique visits per day. Hopefully with a bit of work I can achieve this target.

Totally random post but its one down for this week!

9 January, 2014 — Development, Snippets, WordPress

Create a “Recent Posts” Module Outside of WordPress

Not all websites run on WordPress, but some websites might decide to use WordPress as their blogging choice. They decide they want to display the recent posts from the blog on the website. However the website isn’t in the WordPress core. So how do we display the recent posts on the website?

The Code

To be able to use WordPress outside of the WordPress core is simple. Just include the 

wp-load.php
 file in your website:

// Include the wp-load from WordPress Install
include('wp-load.php');

// Get the last 10 posts
$recent_posts = wp_get_recent_posts(array(
    'numberposts' => 10
));

// Output the posts
echo '<ul>';
foreach($recent_posts as $post) {
    echo '<li><a href="', get_permalink($post['ID']), '">', $post['post_title'], '</a></li>';
}
echo '</ul>';

Once you have the 

wp-load.php
 file included, the entire WordPress core is open to use!