Skip to content

Instantly share code, notes, and snippets.

View hectorcarranza's full-sized avatar

Héctor Carranza hectorcarranza

View GitHub Profile
function all_woocommerce_cart_expire_timeout(){
global $prod_ids;
global $product_timeout;
function action_woocommerce_add_to_cart( $array, $int, $int ) {
function perform_task() {
$start_time = time();
return $start_time;
}
@claudiosanches
claudiosanches / custom-my-account-endpoint.php
Last active October 28, 2024 06:17
Example of custom My Account endpoint.
<?php
class My_Custom_My_Account_Endpoint {
/**
* Custom endpoint name.
*
* @var string
*/
public static $endpoint = 'my-custom-endpoint';
<?php
/**
* Plugin Name: Woocommerce Vendors Bookings Management
* Description: Allows vendors to manage their bookings in the frontend
* Version: 1.0.0
* Author: Liam Bailey
* Author URI: http://webbyscots.com/
* License: GNU General Public License v3.0
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
*/
@emdashcodes
emdashcodes / woocommerce-cancel-unpaid-bookings.php
Created November 2, 2015 16:04
Allows WooCommerce booking orders to be canceled by the cancel unpaid orders cron job.
<?php
/*
* Plugin Name: Cancel Unpaid Bookings
* Author: WooThemes
* Description: Allows booking orders to be canceled by the cancel unpaid orders cron job.
*/
// woocommerce-cancel-unpaid-bookings.php
function woocommerce_cancel_unpaid_booking_orders_from_admin( $return, $order ) {
@WillBrubaker
WillBrubaker / gist:dbd3d21da0af6695f2de
Last active August 4, 2019 18:10
Change WooCommerce Bookings "Check Availability" button text
//not sure what to do with this code snippet? See https://www.thathandsomebeardedguy.com/what-do-i-do-with-these-code-snippets/
add_filter( 'woocommerce_booking_single_check_availability_text', 'wooninja_booking_check_availability_text' );
function wooninja_booking_check_availability_text() {
return "MY CUSTOM TEXT";
}
add_action( 'woocommerce_new_booking', 'wooninja_send_pending_confirmation_email', 10, 1 );
function wooninja_send_pending_confirmation_email( $booking_id ) {
$what_that = get_wc_booking( $booking_id );
$vendor_id = $what_that->custom_fields["_booking_vendor"];
$vendor_id = intval($vendor_id[0]);
$GLOBALS['pending_conf_vendor'] = $vendor_id;
add_filter( 'woocommerce_email_recipient_new_booking', 'wc_send_new_booking_multiple_addresses' );
@todiadiyatmo
todiadiyatmo / custom_post_type_and_capability.php
Last active July 8, 2019 22:59
WP Custom Post Type and Custom Capability Role
<?php
// Init new Role and add all capability to editor and admin
function custom_post_type_capability_admin()
{
// List the role that we want to give a full access
$roles = array('editor','administrator');
// List of the post type that will have custom capability
@foysalit
foysalit / dashboard_functions.php
Last active February 12, 2017 05:36
bdgeeks wp dashboard extension
<?php
/**
* class to customize dashboard of users
*/
class CFA_dashboard{
public $user_data;
public $username;
public function __construct()
{
@thefuxia
thefuxia / filter-test.php
Created August 24, 2012 23:31
T5 AJAX Search
add_filter( 't5_ajax_search_args', 'restrict_t5_search' );
function restrict_t5_search( $args )
{
$args['post_type'] = array ( 'post', 'domicile' );
#$args['cat'] = 47;
#$args['cat'] = 'php';
$args['category_name'] = 'php';
return $args;
}
@luetkemj
luetkemj / wp-query-ref.php
Last active April 6, 2025 09:15
WP: Query $args
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref
<?php
/**
* WordPress Query Comprehensive Reference
* Compiled by luetkemj - luetkemj.github.io
*
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php
*/