Adding submit or update button to custom metabox?

Don’t know if i agree with EarnestoDev answer which is more of an opinion then an answer based on facts and not true in all cases, since you can use jQuery to trigger the submit event when a different element is clicked, so just add this js code once <script> jQuery(‘.metabox_submit’).click(function(e) { e.preventDefault(); jQuery(‘#publish’).click(); }); … Read more

Remove border radius setting from the Gutenberg button block?

Create a theme.json file in the root of your theme, and add this inside: { “version”: 1, “settings”: { “blocks”: { “core/button”: { “border”: { “customRadius”: false } } } } } It will only work from WordPress v5.8 and above, because it requires Gutenberg v10. However Gutenberg v10 can be installed as a plugin … Read more

TinyMCE Anchor Button not showing

I had the exact same problem and found the solution to this. The problem is that the anchor plugin for TinyMCE is not being included as part of the default WordPress install. So while WordPress says to include: $buttons[] = ‘anchor’; …that’s not going to work because the TinyMCE plugin for anchors isn’t there. If … Read more

How to add a button to custom post type’s posts-page

You can add button via add_meta_box function. function add_your_meta_box(){ add_meta_box(‘your-metabox-id’, ‘Title’, ‘function_of_metabox’, ‘custom_post_type’, ‘side’, ‘high’);} add_action(‘add_meta_boxes’, ‘add_your_meta_box’); function function_of_metabox() {?> <input type=”submit” class=”button button-primary button-large” value=”Add New” id=”add-new”/> <?php } if you add to multiple post type, you should use foreach loop. function add_your_meta_box(){ $types = array(“post”,”page”,”custom_post_type”); foreach($types as $type){ add_meta_box(‘your-metabox-id’, ‘Title’, ‘function_of_metabox’, $type, ‘side’, … Read more

How i can i add a split button or list box to the WordPress TinyMCE instance

It should be pretty straight-forward, copy the relevant pieces of code from the page you linked to into your existing TinyMCE plugin, update a few strings… done!.. Start with this for your TinyMCE plugin JS and see how you get on.. // JavaScript Document (function() { // Creates a new plugin class and a custom … Read more

How can you change the ‘Insert into Post’ title in the media button?

add_filter(“attribute_escape”, “myfunction”, 10, 2); function myfunction($safe_text, $text) { return str_replace(“Insert into Post”, “Use this image”, $text); } Place in your theme functions file of in a plugin file. The first usable filter that this button hits is on the function esc_attr(). So what that code will do is find any instance of Insert into Post … Read more

How to add multiple buttons to TinyMCE?

First add your additional buttons inside the buttons callback.. function register_button($buttons) { array_push($buttons, “quote”,”wpse-rules”); return $buttons; } Then add additional buttons function inside the plugin javascript.. init : function(ed, url) { ed.addButton(‘quote’, { title : ‘Add a Quote’, image : url+’/image.png’, onclick : function() { ed.selection.setContent(‘[quote]’ + ed.selection.getContent() + ‘[/quote]’); } }); ed.addButton(‘wpse-rules’, { title … Read more

Primary and Secondary Button Classes

It looks like you’re trying to use classes from the WordPress admin styles on the front end. However, those styles are not loaded. You have two options, one of which I wouldn’t recommend. Way #1: Do this What I would recommend is that you simply copy and paste the buttons styles you want into your … Read more

Add button to TinyMCE bar without creating a plugin

It is almost code golf, but this is the smallest piece of code that I could up with that will create a button on the Visual editor to turn the current paragraph in a <h2> block. add_filter( ‘tiny_mce_before_init’, ‘wpse18719_tiny_mce_before_init’ ); function wpse18719_tiny_mce_before_init( $initArray ) { $initArray[‘setup’] = <<<JS [function(ed) { ed.addButton(‘h2’, { title : ‘H2’, … Read more