Is there a hook that I can use when a fatal error occurs?

Look into the WP_Fatal_Error_Handler class. I see a couple of filters in its display_default_error_template() method that might be helpful for you: wp_php_error_args wp_php_error_message The entire class is a drop-in, so if you need to you can replace it entirely with your own version, but I think one of those filters—probably wp_php_error_args—might be what you’re looking … Read more

Add text below WooCommerce short description if metabox value is true

Following the suggestion by @1inmillion, I put the second filter inside the first IF statement, which works nicely. This is the combined code: // 1. Add text below short description function bja_product_unavailable_text( $content ) { $content .= ‘<div class=”bja_product_unavailable”>This product is unavailable</div>’; return $content; } // 2. Remove add to cart button if product is … Read more

WP_Query filter Posts by timestamp event (range start and end) and by month (next 12 month)

Resolved. My error are there : $FirstDayThisMonth[] = date(‘Y-m-01 00:00:01’, mktime(0, 0, 0, $x, 1)); $LastDayThisMonth[] = date(‘Y-m-t 23:59:59’, mktime(0, 0, 0, $x, 1)); instead of : $datestart = strtotime(date(‘Y-‘.$nbofmonth.’-01 00:00:01′)); $dateend = strtotime(date(‘Y-‘.$nbofmonth.’-t 23:59:59′)); It’s always very annoying to have well written code and to realize that a small element breaks everything

coloring row’s background based on custom field value

function add_custom_status_class( $classes, $class, $post_id ) { if ( ‘request’ === get_post_type( $post_id ) ) { $status = get_post_meta( $post_id, ‘hrs_field_status’, true ); if ( $status === ‘accepted’ ) { $classes[] = ‘status-accepted’; } elseif ( $status === ‘rejected’ ) { $classes[] = ‘status-rejected’; } } return $classes; } add_filter( ‘post_class’, ‘add_custom_status_class’, 10, 3 ); … Read more

Rewrite permalink with PHP processing

Based on your example there are 4 fundamental steps to take. I’ve tried to use examples below, and they may not work as is, but they demonstrate the fundamental principles needed: 1. Add a query var shorty This whitelists shorty and gives the 2c from /shorty/2c somewhere to be stored function shorty_query_vars( array $qvars ) … Read more