WordPress Plugin: Recent Changes

As WordPress comes of age as a powerful CMS and Bliki the ability to see recently changed items has become an important feature.

This plugin adds a widget to your sidebar that allows you to:

  • set a title for your list of recent items in the side bar
  • choose recently changed posts, pages or both
  • select 1-15 most recently modified items in your sidebar
  • exclude multiple pages or posts by ID

I have added a shortcode to the plugin so you can add a list of recent changes to any page or post.

[recentchanges] will add a list of the 5 most recently changed pages and posts. You can set the following parameters to modify the results:

content = ‘pages’, ‘posts’ or ‘both
number = ‘1’ to ’15’
exclude = any number of pages/post by ID separated by commas

e.g. [recentchanges content='pages' number='10' exclude='5,8'] would generate:

[recentchanges content=’pages’ number=’10’ exclude=’5,8′]

You can add the function to a theme with default parameters by adding the following code:

<?php
echo SC_RecentChanges($atts)
?>

Or with custom parameters by adding and altering the following code:

<?php
$atts = array('number' => '10', 'content' => 'pages');
echo SC_RecentChanges($atts)
?>

NB all functionality of my WordPress Widget: Recent Pages has been incorporated into this new widget.

Download Recent Changes and please leave a comment if you have feature requests and/or issues.

If you find this plug in useful please consider donating to its future development:

34 thoughts on “WordPress Plugin: Recent Changes

  1. Ken harper

    Hello there,

    First, thx a ton for the work.

    I’m a bit new to theme development and have my first theme all working but can’t seem to get any line breaks after each in your widget. I know it it must be something simple I’m missing, can you point me in a good direction?

    Thx for you time.

    k

  2. Abikesha

    Hi all,
    Can you help me, how to exclude view some pages that i would change.

    If in Recenpost i can write this :
    Recent_Posts(exclude=249) ===> it can work

    How i must write for Recent Changes plugin because i write :
    widget_RecentChanges(array ()&exclude=2) ===> doesn’t work.

    please help me!

  3. Arnout

    Works fine, but had to change the database query. You should replace wp_posts with “.$wpdb->posts.” and add the ‘global $wpdb;’ statement above it. This fixes the cases where wordpress installations use a prefix for their databases.

  4. titusbicknell Post author

    Sorry for the delay in addressing your comments. I have issued a 0.2 release today that includes:
    – Alex’s W3C validation fix
    – Arnout’s $wpdb->posts fix

    Ken: can you sned me a link to your install showing the plug in without line breaks?
    Abikesha: I do not have an easy solution for you as my plug in is not based on the Recent Pages core code.

  5. ultor

    I am getting incorrect rc_url for posts but fine for pages.

    I had to change get_page_link to get_permalink to work for me.

  6. titusbicknell Post author

    Can you send me the link for a page with the Recent Changes plug in active so I can see what errors W3C identifies?

  7. Cosmin Manci

    Dear Titus Bicknell,

    found your great wordpress plugin “Recent Changes”. Works great with pages (what I needed) but, I hope i’m not bothering you too much with this questions, is possible that a function to be added?
    I have a series of pages (what is new: – >>> http://plants.nature4stock.com/ )and when updating them I’m not interested this to be shown as changed… so it is possible to add some ID of pages that I want to hide there. Something like in the original “Pages” widget from wordpress (exclude function).

    Thank you very much and have a nice day,
    cosmln

  8. titusbicknell Post author

    I have had several requests for this feature and it will be included in the next release together with a short code option for inclusion in page/posts.

  9. titusbicknell Post author

    new version includes ability to exclude by ID and a shortcode for use in pages and posts.

  10. Pingback: Как читателям показать последние изменения в блоге | Recent Changes | темный Незнайка светлый Wordpress | n-wp.ru

  11. Kelvin Jones

    I upgraded your plugin and it does not work. What apppeared on the website was not intelligablle so I deactivated it. I had been using the recent pages choice but an old version of your plug-in and that had been working and I liked it.

  12. Josh S

    Hi,
    Im trying to add this widget to my home page so it will show the 3 most recent pages from my articles directory. I found the code to load wp functions:
    define(‘WP_USE_THEMES’, false);
    require(‘./articles/wp-load.php’);

    but what php would I need in my sidebar to make the widget appear on my home page. If you can help me it would be greatly appreciated.

    Thanks,
    Josh

  13. titusbicknell Post author

    Josh: under appearance -> widgets you can activate and configure Recent Changes so that it appears in your widgetised sidebar.

  14. Mike

    Hello & thank you for the great plugin!

    Is there documentation anywhere on how to include a call to Recent Changes within a template (rather than only as a widget)?

    Thanks again!

  15. titusbicknell Post author

    Mike: a very good question that I have answered in the plugin description above.

    Yours

    Titus

  16. Pat J

    The recent-changes-inc.php uses “<?" instead of "<?php" in line 1. You might want to change this — not everyone allows short tags.

  17. naranhai

    Thank you for great plugin!

    Any chance to include not only titles but a pic and a small portion of the changed post/page? And maybe put them in two columns? Thank you!

  18. Emily

    I’ve implemented this on my site and really need it to display the date and possibly the time the page or post was updated. Is this possible?

  19. Kaden

    Hello and thanks for this nice plugin!

    Like Emily above me, I would like to display the date when the article/page has been updated. Thanks!

  20. Kaden

    Oh, and one more thing would be nice:
    The option to add a reason, like “spelling”, “adding content” etc.

    Thanks!

  21. Pingback: Guide – Manuals – Studio Atanor « Studio Atanor Guide

  22. bob

    this plug in is great, but it could use some huge additions to make it really outstanding.

    1st it needs dates adding
    2nd it needs an option (possibly via cutom field) to actually write what changes have been made if any as an excerpt.
    3rd it needs to be usable as a static page
    4th all elements should be skinable
    5th featured images showing should also be an option

    I would pay $15 for a plug in like that via code canyon

    thanks

  23. Ken

    I realize it has been a LONG time sense anyone has posted about this plugin, but it’s worth a shot.

    I’m looking to Exclude Categories of Posts as well as including the date of the recent change added next to the list item within the short code.

  24. Ben Allen

    i have recently tried moving this site to a server running php 5.3 and mysql 5.6.
    the wordpress site has been migrated and now runn but your pluggin doesnt it throws up a load of code any ideas please

    15) { $rc_number = 15; } else { $rc_number = $number; } if ( $content == ‘pages’ ) { $rc_content_sql = “post_type = ‘page’ AND post_status = ‘publish'”; } else if ($content == ‘posts’ ) { $rc_content_sql = “post_type = ‘post’ AND post_status = ‘publish'”; } else { $rc_content_sql = “post_type = ‘page’ AND post_status = ‘publish’ OR (post_type = ‘post’ AND post_status = ‘publish’)”; } $rc_exclude = preg_replace(‘/[^0-9,]/’, ”, $exclude); $rc_exclude_array = explode(‘,’, $rc_exclude); if ($exclude != ”) { $rc_number = $rc_number + count($rc_exclude_array); } global $wpdb; $rc_sql = “SELECT post_title, ID FROM “.$wpdb->posts.” WHERE “.$rc_content_sql.” ORDER BY post_modified DESC LIMIT “.$rc_number; $rc_output = $before_widget.$before_title.$rc_title.$after_title.”; $RecentChanges = $wpdb->get_results($rc_sql); foreach ($RecentChanges as $RecentChange) : if (in_array($RecentChange->ID,$rc_exclude_array)) { } else { $rc_url = get_permalink($RecentChange->ID); $rc_output .= ‘■’.$RecentChange->post_title.’
    ‘.”\n”; } endforeach; $rc_output .= ”.$after_widget; $wpdb->flush(); ?>

Leave a Reply