• Resolved WatcherJoshua

    (@watcherjoshua)


    I would like to add custom post types (and WordPress pages) to the “Publishing Soon” and “Recently Published” sections of the dashboard Activity widget. We have multiple post types that are scheduled in advance, but there is no easy way to see it all at a glance.

    I assumed that the built-in widget was not easy to change, so I began building my own plugin to add a custom widget to the dashboard. I copied some of the code from the Activity widget and successfully displayed the same information a second time, but I tried to change the post_type in the array and did not get any results. The function doesn’t recognize my custom post types or other default post types, like pages. Instead, the widget still displays the posts – as if the value of post_type doesn’t exist at all.

    Am I using the wrong function? How can I get a list of scheduled content from several post types?

    Here’s what I have at the moment (ignoring the standard setup functions like wp_add_dashboard_widget – all of that is working perfectly):

    	$future_posts = wp_dashboard_recent_posts(
    		array(
                'post_type' => 'page',
    			'max'    => 15,
    			'status' => 'future',
    			'order'  => 'ASC',
    			'title'  => __( 'Publishing Soon' ),
    			'id'     => 'future-posts',
    		)
    	);
    	$recent_posts = wp_dashboard_recent_posts(
    		array(
    			'max'    => 5,
    			'status' => 'publish',
    			'order'  => 'DESC',
    			'title'  => __( 'Recently Published' ),
    			'id'     => 'published-posts',
    		)
    	);

    `

    • This topic was modified 4 years, 7 months ago by WatcherJoshua.
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Add custom post types to Dashboard Activity widget’ is closed to new replies.