Show/hide button in thickbox depending on from which page it is opened
Show/hide button in thickbox depending on from which page it is opened
Show/hide button in thickbox depending on from which page it is opened
<?php function wpse_1234() { add_thickbox(); } add_action(‘init’,’wpse_1234′); ?> <a href=”#TB_inline?height=300&width=400&inlineId=preview” class=”thickbox”>View all<a>”; <div id=’preview’ style=”display:none;”></div> Try this way it should work for thickbox.you can call those thickbox in a init hook. Thanks.
Suppose you want to open the modal to the create gallery section: var options = { frame: ‘post’, state: ‘gallery’, title: wp.media.view.l10n.createGalleryTitle, multiple: true }; var frame = wp.media.editor.open(null,options) If you want something else, I suggest you search through the core js source to change the Library ID as appropriate for the section you need.
In WordPress 3.5, this hook works for me: add_action( ‘print_media_templates’, ‘wpse_75746_print_style_35’ ); function wpse_75746_print_style_35() { ?> <style> .media-modal-content, .media-sidebar { background: #FFF2D4 !important; } </style> <?php } In 3.4.2, this is the one: add_action( ‘admin_print_styles-media-upload-popup’, ‘wpse_75746_print_style_342’ ); function wpse_75746_print_style_342() { ?> <style> #media-upload { background: #FFF2D4 !important; } </style> <?php }
You need to add a call of wp_footer(); function. Do it before closing body tag in your footer.php file. It should look like this: <?php wp_footer(); ?> </body> </html>
Update: Since the link is unavaiable anymore (linked a webarchive in comments but it’s still pretty old and buggy) I suggest to use this. It’s more efficient and reliable and does not require any file add-in or advanced knowledge being more detailed than the old one. Original I’ve bumped into this one before. Here, follow … Read more
After digging into this for a bit, it looks like there’s a number of pages where WordPress ends up changing the behavior of the default thickbox implementation — this includes both javascript changes, as well as custom style rules. You can see an example of this here #File: wp-admin/js/media-upload.js // thickbox settings var tb_position; (function($) … Read more
Answer can be found here: https://stackoverflow.com/questions/13863087/wordpress-custom-widget-image-upload Even though the problem described isn’t exactly the same as I had, the code posted in the answer still helped me as that code actually does exactly what I needed. I also think that I didn’t originally find this answer as it’s on the regular Stack Overflow and not … Read more
plugins.php page calls add_thickbox() function that enqueues WP native thickbox script and style. It has this in documentation: If any of the settings need to be changed, this can be done with another js file similar to media-upload.js and theme-preview.js. That file should require array(‘thickbox’) to ensure it is loaded after. So there are different … Read more
tinyMCE isn’t implemented as a jQuery plugin. I’m not sure, but this would be more probable: window.parent.tinyMCE.get(‘editor’).getContent()