hedgehog90
Forum Replies Created
-
I’m noticing the same error.
I see in the generated .htaccess file in uploads the condition:
RewriteCond %{HTTP_ACCEPT} image/webp
Which I assume is the Vary: Accept header.
Is there an option to remove this condition to allow cloudflare to cache & deliver the webp images on subsequent requests?- This reply was modified 8 months ago by hedgehog90.
Forum: Fixing WordPress
In reply to: Uploaded PNG Image intermediate sizes not converted to WebPAre you sure?
I have no WebP related plugins active but I can clearly see that when I upload JPEG images all the intermediate sizes generated immediately after uploading are all webp format.
Not so for PNG images though.
I think this feature was added a couple years ago.
That appears to be a related problem but not the crux of the issue I’ve described.
When I open one of the old posts in the editor, the front-end gutenberg JS automatically processes the block code to create the latest HTML…In the element inspector, the wp-block-gallery tree is essentially figure -> ul -> li, but the latest gutenberg JS converts it to a simpler (better) figure -> figure tree.
Also I’ve noticed a bug whereby galleries no longer have a bottom margin for some reason.
Here’s the pre-processed Less I’m using to fix all the issues I’ve mentioned but it’s not ideal:
// wordpress fixes // --------------------------------------------------- // undoes a 'fix' applied in 6.0.3 .wp-block-columns.are-vertically-aligned-center { align-items: center!important; } // fix after wordpress update .wp-block-gallery.aligncenter { justify-content: center; } // makes old posts using wp-block-gallery like new posts (with new html...) .wp-block-gallery { margin-bottom: 1rem; } .wp-block-gallery:not(.has-nested-images) { margin-bottom: 1rem; &>ul { flex: 1; gap: inherit; &>li { margin: 0 !important; } } }
- This reply was modified 2 years ago by hedgehog90.
- This reply was modified 2 years ago by hedgehog90.
Forum: Developing with WordPress
In reply to: metabox html not updating after publishI didn’t include that bit because it’s irrelevant, I’ve verified the post meta values were updating on save_post.
I’ve seen so many people ask this question and everyone misinterprets and provide unhelpful responses.
To restate – I need the meta box html to update after pressing Publish or Update.
That’s it!
And you would expect after it shows a spinning icon in the meta box header after publishing it would update the meta box’s content, and although it does call the add_meta_box $callback in an AJAX request, it does nothing with this data (for reasons I’m not familiar with.)Anyway, I put together a client-side hack that works for me. I hope someone else finds this useful:
add_action('admin_init', function () { if ( current_user_can("send_notifications") ) { $post_types = ["post", "go_live"]; foreach ($post_types as $post_type) { add_meta_box( 'cabtv_notif_on_post', 'Notifications', function ($post) { wp_nonce_field( 'cabtv_notif_metabox', 'cabtv_notif_metabox' ); $sent = (bool) get_post_meta( $post->ID, 'cabtv_notifications_sent', true ); $checked = cabtv_should_post_send_notification($post->ID); ?> <div id="cabtv_notification_sent" style='margin-bottom:10px; <?php if (!$sent) echo 'display: none'; ?>'><span style='color:red; font-weight:bold;'>Notifications have been sent for this post.</span></div> <label><input type="checkbox" id="cabtv_send_notification" name="cabtv_send_notification" value="1" <?php if ($checked) echo 'checked'; ?>></input> <?php echo esc_attr('Send notification on '.($post->post_status === 'publish' ? 'update' : 'publish') ); ?></label> <script> $(document).ready(()=>{ function update_meta_box() { var cb = document.querySelector("#cabtv_send_notification"); if (cb.checked) document.querySelector("#cabtv_notification_sent").style.display = null; cb.checked = false; } var dispatch = wp.data.dispatch( 'core/edit-post' ); var oldMetaBoxUpdatesSuccess = dispatch.metaBoxUpdatesSuccess; dispatch.metaBoxUpdatesSuccess = function(...args) { update_meta_box(); return oldMetaBoxUpdatesSuccess.apply(this, args); } }); </script> <?php }, $post_type, 'side', 'high' ); } } });
I also posted this on wordpress.stackexchange:
- This reply was modified 3 years, 4 months ago by hedgehog90.
- This reply was modified 3 years, 4 months ago by hedgehog90.
Forum: Developing with WordPress
In reply to: metabox html not updating after publishThe above code was just a simplified example to demonstrate the issue of the html not reloading after the post is updated / saved.
When I use form elements it still doesn’t update:add_action('admin_init', function () { if ( current_user_can("send_notifications") ) { $post_types = ["post", "go_live"]; foreach ($post_types as $post_type) { add_meta_box( 'cabtv_notif_on_post', 'Notifications', function ($post) { wp_nonce_field( 'cabtv_notif_metabox', 'cabtv_notif_metabox' ); $sent = (bool) get_post_meta( $post->ID, 'cabtv_notifications_sent', true ); $checked = cabtv_should_post_send_notification($post->ID); if ( $sent ) { ?> <div style='padding:10px;'><span style='color:red; font-weight:bold;'>Notifications have already been sent for this post.</span></div> <?php } ?> <input type="checkbox" name="cabtv_send_notification" value="1" <?php if ($checked) echo 'checked'; ?>></input> <label><?php echo esc_attr('Send notification on '.($post->post_status === 'publish' ? 'update' : 'publish') ); ?></label> <?php }, $post_type, 'side', 'high' ); } } });
Surely there should be an option in Contact Form’s settings to prevent the recaptcha script loading and displaying the badge on every page.
Why is this not implemented? Just a simple checkbox.Forum: Developing with WordPress
In reply to: metabox html not updating after publishIt’s not a syntax error.
I’ve just checked with another plugin that adds a meta box to the editor and it isn’t updating after posting either, but if I check the Network tab in Chrome Dev Tools I can see the the new page, with updated metabox values downloading as a resource.Forum: Plugins
In reply to: [Contact Form 7] Not working with sendinblue mailer (WP Mail SMTP)My site is cabtv.co.uk, and my email address is admin at cabtv.co.uk.
If you could point me in the direction of a javascript solution that would be much appreciated.
So that when the user changes an option on the front-end, there will be some hook or callback that will allow me to disable/grey-out irrelevant fields, or in some cases fill in other fields with alternative values.