Change the color of the Password Protected Post titles

To change the color of password protected post titles in the admin In your theme or child theme, enqueue a stylesheet to load in the admin, then add some simple CSS to change the color using the class that is given to password protected posts. In your theme’s functions.php… function wpse_admin_styles(){ wp_enqueue_style( ‘admin_css’, get_stylesheet_directory_uri() . … Read more

Filter Hook for post table (not columns)

The same way you would do it on the frontend, with pre_get_posts. Combine it with get_current_screen() so you can tell which area of the admin you’re in, and hook the filter on admin_init so it doesn’t impact the frontend. There’s also the restrict_manage_posts which will let you add inputs to the filter column: https://developer.wordpress.org/reference/hooks/restrict_manage_posts/ Just … Read more

How to get different Related Posts

Randomizing your tags doesn’t matter much to WP_Query. If you want random results, try adding ‘orderby’ => ‘rand’ to your $args. This should randomize the stories returned. If not, try applying shuffle() to $my_query before iterating through them. Some web hosts have reportedly disabled the ‘orderby’=>’rand’ method of querying posts. For these hosts shuffle() seems … Read more

Navigate through the posts using keyboard arrows

You’re using get_next_post and get_previous_post correctly with get_permalink. The next and prev functions either return a WP_Post object or a falsy value. The permalink function accepts either a post object or a valid post ID and returns the post url as string, if it was found, otherwise it returns boolean false. I tested the code … Read more