Recognising a screen size change

This is called responsive design and has nothing to do with WordPress, it is an extension rule to media queries (@media) in CSS3. CSS is a browser/client side language which can determine window sizes and browser types, this is what is used to determine how a website should look at a specific window size or … Read more

Declare Global Variable In OOP PHP

The $current_screen is passed as a variable to callables hooked from the current_screen hook. Before this hook, the $current_screen isn’t set up, so globalizing the variable won’t do anything anyway. Also, WordPress offers the convenience function get_current_screen() that returns the global $current_screen variable if it exists. class wpse { protected $current_screen; public function load() { … Read more

Issue with contextual help overwriting existing content

In order to not delete help from all other screens, you need to always return the contextual help text, otherwise your filter doesn’t return anything for non-page/post screens and so nothing will show up. Move the return to the bottom of the function, outside of your if/else. Also, the original contextual help is being concatenated … Read more

Make Post Editor Select Number of Columns To 1 By Default

Ok, so this is how I did it. This hook into the admin head, find the screen options part and set the default checked radio button to 1, which mean full screen. Just found the answer from here and give it a little modification: add_action( ‘admin_head’, ‘wpse1152474_post_editor_columns’); function wpse1152474_post_editor_columns() { global $pagenow, $typenow; if ($pagenow … Read more

Add options to the “Screen Options” section on the “Menus” editor

Figured this out by looking through the WordPress source code 🙂 function new_site_add_custom_screen_options($args) { $args[“custom_option_1”] = __(“Custom Option 1”, “new_site”); $args[“custom_option_2”] = __(“Custom Option 2”, “new_site”); return $args; } add_filter(“manage_nav-menus_columns”, “new_site_add_custom_screen_options”, 20);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)