njbair
Forum Replies Created
-
Forum: Plugins
In reply to: [Gutenberg] Widget Editor & Customizer are brokenUpdate: This definitely is related to some kind of database corruption. I was able to manually modify the value of the
sidebars_widgets
row in the DBwp_options
table. Removing the problematic sidebar entries from the main array fixed the issue.Note, if you do this, you also have to change the number at the beginning of the string to reflect the new number of rows in the array. In my case, it went from 11 rows to 8 rows so I had to change
a:11:{
toa:8:{
.Not exactly beginner-level stuff, but I’m glad I got it resolved.
Forum: Plugins
In reply to: [Gutenberg] Widget Editor & Customizer are brokenTo help debug this further, I commented out every register_sidebar() call in my child theme’s functions file, except for a new one for testing. When I reloaded the Widgets page, the only section was Inactive Widgets. My test sidebar didn’t render, even though all the other sidebars were unregistered.
I’m not sure if this is helpful info but I figure it can’t hurt to share.
Forum: Plugins
In reply to: [WordPress Slider Block Gutenslider] Gutenslider is a PageSpeed-KillerIf you make this change, it would be good to have it behind an option, as I am developing some custom blocks that rely on the Slick.js instance that comes bundled with your plugin. I have some sliders built around custom queries, and it doesn’t make sense to load more than one copy, after all.
Or at least expose a filter that allows devs to override any auto-hiding settings and manually include the assets as needed.
Forum: Plugins
In reply to: [WooCommerce] Depcrecated error on wp dashboard@amandalihope I had the same issue. I temporarily disabled WooCommerce Admin and not only did the error go away, but the Admin still works fine since it’s now included in the main WooCommerce plugin.
Hope this helps!
Forum: Plugins
In reply to: [Contact Form 7] Load reCaptcha only on CF7 pagesAs a follow-up, I’m not sure if the CF7 developers read these things, but it would be great if the reCAPTCHA module honored the WPCF7_LOAD_JS constant. Then one could simply follow the existing instructions for conditional loading available here:
https://contactform7.com/loading-javascript-and-stylesheet-only-when-it-is-necessary/
Forum: Plugins
In reply to: [Contact Form 7] Load reCaptcha only on CF7 pagesI am accomplishing this with some help from the Advanced Custom Fields plugin. I create a custom Yes/No field for all pages, labeled “Enable Contact Form 7 on this page.”
If you have the ACF plugin installed, simply add the following code to your theme’s functions.php file:
if( function_exists('acf_add_local_field_group') ): acf_add_local_field_group(array( 'key' => 'group_5d7413a1836ca', 'title' => 'Contact Form 7', 'fields' => array( array( 'key' => 'field_5d7413a9fdc3f', 'label' => 'Enable Contact Form on this page', 'name' => 'enable_contact_form_on_this_page', 'type' => 'true_false', 'instructions' => 'Set to \'Yes\' to activate CSS & JS for Contact Form 7 & reCAPTCHA v3.', 'required' => 0, 'conditional_logic' => 0, 'wrapper' => array( 'width' => '', 'class' => '', 'id' => '', ), 'message' => '', 'default_value' => 0, 'ui' => 1, 'ui_on_text' => '', 'ui_off_text' => '', ), ), 'location' => array( array( array( 'param' => 'post_type', 'operator' => '==', 'value' => 'page', ), ), ), 'menu_order' => 0, 'position' => 'normal', 'style' => 'default', 'label_placement' => 'top', 'instruction_placement' => 'label', 'hide_on_screen' => '', 'active' => true, 'description' => '', )); endif;
Next, I have a bit of code which checks for that custom field and if it’s unset or set to No, I dequeue the reCAPTCHA script and prevent the other CF7 assets from being loaded as well. Add this to your functions.php file:
add_action( 'wp', 'contact_form_7_check' ); function contact_form_7_check() { if ( get_field( 'enable_contact_form_on_this_page' ) ) { } else { add_filter( 'wpcf7_load_js', '__return_false' ); add_filter( 'wpcf7_load_css', '__return_false' ); add_action( 'wp_print_scripts', 'disable_recaptcha' ); } } function disable_recaptcha() { wp_dequeue_script( 'google-recaptcha' ); }
- This reply was modified 5 years, 6 months ago by njbair. Reason: removed theme-specific function names
Forum: Fixing WordPress
In reply to: limiting posts displayHere is something I do in order to show the first full posts, and then excerpts of the other 9. This is in WP 1.51.
<div class="entry">
<?php
$number_of_posts++;
if ($number_of_posts > 1) { echo the_excerpt(); }
else { echo the_content('Read the rest of this entry »'); }
?>
</div>
Forum: Themes and Templates
In reply to: Category LinksWell I guess there’s nothing WP can’t do ??
Thanks all