How to use WordPress built-in Media Uploader

    To use WordPress’s default media uploader in a frontend form, you can enqueue the WordPress media scripts and use JavaScript to handle the file upload interface on the frontend. Here’s a basic example: 1. Enqueue Media Scripts In your theme’s functions.php or a custom plugin, enqueue the necessary WordPress media scripts: 2. Create a Frontend […]

    Read More

    Resize an image to fit within a specified maximum width and height in PHP

      Here is a PHP function that resizes an image to fit within a specified maximum width and height, preserving its aspect ratio. This can be useful if you’re working with WordPress or a similar PHP-based platform: Usage Explanation

      Read More

      How to fix – Blocked script execution because the document’s frame is sandboxed and the ‘allow-scripts’ permission is set

        The error “Blocked script execution because the document’s frame is sandboxed and the ‘allow-scripts’ permission is set” indicates that the browser is preventing JavaScript execution in an <iframe> due to restrictions defined by the sandbox attribute. This attribute limits what an iframe can do for security reasons. When the sandbox attribute is applied without additional […]

        Read More

        Create individual orders for each item in WooCommerce cart

          Add this to your theme’s functions.php file Keep only 1 product in the original order, delete other products from this order. Place the removed products (each separately) in a new order. function lpj_woocommerce_checkout_order_processed( $order_id, $posted_data, $order ) { // Get order currency $order_currency = $order->get_currency(); // Get order payment method $order_payment_gateway = $order->get_payment_method(); // Address […]

          Read More

          How to add same product to cart twice instead of changing quantity in WooCommerce

            Add this to your theme’s functions.php file function lpj_add_prod_as_separate_cart_item( $cart_item_data, $product_id ) { $unique_cart_item_key = uniqid(); $cart_item_data[‘unique_key’] = $unique_cart_item_key; return $cart_item_data; } add_filter( ‘woocommerce_add_cart_item_data’, ‘lpj_add_prod_as_separate_cart_item’, 10, 2 );

            Read More

            Navigating the MySQL End of Life: Migrating to MySQL 8

              As October 2023 approaches, a pivotal moment in the realm of database management is on the horizon: the end of life for MySQL versions prior to 8. This development signals a crucial shift, as it marks the cessation of security updates and technical support for these older versions. This article aims to shed light on […]

              Read More

              WordPress Website Custom Function Development

                WordPress website custom function development refers to the process of creating and adding custom PHP functions to extend the functionality of a WordPress website beyond its default capabilities. WordPress is a popular content management system (CMS) that allows users to build and manage websites easily. However, there are instances where you may need specific features […]

                Read More