How to make a script load after Custom Block is loaded in the editor?

I couldn’t find a built in ACF way of doing this. Instead, in my block’s PHP render function I added printf( “<script>window.jQuery(window).trigger(‘acf/loaded/block-name’);</script>” ); This uses jQuery as an event bus to trigger an event when the block is rendered. You might need to include a check that you’re in the admin so the event won’t … Read more

Prevent WordPress from abbreviating-long-slugs…-in-the-admin

There is a filter at the end of the function: ‘get_sample_permalink_html’. Hook into this and just replace the shortened form with the full length. <?php # -*- coding: utf-8 -*- /* Plugin Name: T5 Unabridge Permalink Slug */ add_filter( ‘get_sample_permalink_html’, ‘t5_unabridge_sample_permalink’, 10, 2 ); /** * Replaces the shortened permalink with its full form. * … Read more

How do I position meta_box on post edit screen after the title?

You cannot use a real metabox to do that, hook into edit_form_after_title instead. Here is a simple example: add_action( ‘edit_form_after_title’, ‘wpse_87478_pseudo_metabox’ ); add_action( ‘save_post’, ‘wpse_87478_save_metabox’ ); function wpse_87478_pseudo_metabox() { global $post; $key = ‘_wpse_87478’; if ( empty ( $post ) || ‘post’ !== get_post_type( $GLOBALS[‘post’] ) ) return; if ( ! $content = get_post_meta( $post->ID, … Read more

add button to post edit page when post_status=publish

This will get you started; add_action( ‘post_submitbox_misc_actions’, ‘custom_button’ ); function custom_button(){ $html=”<div id=”major-publishing-actions” style=”overflow:hidden”>”; $html .= ‘<div id=”publishing-action”>’; $html .= ‘<input type=”submit” accesskey=”p” tabindex=”5″ value=”Customize Me!” class=”button-primary” id=”custom” name=”publish”>’; $html .= ‘</div>’; $html .= ‘</div>’; echo $html; } Adds a custom button to Publish Meta Box – example; So far you still need to; register … Read more

Syntax highlighting for post/page editor [closed]

I am using SyntaxHighlighter Evolved by Viper007Bond, works great! http://wordpress.org/extend/plugins/syntaxhighlighter/ After I gave this answer yesterday, I read a recent post by Konstantin Kovshenin over at theme.fm, which gives you all the different possibilities on how to add syntax into your Posts/Pages: http://theme.fm/2011/07/working-with-code-in-wordpress-posts-985/

How can I put a custom meta box above the editor but below the title section on the edit post page?

Simply add a meta box using the advanced context, and high priority Then, latch on to the edit_form_after_title hook Print your meta boxes out there, then remove it so it doesn’t appear twice. // Move all “advanced” metaboxes above the default editor add_action(‘edit_form_after_title’, function() { global $post, $wp_meta_boxes; do_meta_boxes(get_current_screen(), ‘advanced’, $post); unset($wp_meta_boxes[get_post_type($post)][‘advanced’]); });