Disable Copy Text in Javascript & CSS

Javascript Code // (A) PREVENT CONTEXT MENU FROM OPENING document.addEventListener(“contextmenu”, (evt) => { evt.preventDefault(); }, false); // (B) PREVENT CLIPBOARD COPYING document.addEventListener(“copy”, (evt) => { // (B1) CHANGE THE COPIED TEXT IF YOU WANT evt.clipboardData.setData(“text/plain”, “Copying is not allowed on this webpage”); // (B2) PREVENT THE DEFAULT COPY ACTION evt.preventDefault(); }, false); CSS Code /* […]

Laravel 9 app cannot see a newly created Controller

Error Target class [AdminToolsController] does not exist. The syntax for routes is Route::get(uri, [controller, action]) Example use App\Http\Controllers\LogoutController; Route::get(‘/logout’, [LogoutController::class, ‘logout’]); Or Route::get(‘/logout’, [\App\Http\Controllers\LogoutController::class, ‘logout’]); Source: https://stackoverflow.com/questions/71074220/my-fresh-laravel-9-app-cannot-see-a-controller    

How to increase maximum volume in Windows 10 for Free

To increase maximum volume in your windows 10 pc, you can downlead and use FX Sound for free. Follow the link to download FX Sound. Boost Volume, Bass and Sound Quality For Windows Although it’s completely free there is an option to donate. If you really like the software I recommend you can make a donation […]

Delete All WooCommerce Products With MySQL

Use the following query to Delete All WooCommerce Products DELETE relations.*, taxes.*, terms.* FROM wp_term_relationships AS relations INNER JOIN wp_term_taxonomy AS taxes ON relations.term_taxonomy_id=taxes.term_taxonomy_id INNER JOIN wp_terms AS terms ON taxes.term_id=terms.term_id WHERE object_id IN (SELECT ID FROM wp_posts WHERE post_type=‘product’); DELETE FROM wp_postmeta WHERE post_id IN (SELECT ID FROM wp_posts WHERE post_type = ‘product’); DELETE […]

wordpress change post thumbnail size

Change post thumbnail size To change post thumbnail size, First check your theme support function add_theme_support(‘post-thumbnails’); Default WordPress Thumbnail the_post_thumbnail( ‘thumbnail’ ); // Thumbnail (150 x 150 hard cropped) the_post_thumbnail( ‘medium’ ); // Medium resolution (300 x 300 max height 300px) the_post_thumbnail( ‘medium_large’ ); // Medium Large (added in WP 4.4) resolution (768 x 0 […]

Disable Windows 10 and Windows 11 Updates Permanently

Click on Start menu and search for “Registry on. Open the Registry and got to the following path – HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Windows Once you are here, right-click on Windows and choose New and then Key. Rename the new entry to WindowsUpdate Now, right-click on the WindowsUpdate entry and select New and then Key. Following that, rename the […]

WooCommerce get all products

WooCommerce get all products $products = wc_get_products( array( ‘status’ => ‘publish’, ‘limit’ => -1 ) ); foreach ( $products as $product ){ echo  $product->get_status();  // Product status echo  $product->get_type();  // Product type echo  $product->get_id();    // Product ID echo  $product->get_title(); // Product title echo  $product->get_slug(); // Product slug echo  $product->get_price(); // Product price echo  $product->get_catalog_visibility(); // Product visibility echo  $product->get_stock_status(); // Product stock status // product date information echo $product->get_date_created()->date(‘Y-m-d H:i:s’); echo $product->get_date_modified()->date(‘Y-m-d H:i:s’); }   blog.qaisarsatti.com/woocommerce/woocommerce-get-all-products/

get all products with php in Woocommerce WordPress

Get all products with php in Woocommerce WordPress require_once(‘../wp-load.php’); global $wpdb; // Get 10 most recent product IDs in date descending order. $query = new WC_Product_Query( array( ‘limit’ => -1 , ‘status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ ) ); $products = $query->get_products(); foreach ( $products as $product ){ //print_r($products); //$pro_id = $product->get_id(); […]

WooCommerce Products Export to CSV via PHP

WooCommerce Products Export to CSV via PHP <?php require_once(‘../wp-load.php’); global $wpdb;   // Get 10 most recent product IDs in date descending order. $query = new WC_Product_Query( array( ‘limit’ => -1 , ‘status’ => ‘publish’, ‘orderby’ => ‘date’, ‘order’ => ‘DESC’ ) ); $products = $query->get_products(); //print_r($products); // while ( $products->have_posts() ) : $products->the_post(); // […]

Export to CSV via PHP

Export to CSV via PHP Use the following command <?php $list = array ( array(‘aaa’, ‘bbb’, ‘ccc’, ‘dddd’), array(‘123’, ‘456’, ‘789’), array(‘”aaa”‘, ‘”bbb”‘) ); $fp = fopen(‘file.csv’, ‘w’); foreach ($list as $fields) { fputcsv($fp, $fields); } fclose($fp); ?> Source: Export to CSV via PHP

How to Enable HTTP Strict Transport Security (HSTS) in WordPress

Enable HTTP Strict Transport Security (HSTS) in WordPress Add the following code into your theme’s functions.php /** * Enables the HTTP Strict Transport Security (HSTS) header in WordPress. */ function tg_enable_strict_transport_security_hsts_header_wordpress() { header( ‘Strict-Transport-Security: max-age=31536000’ ); } add_action( ‘send_headers’, ‘tg_enable_strict_transport_security_hsts_header_wordpress’ ); Source: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Strict-Transport-Security

Paths – aaPanel Administrator Guide – Where is php directory in aapanel

Where is php directory in aapanel #aaPanel aaPanel installation directory: /www/server aaPanel site default directory: /www/wwwroot aaPanel logs file:tmp/panelBoot aaPanel site logs file:/www/wwwlogs #PHP PHP configuration file: /www/server/php/{52|53|54|55|56|70|71}/etc/php.ini PHP installation directory: /www/server/php #Apache Apache vhost configuration file:/www/server/panel/vhost/apache Apache main configuration file:/www/server/apache/conf/httpd.conf #Nginx Nginx vhost configuration file:/www/server/panel/vhost/nginx Nginx main configuration file:/www/server/nginx/conf/nginx.conf #MySQL MySQL installation directory: /www/server/mysql MySQL data directory: /www/server/data MySQL configuration […]

Magento command for site with different version of PHP on aaPanel

Magento command for site with different version of PHP on aaPanel If default php version is 7.3 on aaPanel and your website is running on 7.2 use the following way to run commands /www/server/php/72/bin/php bin/magento setup:upgrade /www/server/php/72/bin/php bin/magento setup:di:compile /www/server/php/72/bin/php bin/magento setup:static-content:deploy

Magento 2 Create Admin User via Command Line

Magento 2 Create Admin User php bin/magento admin:user:create –admin-user=mageplaza –admin-password=WeLoveMagento123 –admin-email=hi@mageplaza.com –admin-firstname=Mageplaza –admin-lastname=Family Source: https://www.mageplaza.com/devdocs/magento-2-add-admin-user-command-line.html#how-to-create-admin-user-via-command-line-in-magento-2

Convert YouTube Videos to MP3 Files

How Convert YouTube Videos to MP3 Files Download 4K Video Downloader from the link. 4k Free Video Downloader Free version have some limitations. Start the app and You can copy a URL from YouTube and click the Paste link with Plus icon on the top left of the app screen. Select Download clip. When the download […]

How to go incognito in Chrome, Edge, Firefox, and Safari

Go incognito in Google Chrome Click on the menu with three vertical dots on the upper right and select New Incognito Window Private browsing in Mozilla Firefox From the upper right menu with three short horizontal lines select New private Private browsing in Microsoft Edge Click on the menu with three horizontal dots at the […]

centos download

centos download (centos 7) To download go to the following link – www.centos.org/download

How to Install ‘Varnish’ (HTTP Accelerator)

Install ‘Varnish’ On Debian and Ubuntu aptitude update && aptitude install varnish On RHEL, CentOS and Fedora yum update && yum install varnish Enter the following command to display the version of Varnish you are running varnishd -V Enable it to start on boot On Debian, Ubuntu service varnish start service varnish status chkconfig –level […]

How To Clear Cache for All Major Browsers

Clear Cache for All Major Browsers You can force a complete refresh by using some simple hotkeys: Windows and Linux browsers: CTRL + F5 Apple Safari: SHIFT + Reload toolbar button Chrome and Firefox for Mac: CMD + SHIFT + R How to Clear Browser Cache for Google Chrome To clear the cache for Google […]

Magento 2 Installation Guide

Magento 2 Installation Guide Install Elasticsearch before installing Adobe Commerce or Magento Open Source 2.4.0 Get the metapackage composer create-project –repository-url=https://repo.magento.com/ magento/project-community-edition <install-directory-name> Set file permissions cd /var/www/html/<magento install directory> find var generated vendor pub/static pub/media app/etc -type f -exec chmod g+w {} + find var generated vendor pub/static pub/media app/etc -type d -exec chmod […]

How to connect Facebook page with Instagram ?

connect Facebook page with Instagram To connect first go to your Facebook page. From the bottom right corner click on the Settings. Then go to Instagram option From Instagram select connect and click continue. Then login with your Instagram credential. You are done!

Generating PDF files with JavaScript

Generate PDF with JavaScript // Default export is a5 paper, portrait, using milimeters for units var doc = new jsPDF() doc.text(‘Hello world!’, 10, 10) doc.save(‘a5.pdf’) <script src=”https://cdnjs.cloudflare.com/ajax/libs/jspdf/1.3.5/jspdf.debug.js”></script> Source: https://stackoverflow.com/questions/742271/generating-pdf-files-with-javascript

How to create an HTML button that acts like a link

Specify the desired target URL in the action attribute to create an HTML button that acts like a link <form action=”https://google.com”> <input type=”submit” value=”Go to Google” /> </form> Source: https://stackoverflow.com/questions/2906582/how-to-create-an-html-button-that-acts-like-a-link

How to echo or print an array in PHP?

Echo or print an array in PHP? <?php $dataArray =  array ( [0] => array (  [‘car’] => ‘BMW’, [‘color’] => ‘red’ ), [1] => array ( [‘car’] => ‘Volvo’, [type] => COMMUNITY ) ) echo ‘<pre>’; print_r($dataArray ); echo ‘</pre>’; ?>

Calling a Custom phtml file in another phtml file, cms block, cms page, and XML layout in Magento 2

Calling a Custom phtml file in Magento 2 Calling in phtml file <?php include ($block->getTemplateFile(‘Magento_Theme::extra/test-view.phtml’)); ?> Calling in CMS page and block {{block class=”Magento\Framework\View\Element\Template” name=”test_view” template=”Magento_Theme::extra/test-view.phtml”}} Calling in XML layout <block class=”Magento\Framework\View\Element\Template” name=”test_view” template=”Magento_Theme::extra/test-view.phtml”/> Source: magento.stackexchange.com/questions/212207/calling-a-custom-phtml-file-in-another-phtml-file-cms-block-cms-page-and-xml

How to Turn off Quick Access in Google Drive?

Go to Google drive from your PC browser to access your Drive. Click on the Setting icon on the top right corner of the window and click. From the General options find the bottom option called “Suggestions” and uncheck option saying “Show Suggested files in My Drive”. 

Magento 2 – Product image not changing with swatch colour

Go to Product under Stores > Attributes. Search for the attribute which’s image change not working and open the attribute. Select Yes on Update Product Preview image option Also don’t forget to check the options “Visible on Catalog Pages on Storefront” and “Used in Product Listing” for the attribute are set to “yes”.

How do I redirect to another webpage?

If you want to simulate someone clicking on a link, use location.href If you want to simulate an HTTP redirect, use location.replace For example: // similar behavior as an HTTP redirect window.location.replace(“http://stackoverflow.com”); // similar behavior as clicking on a link window.location.href = “http://stackoverflow.com”; Sources:  stackoverflow.com/questions/503093/how-do-i-redirect-to-another-webpage

Check whether image exists on remote URL

Use the custom function to check whether image exists on remote URL function checkRemoteFile($url) { $ch = curl_init(); curl_setopt($ch, CURLOPT_URL,$url); // don’t download content curl_setopt($ch, CURLOPT_NOBODY, 1); curl_setopt($ch, CURLOPT_FAILONERROR, 1); curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); $result = curl_exec($ch); curl_close($ch); if($result !== FALSE) { return true; } else { return false; } }

WordPress : Add id & class to form in Contact Form 7

Add id and class to Contact Form 7 elements Example: contact-form-7 id=”1234″ title=”Contact form 1″ html_id=”contact-form-1234″ html_class=”form contact-form” Source: contactform7.com/faq/can-i-add-id-and-class-attributes-to-a-form-element

Resize contact form 7 textarea rows and columns

Change Contact form 7 textarea rows & columns Code [textarea* message id:contact_message 10×2 placeholder “Your Message”] Result <textarea name=”message” cols=”10″ rows=”2″ class=”wpcf7-form-control wpcf7-textarea wpcf7-validates-as-required” id=”contact_message” aria-required=”true” aria-invalid=”false” placeholder=”Your Message”></textarea> Sources: contactform7.com/text-fields/#textarea stackoverflow.com/questions/29025956/wordpress-contactform7-textarea-cols-and-rows-change-in-smaller-screens

How to scroll to specific element using jQuery ?

Scroll to an element with jQuery   <script type=”text/javascript”> jQuery(“.downarrow-go-down”).click(function() { jQuery([document.documentElement, document.body]).animate({ scrollTop: jQuery(“#pricing”).offset().top }, 2000); }); </script> Source: https://stackoverflow.com/questions/6677035/scroll-to-an-element-with-jquery

How to Clear Cookies for a Specific Site in Google Chrome

Clear Cookies for a Specific Site in Google Chrome On your computer, open Chrome . At the top right, click More Settings . Click Privacy and security. Cookies and other site data. Click See all site data and permissions. At the top right, search for the website’s name. To the right of the site, click […]

Add “Where Did You Hear About Us” option in customer invoice email in WordPress

Add “Where Did You Hear About Us” option in WordPress #Add the following code on functions.php to add “How did you find us” option in customer invoice email in WordPress // For display and saving in order details page. <?php add_action( ‘add_meta_boxes’, ‘add_shop_order_meta_box’ ); function add_shop_order_meta_box() { add_meta_box( ‘custom_column’, __( ‘Customer Source’, ‘your_text_domain’ ), ‘shop_order_display_callback’, ‘shop_order’ […]

Make a redirect in PHP

Use the following code to Make a redirect in PHP header(“Location: https://example.com/myOtherPage.php”); die();

Add New Fields to the Order Details Metabox in WordPress

  // For display and saving in order details page. add_action( ‘add_meta_boxes’, ‘add_shop_order_meta_box’ ); function add_shop_order_meta_box() { add_meta_box( ‘custom_column’, __( ‘Customer Source’, ‘your_text_domain’ ), ‘shop_order_display_callback’, ‘shop_order’ ); } function shop_order_display_callback( $post ) { $meta = get_post_meta($post->ID,’customersource’, true); echo ‘ <div class=”customer_sourse_area”><div class=”customer_sourse_label”>Where did you hear about us?</div></div> ‘; if($meta){ //$value = get_post_meta( $post->ID, ‘Amouse Order […]

How to Encrypt and Decrypt a PHP String ?

<?php // Store a string into the variable which // need to be Encrypted $simple_string = “Welcome to GeeksforGeeks\n”; // Display the original string echo “Original String: ” . $simple_string; // Store the cipher method $ciphering = “AES-128-CTR”; // Use OpenSSl Encryption method $iv_length = openssl_cipher_iv_length($ciphering); $options = 0; // Non-NULL Initialization Vector for encryption […]

1 2 3 7