News title Character Limit

function truncate_html($html, $maxLength) { // Return early if the initial string is shorter than the maxLength if (strlen($html) loadHTML(mb_convert_encoding($html, ‘HTML-ENTITIES’, ‘UTF-8’), LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); libxml_clear_errors(); // Use an XPath query to select all text nodes $xpath = new DOMXPath($dom); $textNodes…Continue reading

to do list working

/** * Plugin Name: Shop Manager To-Do List * Description: Adds a custom to-do list feature for shop managers in the WordPress admin. * Version: 1.0 * Author: Your Name */ // Register custom post type for To-Dos function create_todo_post_type()…Continue reading

Delete Expired Coupons

// Delete Expired Coupons that have an expiration date set and are not from AutomateWoo add_action(‘delete_expired_coupons_hook’, ‘delete_expired_coupons_action’); function delete_expired_coupons_action() { $query_args = [ ‘fields’ => ‘ids’, ‘post_type’ => ‘shop_coupon’, ‘post_status’ => ‘any’, ‘posts_per_page’ => -1, ‘orderby’ => ‘date’, ‘order’ =>…Continue reading

Loading custom templates

/** * Plugin Name: WPForms Custom Templates * Description: This plugin loads custom form templates. * Version: 1.0.0 */ /** * Load the templates. */ function wpf_load_custom_templates() { // Template code here } add_action( ‘wpforms_loaded’, ‘wpf_load_custom_templates’ );Continue reading

WP Mail SMTP access rights to other users

add_filter(‘wp_mail_smtp_admin_area_get_logs_access_capability’, function (){ return ‘manage_options’; }); add_filter(‘wp_mail_smtp_pro_emails_logs_logs_get_manage_capability’, function (){ return ‘manage_options’; });Continue reading

EDD Smart Tags

add_filter( ‘wpcode_smart_tags’, function ( $tags ) { $tags[‘edd’] = array( ‘label’ => ‘Easy Digital Downloads’, ‘tags’ => array( ‘edd_order_total’ => array( ‘label’ => ‘Order Total’, ‘function’ => ‘wpcode_custom_get_edd_order_total’, ), ‘edd_order_items_count’ => array( ‘label’ => ‘Order Items Count’, ‘function’ => ‘wpcode_custom_get_edd_order_items_count’,…Continue reading

WP Simple Pay: Allow Customers to Exempt from Tax

add_filter( ‘simpay_get_customer_args_from_payment_form_request’, function( $customer_args, $form, $deprecated, $form_values ) { $exempt = isset( $form_values[‘simpay_field’][‘Tax Exempt’] ); if ( $exempt ) { $customer_args[‘tax_exempt’] = ‘exempt’; } return $customer_args; }, 10, 4 );Continue reading