=== List Pages – Widget, Block & Shortcode ===
Contributors: onodev77
Tags: list pages, page list, child pages, pages widget, page block
Requires at least: 5.0
Tested up to: 7.0
Requires PHP: 7.2
Stable tag: 2.0
License: GPLv2 or later
License URI: https://www.gnu.org/licenses/gpl-2.0.html

A flexible page list: widget, block, or shortcode. Latest, manual, child or sibling pages, thumbnails and excerpts included.


== Description ==

**List Pages** gives you three ways to display a list of WordPress pages wherever you need them:

* **Widget** – add it to any sidebar or widget-ready area (Classic Widgets and the Block Widget Editor are both supported).
* **Block** – add the "Pages List" block directly inside any post or page in the block editor.
* **Shortcode** – drop `[onodev_pages_list]` into any post, page, or template that supports shortcodes.

All three share the same options, so you only have to learn them once.

**Display modes**

* **Latest pages** – automatically show the most recently published pages.
* **Manual selection** – pick exactly which pages to show, with a paginated picker.
* **Children of the current page** – perfect for documentation sites, knowledge bases, or any site with a page hierarchy.
* **Siblings of the current page** – show the other pages at the same level, useful for in-page navigation.

**Display options**

* Optional featured image (thumbnail) next to each title.
* Optional excerpt, with configurable word length.
* Order by date, title, menu order, or random.
* Exclude specific page IDs.
* Highlight the page currently being viewed.
* Works with custom post types, not only the default "Page" post type.

**Built for performance**

No external libraries, no build step, no tracking, no bloat. A handful of PHP files and one small CSS file you can fully override from your theme.

== Installation ==

1. Upload the plugin files to the `/wp-content/plugins/onodev-recent-pages-widget` directory, or install the plugin via the WordPress plugin screen.
2. Activate the plugin through the 'Plugins' screen in WordPress.
3. Use it in one of three ways:
   * **Widget**: go to **Appearance > Widgets**, add "Pages List (Custom & Recent)" to a widget area.
   * **Block**: in the block editor, add the "Pages List" block to a post or page.
   * **Shortcode**: paste `[onodev_pages_list]` into any post or page content.
4. Choose a display mode and the options you want, then save/publish.

== Frequently Asked Questions ==

= Can I use this in the block editor, not just in a sidebar widget? =
Yes. Version 2.0 adds a native "Pages List" block you can place inside any post or page, in addition to the original widget.

= Is there a shortcode? =
Yes: `[onodev_pages_list]`. Common examples:

`[onodev_pages_list mode="latest" count="5"]`
`[onodev_pages_list mode="manual" ids="12,45,78"]`
`[onodev_pages_list mode="children" show_thumbnail="yes"]`
`[onodev_pages_list mode="siblings" show_excerpt="yes" excerpt_length="15"]`

Supported attributes: `mode`, `post_type`, `count`, `ids`, `exclude`, `orderby`, `order`, `reference_id`, `show_thumbnail`, `show_excerpt`, `excerpt_length`, `highlight_current`, `class`.

= What do "Children" and "Siblings" mode do? =
"Children" shows the sub-pages of the page currently being viewed (or of a specific reference page ID you set). "Siblings" shows the other pages that share the same parent. Both are designed for sites that organize pages in a hierarchy, like documentation or knowledge bases.

= Can I use this with a custom post type instead of Pages? =
Yes, set the "Post type" option (widget field, block setting, or `post_type` shortcode attribute) to your custom post type's slug, as long as it's a public post type.

= Can I use this with the block-based widget editor? =
Yes, the widget fully supports both Classic Widgets and the Block Widget Editor (introduced in WordPress 5.8).

= How many pages can I select manually? =
As many as you need. The admin picker shows 10 pages per page with navigation arrows to browse all of them.

= I updated from version 1.x, will my existing widgets break? =
No. All existing widget settings (title, mode, selected pages, count) are preserved automatically; the new options simply appear with sensible defaults.

== Screenshots ==

1. Widget backend: choose a display mode and the matching options.
2. The "Pages List" block in the block editor, with the settings panel.
3. Manual page picker with pagination.
4. Frontend output with thumbnails and excerpt enabled.

== Changelog ==

= 2.0.0 =
* New: native Gutenberg block ("Pages List"), usable in any post or page, with a live preview in the editor.
* New: `[onodev_pages_list]` shortcode, usable anywhere shortcodes are supported.
* New: "Children of current page" and "Siblings of current page" display modes.
* New: optional featured image and excerpt display.
* New: order by date, title, menu order, or random; exclude specific page IDs.
* New: highlight the page currently being viewed.
* New: support for custom post types, not only "Page".
* Fix: manual selection mode no longer randomly shuffles which selected pages are shown when the count is lower than the number selected; the same pages are now shown consistently.
* All widget settings from 1.x are preserved; no migration needed.

= 1.2 =
* Added display mode toggle: "Manual Selection" or "Latest Pages".
* Added field to set number of latest pages to display.
* Improved JS and UX for showing/hiding fields dynamically.
* Enhanced block widget compatibility and interface logic.

= 1.1 =
* Fix compatibility with block widget editor.
* Added external JS for pagination to work reliably.

= 1.0 =
* Initial release.

== Upgrade Notice ==

= 2.0.0 =
Adds a Gutenberg block and a shortcode alongside the original widget, plus child/sibling page modes, thumbnails, and excerpts. Existing widgets keep working with no changes required.
