Can I individually style items in the backend widget list?

Just as @MarkKaplun mentioned in a comment, it’s possible with CSS. Also with Javascript. CSS Approach Let’s look at the Calendar widget, as an example. The id for the widget, in the available widgets list, is of the form: widget-{integer}_calendar-__i__ and in the sidebar it’s: widget-{integer}_calendar-{integer} If we want to display the calendar dashicon before … Read more

How to untrash a post only if it was not a draft?

Just as @cybmeta mentioned, the info is stored in the post meta table. When we trash a post then the post meta key _wp_trash_meta_status is added with the value of the previous post status (publish, pending, draft, … ). Within the wp_trash_post() function, we have: add_post_meta($post_id,’_wp_trash_meta_status’, $post[‘post_status’]); add_post_meta($post_id,’_wp_trash_meta_time’, time()); We might therefore try: // Get … Read more

Sharing common functionality (functions, template parts) between plugins and themes?

The important thing is to make plugin and theme completely functional on their own. Let’s take a look at Codex definition of both theme and plugin: WordPress plugins allow you to easily modify, customize, and enhance a WordPress site. WordPress Themes are files that work together to create the design and functionality of a WordPress … Read more

Redirect traffic to plugin

You can use the init hook to check the $_REQUEST or $_GET super-global variable for your token value and then redirect to pages that are present via WP Core: home_url wp_login_url If you pass additional parameters to these URLs, such as token_valid=true you can use that along with conditional tags like is_front to conditionally display … Read more