Skip to content

Instantly share code, notes, and snippets.

View ioniacob's full-sized avatar
🐌
Exploring the code is like life itself.

Ion Iacob ioniacob

🐌
Exploring the code is like life itself.
View GitHub Profile
<?php
const ACTION_NAME = 'shea_ajax_example';
$handler = function () {
check_ajax_referer( ACTION_NAME );
wp_send_json_success( 'it works!' );
};
@hmowais
hmowais / functions.php
Created December 1, 2020 09:59
Background Animation
// Enqueue Files
function theme_enqueue_styles() {
wp_enqueue_style( 'animate-style', 'https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.1.0/animate.min.css', array() );
wp_enqueue_script( 'wow-js', 'https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js', array() );
}
add_action( 'wp_enqueue_scripts', 'theme_enqueue_styles' );
function wow_js() { ?>
@hmowais
hmowais / google-reviews.php
Created April 5, 2020 15:38
google reviews php
<?php
/*
Configuration.
Note: You'll need a Google maps API key - requires both Maps JS and Places API services enabled.
*/
$place_ID = ''; // Get from: https://developers.google.com/places/place-id
$business_type = ''; // Example: FinancialService (http://schema.org)
$business_name = '';
$street_address = '';
@anibalardid
anibalardid / selector.php
Last active July 16, 2019 12:01
[carga condicional plugins wp] codigo mio viejo #WordPress #Plugins
<?php
// My post: https://es.wordpress.org/support/topic/tutorial-como-deshabilitar-algunos-plugins-de-algunas-paginas-especificas/
/*
Plugin Name: Plugin Selector
Plugin URI: https://ardid.com.ar
Description: Removes plugins in selected pages
Author: Anibal Ardid
Version: 1.0
Author URI: https://ardid.com.ar
*/
@woogists
woogists / wc-hide-all-shipping-if-free-shipping-is-available.php
Last active May 14, 2024 12:47
[General Snippets][Hide other shipping methods when “Free Shipping” is available] Hides all other shipping methods but free_shipping if it’s available. Compatible with Shipping zones.
/**
* Hide shipping rates when free shipping is available.
* Updated to support WooCommerce 2.6 Shipping Zones.
*
* @param array $rates Array of rates found for the package.
* @return array
*/
function my_hide_shipping_when_free_is_available( $rates ) {
$free = array();
foreach ( $rates as $rate_id => $rate ) {
@woogists
woogists / wc-change-email-subject.php
Last active December 29, 2022 13:52
Change email subject lines
/*
* goes in theme functions.php or a custom plugin
*
* Subject filters:
* woocommerce_email_subject_new_order
* woocommerce_email_subject_customer_processing_order
* woocommerce_email_subject_customer_completed_order
* woocommerce_email_subject_customer_invoice
* woocommerce_email_subject_customer_note
* woocommerce_email_subject_low_stock
@woogists
woogists / wc-rename-tabs.php
Last active July 5, 2023 22:17
[Frontend Snippets][Editing product data tabs] Renaming product data tabs
/**
* Rename product data tabs
*/
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
$tabs['description']['title'] = __( 'More Information' ); // Rename the description tab
$tabs['reviews']['title'] = __( 'Ratings' ); // Rename the reviews tab
$tabs['additional_information']['title'] = __( 'Product Data' ); // Rename the additional information tab
@ioniacob
ioniacob / woocommerce-optimize-scripts.php
Created February 4, 2018 21:28 — forked from DevinWalker/woocommerce-optimize-scripts.php
Only load WooCommerce scripts on shop pages and checkout + cart
/**
* Optimize WooCommerce Scripts
* Remove WooCommerce Generator tag, styles, and scripts from non WooCommerce pages.
*/
add_action( 'wp_enqueue_scripts', 'child_manage_woocommerce_styles', 99 );
function child_manage_woocommerce_styles() {
//remove generator meta tag
remove_action( 'wp_head', array( $GLOBALS['woocommerce'], 'generator' ) );
@orfeomorello
orfeomorello / functions.php
Last active May 21, 2022 19:06
Customize Wordpress Profile
function remove_personal_options(){
echo '<script type="text/javascript">jQuery(document).ready(function($) {
$(\'form#your-profile > h2:first\').remove(); // remove the "Personal Options" title
$(\'form#your-profile tr.user-rich-editing-wrap\').remove(); // remove the "Visual Editor" field
$(\'form#your-profile tr.user-admin-color-wrap\').remove(); // remove the "Admin Color Scheme" field
$(\'form#your-profile tr.user-comment-shortcuts-wrap\').remove(); // remove the "Keyboard Shortcuts" field
@DreySkee
DreySkee / DataActions_Menus.js
Last active January 24, 2019 06:21
WP-API DataActions with menus endpoint
import axios from 'axios';
import alt from './../alt/alt.js';
class DataActions {
constructor() {
const appUrl = 'http://andreypokrovskiy.com/projects/wp-api'; // Wordpress installation url
this.pagesEndPoint = `${appUrl}/wp-json/wp/v2/pages`; // Endpoint for getting Wordpress Pages
this.postsEndPoint = `${appUrl}/wp-json/wp/v2/posts`; // Endpoint for getting Wordpress Posts