List Last Changes Shortcode

Below, you’ll find a detailed guide on how to add the List Last Changes Shortcode to your WordPress website, including its parameters, examples, and PHP function code. Additionally, we’ll assist you with common issues that might cause the List Last Changes Plugin shortcode not to show or not to work correctly.

Before starting, here is an overview of the List Last Changes Plugin and the shortcodes it provides:

Plugin Icon
List Last Changes

"List Last Changes is a WordPress plugin that conveniently tracks and displays your most recent website updates, ensuring you keep abreast of all modifications easily."

★★★★☆ (5) Active Installs: 2000+ Tested with: 6.3.2 PHP Version: false
Included Shortcodes:
  • [list_last_changes]

List Last Changes [list_last_changes] Shortcode

The ‘list_last_changes’ shortcode from the List Last Changes plugin helps display the most recent changes on your WordPress site. It generates a list based on the parameters defined in the shortcode. This shortcode allows you to specify the number of changes to display, whether to show pages or posts, and if the author’s name should be included. It also provides an option to customize the template.

Shortcode: [list_last_changes]

Parameters

Here is a list of all possible list_last_changes shortcode parameters and attributes:

  • number – Defines the quantity of last changes to display
  • showpages – If set to true, lists recent changes on pages
  • showposts – If true, shows recent changes in posts
  • showauthor – If true, displays the author of the changes
  • template – Specifies the template used for displaying the changes

Examples and Usage

Basic example – Displays the last five changes made in the website.

[list_last_changes number=5 /]

Advanced Examples

Displays the last ten changes made in the website including the author of the changes.

[list_last_changes number=10 showauthor=true /]

Displays the last five changes made to the pages of the website excluding posts.

[list_last_changes number=5 showpages=true showposts=false /]

Displays the last five changes made to the posts of the website excluding pages.

[list_last_changes number=5 showpages=false showposts=true /]

Displays the last ten changes made to the website using a custom template.

[list_last_changes number=10 template="custom_template" /]

PHP Function Code

In case you have difficulties debugging what causing issues with [list_last_changes] shortcode, check below the related PHP functions code.

Shortcode line:

add_shortcode( 'list_last_changes', 'list_last_changes_shortcode_funct' );

Shortcode PHP function:

function list_last_changes_shortcode_funct($atts ) {
	$a = shortcode_atts( array(
		'number' => '5',
		'showpages' => 'true',
		'showposts' => 'false',
		'showauthor' => 'false',
		'template' => '',
	), $atts );

	$number = empty($a['number']) ? ' ' : $a['number'];
	$showpages = $a['showpages'] === 'true';
	$showposts = $a['showposts'] === 'true';
	$showauthor = $a['showauthor'] === 'true';
	$template = empty($a['template']) ? list_last_changes_default_template($showauthor) : $a['template'];
	return ListLastChangesWidget::generate_list($number, $showpages, $showposts, $template);
}

Code file location:

list-last-changes/list-last-changes/list-last-changes.php

Conclusion

Now that you’ve learned how to embed the List Last Changes Plugin shortcode, understood the parameters, and seen code examples, it’s easy to use and debug any issue that might cause it to ‘not work’. If you still have difficulties with it, don’t hesitate to leave a comment below.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *