Skip to content

Instantly share code, notes, and snippets.

View majeedraza1's full-sized avatar
🎯
Focusing

Majeed Raza majeedraza1

🎯
Focusing
View GitHub Profile
/*
* Remove the default WooCommerce 3 JSON/LD structured data format
*/
function remove_output_structured_data() {
remove_action( 'wp_footer', array( WC()->structured_data, 'output_structured_data' ), 10 ); // Frontend pages
remove_action( 'woocommerce_email_order_details', array( WC()->structured_data, 'output_email_structured_data' ), 30 ); // Emails
}
add_action( 'init', 'remove_output_structured_data' );
<?php
/*
* Create order dynamically
*/
add_action( 'woocommerce_before_checkout_form', 'create_order' );
function create_order() {
global $woocommerce;
<?php
/**
* When you hover a product image when on the single product page, you can zoom on the products images; I love this feature, however
* Some people would like to remove it.
* To do so, simply paste this snippet in your functions.php file
*/
add_action( 'after_setup_theme', 'theme_name_setup' );
function theme_name_setup() {
remove_theme_support( 'wc-product-gallery-zoom' );
<?php
// Place this in your functions.php file in your theme folder.
remove_theme_support( 'wc-product-gallery-lightbox' );
<?php
// Display variations dropdowns on shop page for variable products
add_filter( 'woocommerce_loop_add_to_cart_link', 'woo_display_variation_dropdown_on_shop_page' );
function woo_display_variation_dropdown_on_shop_page() {
global $product;
if( $product->is_type( 'variable' )) {
<?php
/**
* WooCommerce Extra Feature
* --------------------------
*
* Add custom fee to cart automatically
*
*/
function woo_add_cart_fee() {
<?php
if ( ! class_exists('Validate') ) {
class Validate {
/**
* Check if the value is present.
*
* @param mixed $value
* @return boolean
<?php
use Elementor\Plugin;
use Elementor\Widget_Base;
class Shapla_Hero_Slider extends Widget_Base {
/**
* Retrieve the name.
*
@majeedraza1
majeedraza1 / wordpress.test
Last active February 15, 2020 13:38
Nginx vHost configuration sample for WordPress project
server {
# Point your wordpress project directory. in our case it is (/var/www/wordpress.test)
root /var/www/wordpress.test;
index index.php;
# Give virtual host domain name
server_name wordpress.test www.wordpress.test;
location = /favicon.ico {
@majeedraza1
majeedraza1 / php-config-for-wordpress.ini
Created May 16, 2022 10:56
PHP configuration for a WordPress site.
; the maximum time in seconds a script is allowed to run before it is terminated by the parser
max_execution_time = 300
; the maximum amount of memory in bytes that a script is allowed to allocate.
; Suggested: 256 MB or greater
memory_limit = 128M
; How many input variables may be accepted
max_input_vars = 4000