Skip to content

Instantly share code, notes, and snippets.

View espiat's full-sized avatar
🎯
Focusing

DER SPANIER espiat

🎯
Focusing
View GitHub Profile
@espiat
espiat / wp-adv-admin-handbook.md
Created May 12, 2025 04:29 — forked from kasparsd/wp-adv-admin-handbook.md
WordPress handbooks as a single markdown file for LLMs (source https://developer.wordpress.org)

Advanced Administration Handbook

Source: https://developer.wordpress.org/advanced-administration/

Welcome to the WordPress Advanced Administration Handbook! Here you will find WordPress advanced documentation. Use the “Contents” menu on the left to navigate topics.

Why Advanced Administration?

Not all users who use WordPress have to know about technology, and therefore in its documentation should not appear either, and developers do not have to know certain advanced system configurations.

@espiat
espiat / functions.php
Created November 17, 2024 11:17 — forked from vielhuber/functions.php
cleverreach v3 api: add new recipient and send double opt in email #php #wordpress
// cleverreach api
$cleverreach = (object) [
'api_url' => 'https://rest.cleverreach.com',
'client_id' => 'xxxxxxxxxx',
'client_secret' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
'list_id' => 1337,
'form_id' => 1337,
'access_token' => null,
'email' => '[email protected]',
'source' => 'tld.com',
@espiat
espiat / acf-future-posts.php
Created March 10, 2022 10:59 — forked from aderaaij/acf-future-posts.php
Advanced Custom Fields datepicker: Show only events with a date of today or in the future. Extra comments from Pasnon @ ACF Forums: f you needed to, you could also play with the comparison date, which is the first array in meta_query, currently set to date("Y-m-d") which is today; if you were to make it date("Y-m-d", strtotime("-1 day")) you cou…
<?php
/*
* Display posts only from today and in the future:
* http://old.support.advancedcustomfields.com/discussion/6000/how-to-sort-posts-by-acf-date-and-display-only-future-posts
* by Pasnon
*/
$date_args = array(
'post_type' => 'events',
@espiat
espiat / add-submenu-page_to_custom_post_type_example.php
Created March 9, 2022 13:54 — forked from Njengah/add-submenu-page_to_custom_post_type_example.php
Simple function to add submenu page to a custom post type menu in WordPress admin
<?php
// Hook
add_action('admin_menu', 'add_tutorial_cpt_submenu_example');
//Callback function
function add_tutorial_cpt_submenu_example(){
@espiat
espiat / add_move_payment_request_checkout_page.php
Created December 20, 2021 21:25 — forked from dougaitken/add_move_payment_request_checkout_page.php
Adds the Payment Request button (Apple Pay) on the checkout page then moves it to after the customer details (WooCommerce Stripe extension)
// Adds the Payment Request button (Apple Pay) on the checkout page then moves it to after the customer details.
// Replace `woocommerce_checkout_after_customer_details` with wherever you want to
add_filter( 'wc_stripe_show_payment_request_on_checkout', '__return_true' );
remove_action( 'woocommerce_checkout_before_customer_details', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 1 );
remove_action( 'woocommerce_checkout_before_customer_details', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 2 );
add_action( 'woocommerce_checkout_after_customer_details', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 1 );
add_action( 'woocommerce_checkout_after_customer_details', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 2 );
@espiat
espiat / move_stripeprbutton.php
Created December 20, 2021 21:25 — forked from dougaitken/move_stripeprbutton.php
Moving the WooCommerce Stripe Payment Request buttons below the add to cart button
/** Move Stripe Payment Request Button on product page **/
remove_action( 'woocommerce_after_add_to_cart_quantity', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 1 );
remove_action( 'woocommerce_after_add_to_cart_quantity', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 2 );
add_action( 'woocommerce_after_add_to_cart_button', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_html' ), 2 );
add_action( 'woocommerce_after_add_to_cart_button', array( WC_Stripe_Payment_Request::instance(), 'display_payment_request_button_separator_html' ), 1 );
<?php
$args = array(
'label' => '', // Text in Label
'class' => '',
'style' => '',
'wrapper_class' => '',
'value' => '', // if empty, retrieved from post meta where id is the meta_key
'id' => '', // required
'name' => '', //name will set from id if empty
@espiat
espiat / functions.php
Created November 8, 2021 17:04 — forked from maddisondesigns/functions.php
WooCommerce Custom Fields for Simple & Variable Products
/*
* Add our Custom Fields to simple products
*/
function mytheme_woo_add_custom_fields() {
global $woocommerce, $post;
echo '<div class="options_group">';
// Text Field
@espiat
espiat / README.md
Created August 5, 2021 12:54 — forked from smatplacid/README.md
Oxygen Child Theme Support

Oxygen 'Child Theme' Support

This function is for developers, which use Oxygen and still want to override plugin-files when it reads in their documentation such as

  1. Create a folder in your theme folder called search-filter.
  2. Copy the file wp-content\plugins\search-filter\templates\results.php from the templates folder in to the newly created folder in your theme – wp-content\themes\your-theme-name\search-filter\results.php

Where to put such files, if Oxygen is not a theme and won't uses themes ?

Usage

@espiat
espiat / functions.php
Created June 24, 2021 13:21 — forked from maxkostinevich/functions.php
WordPress: Export custom data to CSV
<?php
/**
* Export Data to CSV file
* Could be used in WordPress plugin or theme
*/
// A sample link to Download CSV, could be placed somewhere in plugin settings page
?>
<a href="<?php echo admin_url( 'admin.php?page=myplugin-settings-page' ) ?>&action=download_csv&_wpnonce=<?php echo wp_create_nonce( 'download_csv' )?>" class="page-title-action"><?php _e('Export to CSV','my-plugin-slug');?></a>