Skip to content

Instantly share code, notes, and snippets.

@danielbachhuber
danielbachhuber / wordpress-language-codes.csv
Created April 24, 2020 12:35
Language / locale codes used in WordPress
language english_name native_name
af Afrikaans Afrikaans
ar Arabic العربية
ary Moroccan Arabic العربية المغربية
as Assamese অসমীয়া
az Azerbaijani Azərbaycan dili
azb South Azerbaijani گؤنئی آذربایجان
bel Belarusian Беларуская мова
bg_BG Bulgarian Български
bn_BD Bengali (Bangladesh) বাংলা
@mtx-z
mtx-z / wp-bootstrap4.4-pagination.php
Last active April 4, 2023 12:55
Wordpress 5.4 Bootstrap 4.4 pagination (with custom WP_Query() and global $wp_query support) (UPDATED for Bootstrap 5: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507)
<?php
/**
* @param WP_Query|null $wp_query
* @param bool $echo
* @param array $params
*
* @return string|null
*
* UPDATE for Bootstrap 5.0: https://gist.github.com/mtx-z/af85d3abd4c19a84a9713e69956e1507
*
@dasbairagya
dasbairagya / index.txt
Last active December 6, 2017 10:07
List of necessary codes at a glance.
---List of all gists at a glance---
1)Display WooCommerce Recently viewed products Without a Shortcode.
2)Display WooCommerce Latest Products Without a Shortcode.
3)Add custom columns to the user table of the admin dashbord.
4)front-end to cpt including image(advance).Used in sharespace.
5)short code to get the woocommerce recently viewed products.
6)Show woocommerce featured product in home page.
7)Get the image,title and link of the parent term of product_cat taxonomy in woocommerce for creating the slide in home page with parent category.
8)Woocommerce product-details page common customization.
9)Display an Image Spinner During an Ajax Request.
@corsonr
corsonr / create-woocommerce-order-dynamically.php
Created April 4, 2017 10:03
Create a WooCommerce Order Dynamically
<?php
/*
* Create order dynamically
*/
add_action( 'woocommerce_before_checkout_form', 'create_order' );
function create_order() {
global $woocommerce;
@cryptexvinci
cryptexvinci / remove_checkout_fields.php
Last active March 3, 2024 00:43
Remove fields from WooCommerce checkout page.
<?php
add_filter( 'woocommerce_checkout_fields' , 'custom_remove_woo_checkout_fields' );
function custom_remove_woo_checkout_fields( $fields ) {
// remove billing fields
unset($fields['billing']['billing_first_name']);
unset($fields['billing']['billing_last_name']);
unset($fields['billing']['billing_company']);
@jasperf
jasperf / cf7.css
Last active June 9, 2022 09:34 — forked from codehandling/cf7.css
Contact Form 7 Styles for basic CSS styling of the form. Form is responsive and has nice rounded corners. For labels and placeholders you need to edit the form in CF7 https://imwz.io/contact-form-7-css-boilerplate/
/*
** Contact Form 7 basics
**
**/
/* Form width and border */
.wpcf7 {
text-align: left;
width: 90%;
@mikejolley
mikejolley / functions.php
Created February 10, 2017 14:49
WooCommerce - Notify admin when a new customer account is created
<?php // Do not include this if already open!
/**
* Code goes in theme functions.php.
*/
add_action( 'woocommerce_created_customer', 'woocommerce_created_customer_admin_notification' );
function woocommerce_created_customer_admin_notification( $customer_id ) {
wp_send_new_user_notifications( $customer_id, 'admin' );
}
@pixelbart
pixelbart / functions.php
Created January 10, 2017 11:41
Add this in your functions.php and optimize some simple things
<?php
/**
* WordPress Optimizing
*/
// Remove Query String from Static Resources
function remove_cssjs_ver( $src ) {
if( strpos( $src, '?ver=' ) )
$src = remove_query_arg( 'ver', $src );
return $src;
@grayayer
grayayer / on-sale-woocommerce-sort.php
Created November 28, 2016 02:40
Order Products by ‘On Sale’ in WooCommerce
add_filter( 'woocommerce_get_catalog_ordering_args', 'wcs_get_catalog_ordering_args' );
function wcs_get_catalog_ordering_args( $args ) {
$orderby_value = isset( $_GET['orderby'] ) ? woocommerce_clean( $_GET['orderby'] ) : apply_filters( 'woocommerce_default_catalog_orderby', get_option( 'woocommerce_default_catalog_orderby' ) );
if ( 'on_sale' == $orderby_value ) {
$args['orderby'] = 'meta_value_num';
$args['order'] = 'DESC';
$args['meta_key'] = '_sale_price';
@timersys
timersys / remove-woo-slug.php
Last active May 24, 2023 09:01
Remove product-category slug from Woocommerce
<?php
/*
Plugin Name: Remove product-category slug
Plugin URI: https://timersys.com/
Description: Check if url slug matches a woocommerce product category and use it instead
Version: 0.1
Author: Timersys
License: GPLv2 or later
*/