Skip to content

Instantly share code, notes, and snippets.

View weszty's full-sized avatar
🏠
Working from home

Vecsei Szilveszter weszty

🏠
Working from home
View GitHub Profile
@markjaquith
markjaquith / gist:2653957
Created May 10, 2012 15:36
WordPress Fragment Caching convenience wrapper
<?php
/*
Usage:
$frag = new CWS_Fragment_Cache( 'unique-key', 3600 ); // Second param is TTL
if ( !$frag->output() ) { // NOTE, testing for a return of false
functions_that_do_stuff_live();
these_should_echo();
// IMPORTANT
$frag->store();
// YOU CANNOT FORGET THIS. If you do, the site will break.
@burstofcode
burstofcode / wp-config.php
Created December 2, 2017 20:41
There are two things to understand when uninstalling or removing WooCommerce. * If you deactivate and delete the plugin from WordPress, you only remove the plugin and its files. Your settings, orders, products, pages, etc… will still exist in the database. * If you need to remove ALL WooCommerce data, including products, order data, etc., you ne…
<?php
/** * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
* Open your site’s wp-config file and add
* define( 'WC_REMOVE_ALL_DATA', true);
* on its own line above the
* That’s all, stop editing! Happy blogging. line.
* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
define( 'WC_REMOVE_ALL_DATA', true);
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
get_option( 'woocommerce_terms_page_id' );
@weszty
weszty / wl-api.php
Created August 3, 2021 13:19 — forked from ivandoric/wl-api.php
WordPress Rest API Custom Filters (Video Tutorials Notes) - Check out the video: https://www.youtube.com/watch?v=5rSfAkLO5eo
<?php
/**
* Plugin Name: Custom API
* Plugin URI: http://chrushingit.com
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI: http://watch-learn.com
*/
@radist2s
radist2s / cf7-hooks.php
Created March 15, 2018 16:09
WordPress Contact Form 7 custom chars validation hooks
<?php
<?
// Hooks only for version 5 only, may be for previous version also works
if (!defined('WPCF7_VERSION') OR intval(WPCF7_VERSION) !== 5)
{
return;
}
add_filter( 'wpcf7_validate_text', 'wpcf7_text_allowed_chars_validation_filter', 11, 2 );
add_filter( 'wpcf7_validate_text*', 'wpcf7_text_allowed_chars_validation_filter', 11, 2 );
<!doctype html>
<html>
<head>
<style>
body{
background-color: #dfdfdf;
}
.box {
display: block;
width: 800px;
@bradyvercher
bradyvercher / installed-plugin-details.php
Created February 2, 2013 05:23
WordPress Plugin: Show a "Details" link for installed plugins to view information from the WordPress.org plugin directory.
<?php
/**
* Plugin Name: Installed Plugin Details
* Description: Show a "Details" link for installed plugins to view information from the WordPress.org plugin directory.
* Version: 1.0.0
* Author: Blazer Six
* Author URI: http://www.blazersix.com/
* License: GPL-2.0+
* License URI: http://www.gnu.org/licenses/gpl-2.0.html
*
@ivandoric
ivandoric / wl-api.php
Created October 5, 2020 09:17
WordPress Rest API Custom Filters (Video Tutorials Notes) - Check out the video: https://www.youtube.com/watch?v=5rSfAkLO5eo
<?php
/**
* Plugin Name: Custom API
* Plugin URI: http://chrushingit.com
* Description: Crushing it!
* Version: 1.0
* Author: Art Vandelay
* Author URI: http://watch-learn.com
*/
@jtsternberg
jtsternberg / cmb2-number-field.php
Last active February 28, 2022 03:30
CMB2 Number Field
<?php
$cmb->add_field( array(
'name' => __( 'Postive numbers', 'theme-domain' ),
'desc' => __( 'Numbers only', 'msft-newscenter' ),
'id' => $prefix . 'number',
'type' => 'text',
'attributes' => array(
'type' => 'number',
'pattern' => '\d*',
<?php # -*- coding: utf-8 -*-
/**
* Create a nav menu with very basic markup.
*
* @author Thomas Scholz http://toscho.de
* @version 1.0
*/
class T5_Nav_Menu_Walker_Simple extends Walker_Nav_Menu
{
/**