Displaying recent Wordpress posts in Pligg

In this tutorial I will show you how to start integrating your Wordpress blog into your Pligg install by displaying your recent blog posts in your Pligg sidebar.

One way to add to your Pligg install is to add a Wordpress blog. The blog can be used for promoting certain site features, posting top 10 lists or posting site news. A blog is a great way to increase your site’s traffic and exposure.

Integrate Pligg and WordpressIntegrate Pligg and Wordpress

 

I added a Wordpress blog to FAQPAL a couple of months ago and it has certainly helped.

One way to integrate the blog is to display your recent blog posts in the Pligg sidebar, this will again add to your blog traffic and ultimately your Pligg install traffic.

In order to do this, you will need to download the latest version of Simplepie, once downloaded, unzip it, and upload it to your 3rdparty folder. It will take approximately 5 minutes to upload, as it is a huge folder.

SimplePie

Now in order to make this work, you must choose a .php file to add the following code, I have used sidebar_stories_u.php (using v9.9.5) and added it to the bottom.

In Wistie open libs/sidebarstories.php, add to the bottom:

< ?php
$feed_url = ‘http://www.YOURSITE.com/blog/feed/’;
$max_items = 5;
 
//Load SimplePie
include ‘http://www.YOURSITE.com/3rdparty/simplepie/includes/simplepie.inc’;
 
//Fetch the RSS feed
$feed = new SimplePie($feed_url);
 
//Check for errors
if ($feed->error())
        echo ‘Error : ‘,$feed->error();
 
//Output up to $max_items posts
foreach ($feed->get_items(0, $max_items) as $item): ?>
        <div class="item">
                <h3 class="title"><a href="<?php echo $item->get_permalink(); ?>">< ?php echo $item->get_title(); ?></a></h3>
                < ?php echo $item->get_description(); ?>
                <p><small>
                Posted  < ?php if ($author = $item->get_author()){ echo ‘ by ‘.$author->get_name(); }?>
                on < ?php echo $item->get_date(‘j F Y | g:i a’); ?>
                </small></p>
        </div>
< ?php
endforeach;
?>

In the above code, make sure you change the domain to match yours, as well make sure the path to your blog is correct.

The code above will display “5″ of your recent entries, which you can change by altering:

$max_items = 5;

it will also display the excerpt for the each blog post, author name and date. I chose to only display the title, so you can remove the following:

                < ?php echo $item->get_description(); ?>
                <p><small>
                Posted  < ?php if ($author = $item->get_author()){ echo ‘ by ‘.$author->get_name(); }?>
                on < ?php echo $item->get_date(‘j F Y | g:i a’); ?>
                </small></p>

That’s it. This module will work on both v9.9.5 and the latest Pligg build. You will need to do whatever styling you want in order to blend it in with the rest of your site.

You can see a working example on FAQPAL, check out the blog as well.

As always, any issues leave me a comment below.

Will you be using this on your Pligg install?

If you enjoyed this post, make sure you subscribe to my RSS feed!

  • I thought there was a setting to automatically truncate each post; had no idea it was something I had to do to each one as I wrote it.
  • Since no one includes Pligg in their one click install, you have to install it yourself, but it's not that hard to customize it. Just install it, choose a template and start adding content and links to your site.
  • This is great info for getting your Wordpress blog to link with your Pligg site. Thanks for sharing it.

  • julia
    nice topic on pligg
  • Great tips and thanks for sharing it with us. It is exactly what I was looking for lately. Its nice that you share all the news with other people. Cheers
  • Domains don't mean anything. All a domain does is provide DNS to ip addresses. So technically speaking all 3 domains could be on the same server in different folders using virtual hosts on Apache(webserver).
  • This is great info for getting your Wordpress blog to link with your Pligg site. Wonderful read to all web designers.


  • This module will work on both v9.9.5 and the latest Pligg build. You will need to do whatever styling you want in order to blend it in with the rest of your site.
  • where on earth do you get this useful information from? Great tool! kudos
  • erotik shop
    I have searched examples, all I found are Wordpress Plugins or complex code. I just want an example which will show my last tweet in my wordpress header theme

blog comments powered by Disqus