How to create a theme option-menu page to save user values

update: All the following code should go into your functions.php file Probably the best (and definitely the easiest) way to make a Theme Options Page is to use the WordPress Settings API. One note… everywhere you see THEME_NAME in my code, just replace this with some unique phrase (I use my theme name). First we … Read more

register_theme_directory and broken deploys

There is a bug in class-wp-upgrader.php: WordPress is using the fixed path WP_CONTENT_DIR . ‘/themes’ and doesn’t use get_theme_root(). I have written a patch 7 months ago … which was too late for WordPress 3.6 – the fix was delayed just today. So use my patch, or jump in on Trac and explain why this … Read more

Set the transport of the Customizer ‘header_image’ core setting to ‘postMessage’

Luckily, I was facing the same issue an hour ago so I brainstormed for a long time to find a find a solution. I posted it here before seeing this: http://www.hardeepasrani.com/2015/12/using-postmessage-transport-method-for-header-image/ So instead of just using: $wp_customize->get_setting( ‘header_image’ )->transport=”postMessage”; I used: $wp_customize->get_setting( ‘header_image’ )->transport=”postMessage”; $wp_customize->get_setting( ‘header_image_data’ )->transport=”postMessage”; After that, in JS, we got the value … Read more

Remove/Disable “Automatically add new top-level pages to this menu”

Since there is no filter to remove this option, your best best to to stick to using CSS by putting the following in your child theme’s functions.php: add_action( ‘admin_head’, ‘wpse_225635_menu_css’ ); function wpse_225635_menu_css() { global $pagenow; if ( $pagenow == ‘nav-menus.php’ ) { ?> <style type=”text/css”> .auto-add-pages { display: none; } </style> <?php } }

Use of undefined constant FS_CHMOD_DIR – assumed ‘FS_CHMOD_DIR’

It’s really quite simple. The theme author is using a constant that you can put in wp-config.php, but because you don’t use that constant, and the author never checks if it’s actually defined, the code throws a PHP warning https://codex.wordpress.org/Editing_wp-config.php#Override_of_default_file_permissions Override of default file permissions The FS_CHMOD_DIR and FS_CHMOD_FILE define statements allow override of default … Read more