Use CodeMirror editor for both CSS and HTML on the same page

I just ran into this exact issue and with a tiny bit of tweaking it should work, what you have is 90% of the way there. I’ve tweaked your code slightly so it should now work. The PHP: add_action(‘admin_enqueue_scripts’, ‘joermo_enqueue_scripts’); function joermo_enqueue_scripts($hook) { $joermo_code[‘ce_html’] = wp_enqueue_code_editor(array(‘type’ => ‘text/html’)); $joermo_code[‘ce_css’] = wp_enqueue_code_editor(array(‘type’ => ‘text/css’)); wp_localize_script(‘jquery’, ‘joermo_code’, … Read more

What is a settings group actually for?

Sanitization is secondary function. Main is: The register_setting and unregister_setting functions add and remove options from a whitelist of allowed options that the form is able to save. They can also name a sanitize callback function as a security measure to check each option’s value. ( Register settings ) Technically $option_group argument is used for: … Read more

Building a better media uploader for WordPress

You can use WordPress’s built in upload handler, wp_handle_upload(). You can use the upload_dir filter to set the custom directory. Here are some code snippits from one of my plugins that you can use/modify: public function saveCustomFields() { global $post; if($post->post_type == self::POST_TYPE && current_user_can( ‘edit_post’, $post->ID ) ) { if ( defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE … Read more

How to change wordpress post title?

add_filter(‘the_title’, ‘wordpress_title’); function wordpress_title($title){ //Return new title if called inside loop if ( in_the_loop() ) return ‘New title’; //Else return regular return $title; } Have you tried the in_the_loop() conditional check to return new title only if called inside loop. That means nav menu’s will not get affected.

How to list events by category and month with plugin Event Organiser?

You can use the plug-in provided function eo_get_events(). This is essentially a wrapper for get_posts(), and so is intended for ‘secondary’ loops. The plug-in specific arguments can also be given to a WP_Query object – in case you wanted to modify the main loop. (Related: When to use WP_query(), query_posts() and pre_get_posts ) $events = … Read more