Create side bar widget showing list of years as hyperlinks for a custom post type

First, create the custom WordPress widget. This will query all the years that have at least one post for your custom post type “Meeting.” Save the following code in your theme’s functions.php file: class Meeting_Archive_Widget extends WP_Widget { public function __construct() { parent::__construct(‘meeting_archive’, ‘Meeting Archive’, array(‘description’ => ‘List Meetings by Year’)); } public function widget($args, … Read more

Create custom dashboard for plugin

The first parameter to wp_enqueue_script()—in this case, dashboard—is the handle of the script. The handle can be pre-registered using wp_register_script(), and that’s where the script’s path will be set. dashboard isn’t one of the default scripts that WordPress registers, but it’s entirely possible some other entity has registered it. Looking at the example code that … Read more

WordPress PHP8.2 Critical Error in class-wp-widget.php

Seems like the theme you use (nice_hotel?) uses an extremely outdated version of registering a widget (see here). As this seems to be a premium theme, you should probably contact the themes author, but as i couldn’t find an “active” version of this theme (if it is nice_hotel: themeforest theme shows “no longer available”), you’re … Read more

How to add the “page” post type to Recent Activity widget displayed in admin?

Add page post type to your code (tested): add_filter( ‘dashboard_recent_posts_query_args’, function(array $queryArgs) { $postTypes = get_post_types([ ‘public’ => true, ‘capability_type’ => ‘post’, ]); $postTypes[] = ‘page’; if ( is_array( $postTypes ) ) { $queryArgs[‘post_type’] = $postTypes; } return $queryArgs; }, 15 ); The reason your original code did not include pages is because pages have … Read more