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!

  • There is an option in wordpress admin that you can either use the rich text interface or enter html interface. No plug-in needed. Check out admin panel where you enter your post, to locate it.
  • Go to Freewebsitetraffic.tv they will get your site 5,000 guaranteed traffic visitors a day and front page of the major search engines in 24 hours , so thousands of customers can find your site.
  • wordpress is much easier than the standard HTML and does not required experience in webdesign to create a beautiful website.
  • I have found this but I want it show only the title of the recent post, and only a list.. cause each time it creates a new block with the recent category. Please excuse my english.
  • Remove this section of code:

    <?php echo $item->get_description(); ?>


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

  • Let's see if I can make this work :) Thanks for sharing..
  • Great job with the code :) Will be useful for sure
  • Yes, but don't expect it to make a huge difference. put in keywords relating to each post, and check your dashboard on wordpress to see the impact. Search engine optimization is hard to define specifically, so you should use trial and error to see what keywords work best.
  • I've never been good with php... Let's see if I can make this work :) Thanks for sharing
  • Posts go on the front page and move down. You don't want to write a post, you want to write a page. There's a button for it right there on your dashboard.
blog comments powered by Disqus